【发布时间】:2019-01-12 18:47:39
【问题描述】:
有没有办法为 DIV 保持设置的宽度/高度,并在 DIV 不增长的情况下填充内容?请参见下面的示例。我希望所有的框都是 140x140。
HTML:
<div class="box1">Howdy.</div>
<div class="box2">Howdy.</div>
<div class="box3">Howdy.</div>
CSS:
.box1 {
width: 140px;
height: 140px;
background: #f66;
}
.box2 {
width: 140px;
height: 140px;
background: #66f;
padding: 1em;
}
.box3 {
width: 140px;
height: 140px;
background: #6f6;
border: 1em solid #000;
}
【问题讨论】:
标签: css