gpt4 book ai didi

html - 如何为表格中的字段设置边框?

转载 作者:太空宇宙 更新时间:2023-11-03 22:37:43 26 4
gpt4 key购买 nike

我有一些字段的表。我尝试只设置一次边框样式:

md-grid-tile:not(.header), md-grid-tile:not(.md-grid-header) {
border-right: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
}

但是我得到了两次边界。我知道有一个简单的解决方案,但我忘记了

enter image description here

HTML:

 <md-grid-list cols="3" rowHeight="10" id="alarm_schedule" class="md-grid-list-custom">

<!-- Header -->
<md-grid-tile rowspan="5" colspan="1" class="md-grid-header"><span>Урок</span></md-grid-tile>
<md-grid-tile rowspan="5" colspan="1" class="md-grid-header"><span>Время (от)</span></md-grid-tile>
<md-grid-tile rowspan="5" colspan="1" class="md-grid-header"><span>Время (до)</span></md-grid-tile>
</md-grid-list>

最佳答案

我建议使用 :first-of-type伪选择器。仅将 border-left 应用于第一个元素会导致每个元素的 border-right 用作左边框。

您可以使用 -2pxmargin 来确保单元格之间没有间隙:

md-grid-tile:not(.header),
md-grid-tile:not(.md-grid-header) {
border-right: 5px solid #e0e0e0;
border-bottom: 5px solid #e0e0e0;
padding: 5px;
margin: -2px;
}

md-grid-tile:first-of-type {
border-left: 5px solid #e0e0e0;
}
<md-grid-list cols="3" rowHeight="10" id="alarm_schedule" class="md-grid-list-custom">
<!-- Header -->
<md-grid-tile rowspan="5" colspan="1" class="md-grid-header"><span>Урок</span></md-grid-tile>
<md-grid-tile rowspan="5" colspan="1" class="md-grid-header"><span>Время (от)</span></md-grid-tile>
<md-grid-tile rowspan="5" colspan="1" class="md-grid-header"><span>Время (до)</span></md-grid-tile>
</md-grid-list>

希望对您有所帮助! :)

关于html - 如何为表格中的字段设置边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45556082/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com