Common CSS Code Snippets

Source: Internet
Author: User

1. Custom text selection style (IE8 and below are not supported)

:: Selection {color:#9400D3; background:#A9A9A9;} ::-moz-selection {color:#9400D3; background:#A9A9A9;}

2. Interval and Spacing

p.wordspacing{word-spacing:20px;}/*set the length of a space*/p.letterspacing{letter-spacing:20px;}/*Set Word spacing*/P.lineheight{Line-height:0.3;}/*Set Line spacing*/P.whitespace_normal{White-space:Normal;}/*by default, ignoring multiple spaces is 1, ignoring carriage return characters*/P.whitespace_pre{White-space:Pre;}/*Keep Multiple spaces*/P.whitespace_nowrap{White-space:nowrap;}/*Ignore carriage return, prohibit line wrapping until a BR is encountered*/P.whitespace_prewrap{White-space:Pre-wrap;}/*Keep all whitespace and carriage return characters*/P.whitespace_preline{White-space:Pre-line;}/*ignore multiple spaces for 1, keep carriage return*/

3. Text Decoration

/*text line is above*/. Overline{text-decoration:overline;}/*text line is below*/. Through{text-decoration:Line-through;}/*text line in the middle*/. Underline{text-decoration:Underline;}/*Oblique*/. Italic{Font-style:Italic;}/*Tilt*/. Oblique{Font-style:Oblique;}

4. The text exceeds the width of the parent element, then the ellipsis replaces

  Div.elli{border:1px solid;  Overflow:hidden/* beyond partially hidden */white-space:nowrap; /* force display on one line */ text-overflow:ellipsis; width:200px; height:20px;}

Not finished

Common CSS Code Snippets

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.