ie6下div的width会被padding撑开的解决思路
2014-05-21 10:15
375 查看
通过http://stackoverflow.com/questions/1210417/best-way-to-solve-the-padding-css-problem 这篇文章我们知道
可以通过改变docType来让 ie用不同的模型
HTML4 Strict:
XHTML 1.0 Strict:
XHTML 1.0 Transitional:
Your doctype must be the first thing to appear on your page. It is even before the
on its own line.
猜测的方法
设置该元素的box-sizing:border-box [不可行,因为ie6不支持这个属性]
反过来用非ie6的浏览器来向下兼容ie6
设置display:inline [采用嵌套div,将内部div设置为inline或许可行]
不设置width,让padding自由撑开以达到预期的width
可以通过改变docType来让 ie用不同的模型
HTML4 Strict:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >
XHTML 1.0 Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Your doctype must be the first thing to appear on your page. It is even before the
<html>tag,
on its own line.
猜测的方法
设置该元素的box-sizing:border-box [不可行,因为ie6不支持这个属性]
反过来用非ie6的浏览器来向下兼容ie6
设置display:inline [采用嵌套div,将内部div设置为inline或许可行]
不设置width,让padding自由撑开以达到预期的width
相关文章推荐
- CSS技巧(一)解决加padding后div被撑开
- div宽度设置width:100%后再设置padding或margin超出父元素的解决办法
- IE6下Ms Ajax Lib 调用Ajaxtoolkit时Common_InvalidPaddingUnit未定义的解决方法
- div+css使用padding样式和!important标记实现Firefox和IE6处理带float样式的margin尺寸上的兼容
- CSS_解决IE6中min-width问题
- 解决IE6不支持CSS中的min-width/height属性问题
- IE6 注释引起的文字溢出和浮动错位的解决思路
- 在ie6中DIV最小高度的解决方法
- bgiframe 解决IE6 DIV 档不住下拉选择框
- IE6和以下版本解决下拉框挡住Div问题
- bgiframe 解决IE6 DIV 档不住选择框
- div层被flash层遮盖问题解决思路
- div+css - Firefox和IE浏览器兼容问题 - padding-right在IE6下导致抖动
- 用iframe解决ie6下div无法挡住select的实例
- 网页表格或div层在网页中被撑开解决之道
- IE6 Select元素无法被div等元素覆盖的bug解决办法【zz】
- div+css使用!important标记实现Firefox和IE6处理padding尺寸上的兼容
- ie6下select覆盖div的解决办法
- padding+div 在ie7、ie6以及firefox中的兼容问题
- 简单解决IE6中浮动 div 被 select 遮盖问题