Several common classic CSS skills

Source: Internet
Author: User

Vertical center using line-height

Line-Height: 24px;
Use line-height (the height is the same as that of the parent-layer container) when a fixed-width container is used and a line of vertical residence is required. For more vertical center summaries, see here.

Clear container float

# Main {
Overflow: hidden;
}
This problem was also mentioned before. For more information, see here.

Do not fold links

A {
White-space: nowrap;
}
The above settings can avoid link folding, but I personally suggest that the long link have a corresponding line (for details about the line feed, refer to the record of the center ).

Always display the scroll bar in Firefox

HTML {
Overflow:-moz-scrollbars-vertical;
}
For more Mozilla/Firefox private CSS attributes, refer to here. Cross-browser support is required.

Body, HTML {
Min-Height: 101%;
}
Horizontally center block elements

Margin: 0 auto;
Actually

Margin-left: auto;
Margin-Right: auto;
Basically, all CSS textbooks will illustrate this technique. Don't forget to add a width to it. Exploer can also be used

Body {
Text-align: center;
}
Then define the inner container

Text-align: left;
Restore.

Hide the scroll bar of exploer textarea

Textarea {
Overflow: auto;
}
By default, exploer has a vertical scroll bar in textarea (don't ask me why ).

Set print pages

H2 {
Page-break-before: Always;
}
The page-break-before attribute can be used to set the page for printing a webpage.

Delete the dotted box on the Link

A: active, A: Focus {
Outline: none;
}
By default, Firefox adds a dotted box to the link to get the focus (or click it). The above attributes can be deleted.

Simplest CSS Reset

*{
Margin: 0; padding: 0
}
If you want to "complex", refer to the Yui practice (and here ). Some users have also expressed their views in the original text message.

I have to agree with Niall Doherty, * {margin: 0px; padding: 0px ;}
Basically means "traverse every CSS element and give it these
Attributes ". That is a very unnecessary strain on the server and
A bad semantic practice, as you have to give some elements
Padding/margin again, after stripping them.

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.