This paper summarizes the relevant attributes of text in CSS, and finally gives an example.
CSS underlying text properties
The basic attributes of text include: font, color, and text. In addition to the properties of color colors, the related properties of the font and text can be authoritative for reference:
CSS Text properties (text)
CSS font attributes (font)
CSS3 New Properties
- text Shadow : Text-shadow
- text overflow : text-overflow
This property generally needs to be matchedoverflow:hiddenandwhite-spance:nowrap(强制文本容器不换行)used.
- Wrapping Text : Word-wrap word-break
Here are two settings that are a bit like the one that breaks the line at the right edge of a long word or a string of URLs and numbers. The difference is:word-wrap:break-wordfirst try to move the long string into the next line, if it still does not appear, cut off the split, andword-break:break-allwill be directly cut.
code example
In addition, the propertywhite-spacealso has an effect on text wrapping, which forces the line to be wrappednowrap.
Practical application
Using the Text-overflow property of the text overflow, you can set the text display for the list.
That is, make full use of space and ensure a beautiful style, see code examples
Text Set Tips
Cell TD Wrap:
Table {
table-layout:fixed;//column widths are set by table width and column width.
width:**px;
}
Table td{
Overflow:hidden;
Word-wrap:break-word;
}
Vertical center of text vertical-align:
This question perhaps everybody often encounters, I have not known the specific solution, may refer to these two articles I to the CSS vertical-align some understanding and the understanding and the unknown height multiline text vertically center. Just say the main point, vertical-align settings must have a reference point, and Vertical-align only in the Inline-block container is valid, block-level element container set Vertical-align does not work.