Web front-end questions about floating

Source: Internet
Author: User

Floating issues such as the following are listed below if you are not considered welcome Welcome to add:

1. Floating, compatibility issues 3px issues, bilateral distance issues

In the process of ordinary work, solve the problem of 3px, generally is the initialization of *{margin:0;padding:0px;} But perhaps the interviewer's consideration in the interview is not another, but to ask you do not understand the CSS hack problems

Compatible with IE7 under separate processing with unique "*+" is only compatible with IE7 here; for example {margin-left:20px;_margin-left:17px;}

Use unique "_" when the compatibility is handled separately under IE6, for example. a{margin-left:20px;_margin-left:17px;}

IE6, IE7 are compatible with "+" for example. a{margin-left:20px;+margin-left:17px;}

2, at the same time, when there is a margin in the same direction of the value of the time will create a bilateral distance problem

For example. a{margin-left:20px;float:left;} At this time in the IE browser will create a bilateral distance, the solution is to directly add a display:inline can be resolved. a{Margin-left:20px;float:left;display:inline} There's no problem at this point.

3, there is a three-column layout of the situation (both sides have a width of 100px of a column of Div, the middle of the width of 100%; As the width of the browser changes, automatic stretching)

There are many ways to write layouts I write a simple example

. div1{width:100px; height:100%; background: #000000;p osition:fixed; left:0px; top:0px; z-index:22}
. div2{width:100%; height:100%;margin:0px 100px 0px 100px; background:red;position:fixed; left:0px; top:0px; right:0px; Z-index:1}
. div3{width:100px; height:100%; background: #000000;p osition:fixed; right:0px; top:0px; z-index:22}

<div class= "Div1" ></div>
<div class= "Div2" ></div>
<div class= "Div3" ></div>

Web front-end questions about floating

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.