Eight necessary tips for designing Web pages with div CSS

Source: Internet
Author: User
Tags min
css| Tips | design | Web page Here are eight of the necessary tips for CSS design, and good habits can make your design cycle a little shorter. (If you would like to know more please refer to the Post book "CSS Pristine-101 Design Tips" by people's post and Telecommunications press)

1. If you have any questions, check immediately.

If you can make a simple test of the original code in case of an error, you can save a lot of headaches. The consortium has detection tools available for both XHTML and CSS, see http://validator.w3.orgNote that errors at the beginning of the file may cause more errors due to improper structure and so on, and we recommend that you check again after some of the most obvious errors, which may cause the number of errors to explode.

2. When using the floating function, remember to clear the instructions properly

Floating is a dangerous feature that does not necessarily produce the results you expect. If you encounter a floating element that extends to the bounding box or other abnormal conditions, make sure you are doing the right thing first.

3. Use padding or border to avoid when the border is coincident

You may be overwhelmed with space that you shouldn't have, or if you need a little space, you can't squeeze it out. If you are useful to margin, then it is easy to create a superposition of boundaries;

4. Try to avoid specifying padding/border and height or width of elements at the same time

Windows version of IE often results in the calculation of width and height. If the parent element needs to specify height and width, it is best to apply margin to the child elements within the parent element, or to apply padding to the parent element when the child element needs to specify the height and width.

5. Do not rely on Min-width/min-height

Windows version of IE does not support both syntaxes. But in a way, Windows version of IE can achieve the equivalent of min-width/min-height effect, so as long as the IE do point filtering function, you can achieve the desired results.

6. If in doubt, reduce the percentage first

Sometimes some errors make 50%+50% 100.1%, causing the page to have problems. Then try to change these values to 49% or even 49.9%.

7. Remember the "troubled" notation

The shorthand syntax for border,margin and padding is in a specific order and rotates clockwise from the top: top,right,bottom,left. So margin:0 1px 3px 5px, the result is no boundary above, 1 pixels to the right, and so on. Remember "Trouble" and you don't get the wrong order.

8. Specify the unit as long as it is not a zero value

CSS requires you to specify units for various values, such as each font,margin. (The only exception is Line-height)

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.