Holla Tech-Learn

HTML Attributes
 

Attributes provide additional information about an element or a tag, while also modifying them. Most attributes have a value; the value modifies the attribute.

<p align=”center”>
This text is aligned to center
</p> [.su_quote] 


In this example, the value of “center” indicates that the content within the p element should be aligned to the center:

Holla Tech - Learn HTML


NOTE:
Attributes are always specified in the start tag, and they appear in name=”value” pairs.

Attribute Measurements
 

As an example, we can modify the horizontal line so it has a width of 50 pixels.

This can be done by using the width attribute: 

<hr width="50px" />

An element width can also be defined using  percentages.: 

<hr width=”50%” />
NOTE:
An element’s width can be defined using pixels or percentages. 

The Allign Attribute
 

The align attribute is used to specify how the text is aligned.

In the example below, we have a paragraph that is aligned to the center, and a line that is aligned to the right.

<html>
<head>
<title>Attributes</title>
</head>
<body>
<p align=”center”>This is a text <br />
<hr width=”10%” align=”right” /> This is also a text.
</p>
</body>
</html>
 


NOTE:
The align attribute of <p> is not supported in HTML5.

Attributes
 

You may be wondering what happens if you try to apply contradictory attributes within the same element. 

<p align=”center”>
This is a text.
<hr width=”50%” align=”left” />
</p>

Holla Tech - Learn HTML


NOTE:
The align attribute of <p> is not supported in HTML5.

 

BACK NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE HTML MAIN COURSE PAGE. 

HTML MAIN COURSE PAGE

 


© License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT