Specifying the Horizontal Alignment of a Paragraph

Alignment refers to the horizontal placement of the paragraph. You can specify alignment in a style by using the text-align attribute. Alignment can be applied only to block-level elements, such as paragraphs, list items, headings, and so on. (A block-level element is one that occupies a complete paragraph or more.) The default alignment setting is left; the other choices are center, right, and justify.

Specifying the Horizontal Alignment of a Paragraph

Notice that justified text aligns all lines of the paragraph, except the last one, at both the right and left. The last line of a justified paragraph is always left-aligned. Justified text can sometimes ...

Get HTML and XHTML Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.