css – 多行跨度行为元素

前端之家收集整理的这篇文章主要介绍了css – 多行跨度行为元素前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想显示一个复杂但固定大小的多行元素的列表,假设它们将在到达行结束时包装页面行,使它们在每行中显示为n,
n取决于页面宽度.就像是:
Mary had    Mary had    Mary had
a little    a little    a little
LAMB        LAMP        WHISKEY


Mary had
a little
TOO MUCH

我该怎么做?

解决方法

@H_301_10@ 内联块跨度应该这样做:
body {
  font-family: sans-serif;
}
#container span {
  display: inline-block;
  width: 5em;
  border: 1px solid black;
}
<div id='container'>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
  <span>Mary had a little lamb</span>
</div>
</body>

</html>
原文链接:https://www.f2er.com/css/216113.html

猜你在找的CSS相关文章