如何为李提供100%的宽度?

问题描述 投票:-1回答:1

我试图为'li'提供100%的宽度,但它不适合我。我也试过'px',但它会打扰上面的行。请在下面找到css和html代码并帮我解决这个问题。提前致谢。

.dndPlaceholder {
  width: 100%;
  height: 10px;
  background: gray;
}
<table>
  <tbody>
    <tr> 
        <td> Sample Text </td> 
        <td> Sample Text </td> 
    </tr>
    <li class="dndPlaceholder"></li>
  </tbody>
</table>
html css
1个回答
0
投票

li应该在ulol内。如下例所示:

.dndPlaceholder {
  width: 100%;
  height: 20px;
  background: gray;
}
<ul>
<li class="dndPlaceholder">Item 01</li>
<li class="dndPlaceholder">Item 02</li>
</ul>
© www.soinside.com 2019 - 2024. All rights reserved.