Prevent Div from being squeezed to the next level when the page is zoomed in Firefox

Source: Internet
Author: User

http://wu110cheng.blog.163.com/blog/static/13334965420121120102439190/

Prevent Div from being squeezed to the next level when the page is zoomed in Firefox

question: three div, one div contains two floating div with border border, and the style design guarantees two The sum of the total width of the div equals the width of the outer div . Zooming in and out of Firefox will cause the right div to be squeezed to the next line when the scale is less than 100%.

Case:

<style>

*{margin:0; padding:0;}

#box {width:300px; height:200px; margin:0 Auto;}

#a {width:148px; height:198px; background: #999; border: #F00 solid 1px; float:left;}

#b {width:148px; height:198px; background: #999; border: #F00 solid 1px; float:left;}

</style>

<div id= "box" >

<div id= "a" ></div>

<div id= "B" ></div>

</div>

The same problem occurs in Firefox and IE8 , andThe problem does not occur underIE7 .

cause : inFirefox and IE8 , the border of the container when the scale page display scale is less than 100% The scale processing of the property is not maintained equal proportions . So the final total width of the two Div is still greater than the outer width and automatically overflows to the next line.

Workaround :

A: Compromise, set the width of the outer div slightly larger, or leave more space between the inner two div (without using marging or paddding padding).
B: Add the middle layer between the inner and outer containers, see below

Resolve case B:

<style>

*{margin:0; padding:0;}

#box {width:300px; height:200px; margin:0 Auto;}

#a {width:150px; height:200px; float:left;}

#a1 {width:148px; height:198px; background: #999; border: #F00 solid 1px;}

#b {width:150px; height:200px; float:left;}

#b1 {width:148px; height:198px; background: #999; border: #F00 solid 1px;}

</style>

<div id= "box" >

<div id= "A" ><div id= "A1" ></div></div>

<div id= "B" ><div id= "B1" ></div></div>

</div>

Other similar scaling issues are the same.

By visual inspection, Web standards that involve page scaling are not currently available in the market, so most web pages that involve that content have this bug

Prevent Div from being squeezed to the next level when the page is zoomed in Firefox

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.