Learn some css/xhtml knowledge of Web Standards summary 1th/3 Page _ Experience Exchange

Source: Internet
Author: User
1, a lot of compatibility problems, because different tags in different browsers have different padding margin default values. So you can define it beforehand.
Copy Code code as follows:

* {padding:0; margin:0;}

Or
Copy Code code as follows:

ul,li,h1,h2,h3,h4,h5,h6,p,table,td,div,img,hr,dd,dt,span,a,dt,dd,ol{margin:0;padding:0;font-size:12px;}



2, about the layout, you can see Dreamweaver cs3 in the template how to write, it is the best way of writing. Large layout, you can directly use the default templates in the Dreamweaver cs3. Then remove the annotation and use it.

3, the appropriate use of margin/padding, in the Adjustment box (box), the element position, the Use of box (box) padding better. Instead of using the margin of the elements inside the box.

The reason is, box inside the element uses margin time, will have the influence to box's margin, produces the dislocation.

But in the use of padding attention point: such as originally width:100px box, if set the padding-left:20px, then the width minus 20px.

4, a box, set the border, to the width minus border thick. For example, width:100px box, about 1px side, that should be set box width of 98px.

5, when adding box, can not give the width and height, as far as possible not to give.

Height can be propped up by internal elements.

Width is not set, the general default is 100% wide.

6, at the same time to set a box background picture and background color method is, first set the background picture, and then set the background color, the code is as follows:
Copy Code code as follows:

. BG {background:url (/images/blbian.gif) No-repeat}
. style1 {width:100px;height:100px;background-color: #ebf1e5;}
<div class= "Style1 BG" ></div>


7, when float:left such things write too much, affect the surrounding, or the following elements, try to use Clear:both to clear.

Copy Code code as follows:

<BR class= "Clearfloat"/>
. clearfloat {
Clear:both;
height:0;
font-size:1px;
line-height:0px;
}


8, in the following settings when <div style= "height:3px" ></div&gt, will create compatibility issues. IE6 will go wrong and you will find that box is not 3px high.
The following settings are required: font-size:1px; It's not going to be a problem. Refer to the clearfloat in the DW cs3 template and add line-height:0px. But I find it is OK to do it without adding. But the Canadian Council is more formal.

9. When setting the height of a single line of text, set the line-height at the same time. Otherwise there will be compatibility issues, the text will have a small dislocation.

10, use the UL Li list time, must give the UL to set List-style-type:none; Otherwise, there will be compatibility issues. FF will appear in the original point, and IE often do not see.
Current 1/3 page 123 Next read the full text
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.