Whereas margins and padding affect the
whole block, text-indent only applies
to the first rendered line of text in the
element.
Example
These rules style paragraphs in a way that??™s
common in novels??”there??™s no vertical
space between the paragraphs, and each
paragraph except the first is indented 1.5
em squares:
p {
margin: 0;
text-indent: 1.5em;
}
p:first-child {
text-indent: 0;
}
Using text-indent to Hide Text
Setting text-indent to a large negative value is a technique commonly used to
???hide??? short texts??”such as structural headings??”in visual browsers without hiding
them from screen readers (as is the case with display:none). For example, a
text-indent value of -9999px is high enough to push the text far off the
screen??”even for large viewport sizes.
Value
Negative values are legal.
A length specifies an indentation of a fixed length.
A percentage specifies an indentation that??™s a percentage of the containing block??™s
(p. 147) width.
335 Typographical Properties
Compatibility
Opera Safari Firefox Internet Explorer
9.
Pages:
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496