Text properties in CSS

Source: Internet
Author: User
Tags reference string


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.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.