You may not know the 10 CSS tips

Source: Internet
Author: User
Tags versions
css| Tips
  1. Shorthand for font
    CSS many elements have shorthand, font to be special and strict, font-size and font-family is necessary, and in this order. Because font there are so many places to use, he may be particularly mentioned. Abbreviations can effectively reduce the size of your CSS files.
  2. Class Attribute Overlay
    In fact class , you can add multiple properties at the same time, and the properties are separated by spaces. For example: <p class="text side">...</p> This <p> inherits the .text valid attributes of the and .side (where the conflict is automatically excluded). Just to mention it, there is one place in the Kubrick theme that uses this method. Users of this article replied that IE may have problems dealing with multiple attributes.
  3. Default value for Border
    When you do not specify and when you use border shorthand, the border-width border-color border has a default value of width medium (approximately 3 to 4 pixels), and the color is the color of the text in the box.
  4. !important Ignore IE
    In CSS rules, this !important rule takes precedence, and IE doesn't understand this rule, and at some point this technique can be very useful.
  5. Picture moving the Soul Dafa
    If you look at the original narrative, I'll talk about my experience. Haha, I first found this technique in Zeldman's blog , pay attention to his navigation bar, hover when the hollow word picture will become solid, and actually this is a picture. Oh, you have to analyze his CSS to know.
  6. The alternative hack method of box mode
    IE6 Previous versions have a wrong understanding of box mode. Used to look at the sound properties of CSS to deal with the IE6 the following version of the effect, this time you can look at another method, looks more simple and convenient.
  7. Block element centered
    We generally use the specified block width and then set the left and right to margin auto Center. There are sometimes problems with versions before IE6. To see the solution, there are CSS examples.
  8. Center vertically
    CSS is weaker for vertical centering than table-less flexible. and vertical-align This attribute you just use and it doesn't work. The method is to use row height to solve, the row height set to the height of the entire box.
  9. Positioning of child containers
    The magic of CSS in addition to the object can be positioned everywhere, but also to make the child containers can also be done. This is a lot of use. such as the Binary bonsai navigation bar.
  10. Control the background color at the bottom of the screen
    This please see the original text of the detailed explanation.


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.