css中的包含块是什么意思,怎样求解。计算?

来源:百度知道 编辑:UC知道 时间:2024/05/09 21:08:50
如.包含块是在padding的内边缘还是在padding外边缘?

以前还真没有考虑这个问题,刚才测试了一下,是padding的内边缘。

在IE6 IE7 IE8beta2 FF2 FF3 中测试通过。

不是很理解你说的计算是什么意思。 就是包含元素的实际宽度减去PADDING就行了。你看例子。复制运行即可。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>My test page!</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
#myTest {padding:30px; width:400px; height:400px; background:#EEE; position:absolute;}
#testPng { position:absolute; width:100px; height:100px; background:#000;}
</style>
</head>
<body>
<div id="myTest">
<div id="testPng">
</div>
</div>
</body>
</html>