不同浏览器中的边距,填充和宽度之间的关系是什么? [英] What's the relationship between margin, padding and width in different browsers?

查看:110
本文介绍了不同浏览器中的边距,填充和宽度之间的关系是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CSS宽度值=显示内部宽度?





CSS宽度值= http://www.w3.org/TR/CSS2/box.htmlrel =nofollow noreferrer> CSS盒模型。



但是请注意,不同的浏览器实现这一点有所不同:最引人注目的是, Internet Explorer有一个盒子模型错误(这是臭名昭着的存在于IE6 - 我不知道这是否已经在IE7或IE8),导致臭名昭着的怪异模式CSS黑客。



简单来说,Internet Explorer会将其框模型设置为在计算宽度时包括填充,而不是官方标准,其中width只应构成内容。


CSS width value = display width of inside?

or

CSS width value = display width of inside + CSS margin-left + CSS margin-right?

解决方案

You have to make yourself familiar with the CSS Box Model. It explains where padding, margin and border as well as width work.

However do note that different browsers implement this differently: most notably, Internet Explorer has a box model bug (this is infamously present in IE6 -- I am not aware if this has been fixed in IE7 or IE8) that caused the infamous "quirks mode" CSS hack.

Briefly stated, Internet Explorer set their box model to include padding in computing the width, as opposed the official standard wherein width should only constitute the content.

这篇关于不同浏览器中的边距,填充和宽度之间的关系是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆