如何修复div的大小但保持响应

时间:2017-01-12 12:52:02

标签: html css list responsive-design responsive

我试图制作一个包含信息的容器(盒子),我想修改它的大小,但我想让它响应。看一下这张图片就可以更好地理解我想要做的事情:

允许这样做: enter image description here 现在一样,它还可以: enter image description here 错了它应该阻止大小 enter image description here

我尝试了以下代码:



.liContainer {
  list-style-type: none;
  border-style: solid;
  margin-bottom: 5px;
}

<li class="liContainer">
  <div>
    <h3>Container 1</h3>
  </div>
  <div id="id">
    <span>90b5bb870feb5a1148e4f9042f87c957043b71d60dc91d743bccdc5a10c0f54f </span>
  </div>
  <div>
    State:<span class="state">Running</span>
  </div>
</li>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:4)

添加word-break:break-all - 这允许该行在任意两个字母之间断开

见下面的演示:

.liContainer {
  list-style-type: none;
  border-style: solid;
  margin-bottom: 5px;
  word-break: break-all;
}
<li class="liContainer">
  <div>
    <h3>Container 1</h3>
  </div>
  <div id="id">
    <span>90b5bb870feb5a1148e4f9042f87c957043b71d60dc91d743bccdc5a10c0f54f </span>
  </div>
  <div>
    State:<span class="state">Running</span>
  </div>
</li>