Attributes provide additional information about an element or a tag, while also modifying them. Most attributes have a value; the value modifies the attribute.
This text is aligned to center
In this example, the value of “center” indicates that the content within the p element should be aligned to the center:
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:
An element width can also be defined using 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.
<p align=”center”>This is a text <br />
<hr width=”10%” align=”right” /> This is also a text.
You may be wondering what happens if you try to apply contradictory attributes within the same element.
This is a text.
<hr width=”50%” align=”left” />
CLICK ON THE BUTTON BELOW TO GO TO THE HTML MAIN COURSE PAGE.
© License: All Rights Reserved
CONTACT HOLLA TECH – LEARN SUPPORT