Attributes are used to personalize tags What do I mean? Somehow, someday you want to resize an image or a table or change a font color. All these features are possible with the help of
Most of the tags have their properties, we will talk about it because we add it to our new tags. We will learn about a set of common properties, which can be used with most of the tag
Attribute is placed between the angular brackets (<>) of the opening tag
"class" and "id" attributes in HTML
These two characteristics are mostly the same, they have no direct role in the formatting of the elements, but they are useful behind the scenes with the help of CSS. When we study their syntax and their work in CSS, we will talk about their role at the right time.
The idea is that when you want to define a range of tags to be used later with the help of CSS, you can make a difference between two identical tags but with different attributes. Take a look at the next example:
Example-
<p id="italic">Paragraph type 1, italic </p>
<p id="bold">Paragraph type 2, bold </p>
The "name" attribute
"name" is a bit different from "id" and "class". If you give a name to an element, this is a script variable for JavaScript, ASP and PHP. Something that is very often meet in formulations and other interactive text fields ...
Example-
<input type="text" name="TextField" />
"title" attribute
This feature is rarely used. It adds a title (a pop-up) to the content of each element. This feature should not be forgotten. You can name almost everything, though you want visualization to appear when you need to pause your mouse over the content for a few seconds.
Example-
<h2 title="I am a title!!">A title</h2>
"align" attribute
If you want to align some elements of your page in a different way, then you have about the "align" attribute. You can align almost every element in the center of the left, right or center. The basic elements will be aligned to the left, except that it should be specified as another alignment.
Example-
<h2 align="center">Centered title </h2>
Attribute | Options | Function |
align | right, left, center | Horizontal alignment |
valign | top, middle, bottom | Vertical alignment |
bgcolor | numerical, hexadecimal, or RGB value | A background behind an element. |
background | URL | An image behind an element. |
id | Defined by user | Names an element which will be used with CSS. |
class | Defined by user | Classifies un element which will be used with CSS |
width | Numerical value | Specifies the width of a table, image or table box. |
height | Numerical value | Specifies the height of an table, |
title | Defined by user | "pop-up" a title for an element |
0 comments:
Post a Comment