CSS Small Summary

Source: Internet
Author: User

1. Float closure
1) Add a new div child element Clear:both
2) parent element style overflow:auto;zoom:1;
3) after pseudo-class add element

Div:after {   display:block;    Clear:both;    content:".";    Visibility:hidden;    height:0;}

2. IE does not recognize min-, parent element style settings

height:auto!important;height:150px;min-height:150px;

3. float div in IE margin double and other issues

#box {float:left; width:100px; margin:0 0 0 100px; display:inline;}

4. The UL tag has list-style and padding under FF, so it is best to set the common style for compatibility.

ul {margin:0px; padding:0px; List-style:none;}

5. About Hand type cursors:

IE under Cursor:pointer, while IE is hand

6. Problems in the play in CSS layout

{text-align: center;}  { margin-right: auto; margin-left: auto;}

7. CSS Tips

1) CSS Shorthand

Font:bold Italic small-caps 1em/1.5em verdana,sans-serif;background: #00FF00 url (bgimage.gif) no-repeat fixed top; border:5px solid red;

2) Photo Replacement tips

{background: url (/blog/widget-image.gif) no-repeat; height: 100px; text-indent: -2000px;}

8. CSS3 transition Animation, etc.

CSS3 border [-O-,-webkit-,-Moz-]border-radius, Box-shadow, BORDER-IMAGECSS3 background background-size, Background-origin

9. Use "..." for extra text

. Ellipsis {width: 100px; overflow:hidden; text-overflow:ellipsis; white-space: nowrap;}

10. Advantages and disadvantages of pseudo-class:

The advantage is that you can add special effects to some selectors. Pseudo classes are not recognized on IE. The fundamental difference between pseudo-classes and elements is that they create new elements. If you need to add a new element to identify it as an element, and vice versa, you only need to add a class to the existing element. If you do not use pseudo-elements, you need to add additional elements, and if you do not use pseudo-classes, you only need to add a class

Used to add special effects to some browsers.
Pseudo-classes can be used to represent the dynamic state of some elements, such as the individual states of a link, and to represent elements that are logically present but do not need to be flagged in the document tree, such as the first paragraph P:first-child
Pseudo-elements represent the child elements of an element that, while logically present, do not actually exist in the document, such as the first line of a paragraph p:first-line

Pseudo-Class:

Pseudo elements:

CSS Small Summary

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.