防止css列继承?

时间:2017-09-06 13:36:55

标签: html css inheritance html-lists

我有一个columns: 2的容器,但我想申请除<ul>以外的所有孩子

有什么办法吗?试图将columns: 1设置为<ul>,但无法实现..

.text {
  columns: 2;
  
  /* irelevant */
  width: 100%;
  background: #ddd;
  margin-bottom: 10px;
}

.text ul {
  columns: 1;
}
<div class="text">
  <p>Here is going to split the text in two columns</p>
  <p>Which i what I want</p>
</div>

<div class="text">
  <ul>
    <li>I dont want to happen</li>
    <li>For list items</li>
  </ul>
</div>

1 个答案:

答案 0 :(得分:0)

在css中添加此代码:

.text ul {
    width: 200%;
    display: inline-block;
}