【发布时间】:2014-12-14 07:04:48
【问题描述】:
我正在向左侧表格单元格添加填充,但中心和右侧单元格也会获得顶部填充。如何从中心单元格和右侧单元格中删除填充?
中间和右侧的单元格仍然是顶部填充的。
<!doctype html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
.left, .center, .right {
display: table-cell;
width: 100px;
height: 50px;
}
.center, .right {
display: table-cell;
width: 100px;
padding: 0;
}
.left {
padding: 10px;
background: yellow;
}
.center {
background: pink;
}
.right {
background: orange;
}
</style>
</head>
<body>
<div class="left">a</div>
<div class="center">b</div>
<div class="right">c</div>
</body>
</html>
【问题讨论】:
-
您想从中心单元格和右侧单元格中删除哪个填充?
-
是的,中间和右边。看起来,它们出于某种原因继承了顶部填充。