There are four alternatives to adjust the text those are the
right, left, centre, and
justify. Left avocation have a worn out of right edge, while supported justification makes the right edge and left edges of the content line up vertically. For paragraphs such as chapter
headings, title, and the
section breaks, user most likely need centred text. The code below demonstrates the text alignment as shown below.
[html]
<!DOCTYPE html>
<html>
<body>
<p style="text-align: left; font-weight: bold;">XHTML</p>
<p style="text-align: center; font-style: italic;">SPLessons</p>
<p style="text-align: right; text-decoration: underline;">splessons Copyright Info</p>
</body>
</html>
[/html]
Result
By running the above code in a preferred browser user can get the following output as shown in below image.
<div>, <p>, and <span> Hierarchy
The
<div>, <p>, and <span> tags all swap around content in XHTML and which permit style properties to be included then eReader and web browser also know how to show the text. Which tags are utilized over various sizes of text as follows.
- <span> is used to get the text within a paragraph
- <p> is used to get a paragraph
- <div> is used to get multiple paragraphs
<div> tag is used to apply styles to the multiple paragraphs without any changes to the style property in each individual <p> tag. The code below demonstrates the XHTML hierarchy as shown.
[html]
<!DOCTYPE html>
<html>
<body>
<div style="font-weight: bold; text-align: right;">
<p style="text-align: left;">SPLessons:</p>
<p>Visit <span style="font-weight: normal;">SPLESSONS</span> web site for simple programming lessons.</p>
</div>
</body>
</html>
[/html]
Result
By running the above code in a preferred browser user can get the following output as shown in below image.