Summarize CSS Usage tips

Source: Internet
Author: User
Center vertically with Line-height

line-height:24px;
With a fixed-width container and one row vertically centered, use Line-height (the height is consistent with the parent container), and more vertical centers can be seen here.

Clear Container Float

#main {Overflow:hidden;}

Before the issue was mentioned, more information can be seen here.

Do not leave a link wrapped

a {white-space:nowrap;}

The above setting avoids the link wrapping, but the individual suggests that the long link will have a corresponding line (for a discussion of line breaks, see the records in the center of the circle).

Always let Firefox show scroll bars

HTML {overflow:-moz-scrollbars-vertical;}

More Mozilla/firefox private CSS properties can be consulted here. Requires cross-browser support, or you can use the

Body, HTML {min-height:101%;}

Center The Block element horizontally

margin:0 Auto;
is actually

Margin-left:auto;
Margin-right:auto;
This technique basically all the CSS textbooks will have a description, don't forget to add a width to it. can also be used under Exploer

body{Text-align:center;}

Then define the inner layer container

Text-align:left;
Recovery.

Hide Exploer textarea scroll bar

textarea {Overflow:auto;}

Exploer By default textarea will have a vertical scroll bar (don't ask me why).

Set up print paging

h2 {page-break-before:always;}

The Page-break-before property enables you to set pagination when a page is printed.

Delete a dashed box on a link

A:active, A:focus {outline:none;}

Firefox defaults to a dotted box when the link gets focus (or when clicked), and can be deleted using the properties above.

The simplest CSS reset

* {margin:0; padding:0}
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.