Div Summary: Useful 3 Web page making tips

Source: Internet
Author: User
Tags beginners content hack it is learning nothing use web

We are in the divcss layout, very concerned about the learning of CSS skills, today to recommend 3 so-called "top" CSS tips! Although nothing new, but for beginners is very important!

Declare CSS in one line

H2 {</p>

<P>font-size:18px;</P>

<P>BORDER:1PX Solid blue;</p>

<p>color: #000;</p>

<p>background-color: #FFF;

H2 {

font-size:18px;

BORDER:1PX solid blue;

Color: #000;

Background-color: #FFF;

}

The second one looks really formatted, but it doesn't help with reading. Writing in one line allows you to quickly find the part you need.

I used to write a similar second way, but gradually discovered as the article said, not much use. A line looks refreshing and saves the place and makes the file smaller.

Second, block writing code

This way the writing code can make CSS more page, in the presence of problems can be the shortest time to find the problem. Just like the following:

#content {float:left;}

#content p {&hellip;}

#sidebar {float:left;}

#sidebar p {...}

#footer {Clear:both;}

#sidebar p {...}

Third, browser compatibility issues

Only the latest browsers are supported. That means giving up IE5 and IE5.5. This will save a lot of time. For IE6, it is not necessary to use the box model hack. If it's only for popular browsers, the same effect can be achieved with very little hack.

I pay attention to the new version of NetEase's homepage CSS, which unexpectedly a!important or hack are not, but in FF and IE inside display effect is very good. Reasonable use of CSS can avoid hack. Of course, there will be more time for debugging.

All content within the container containing the floating element should be designed to be consistent with the container. If it is too large, it will slide to the wrong position. Using negative margin to adjust outside the container can also cause slippage.

Understanding overflow If there are two floating elements in the page, outputting too much content in the left container will cause the right container to go down below. This means your margin, width or padding settings are confusing, but not in FF. Use Overflow:hidden or overflow:scroll to avoid ie allowing content to flush out of the container.

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.