gpt4 book ai didi

html - 同时在表格的标题上获取边框半径和渐变时遇到问题

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

更新:现在它可以在 Chrome 而不是 Firefox 中运行

我无法同时在表格的标题上获取边框半径和渐变。

//normal table
<table cellspacing="0">
<thead>
<tr class ="header">
<th>one</th><th>two</th><th>three</th><th>four</th>
</tr>
</thead>
<tr><td>onetd</td><td>twotd</td><td>threetd</td><td>fourtd</td></tr>
<tr><td>onetd</td><td>twotd</td><td>threetd</td><td>fourtd</td></tr>
<tr><td>onetd</td><td>twotd</td><td>threetd</td><td>fourtd</td></tr>
</table>

CSS 无效。梯度取自一些梯度生成器

    tr:nth-child(even){
background-color: yellow;
}
tr:nth-child(odd){
background-color: green;
}
table thead tr.header{
border-top-left-radius: 30px;
border:1px solid black;
background-image: linear-gradient(bottom, rgb(52,156,235) 19%, rgb(61,224,216) 60%);
background-image: -o-linear-gradient(bottom, rgb(52,156,235) 19%, rgb(61,224,216) 60%);
background-image: -moz-linear-gradient(bottom, rgb(52,156,235) 19%, rgb(61,224,216) 60%);
background-image: -webkit-linear-gradient(bottom, rgb(52,156,235) 19%, rgb(61,224,216) 60%);
background-image: -ms-linear-gradient(bottom, rgb(52,156,235) 19%, rgb(61,224,216) 60%);

background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.19, rgb(52,156,235)),
color-stop(0.6, rgb(61,224,216))
);
}


table thead tr.header > th:nth-child(1){
border-top-left-radius:10px;


}

我绝对希望它能在主流浏览器中运行

不工作 jsfiddle

最佳答案

CSS:

.border{
border: 2px solid #666666;
border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
}
table {
margin: 50px;
border-spacing: 0;
width: 450px;
}
.border th:first-child {
border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
}

.border th:last-child {
border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0;
}

.border td:first-child, .border th:first-child {
border-left: medium none;
}

.border th {
background-color: #666666;
background-image: -moz-linear-gradient(center top , #3DE0D8, #349CEB);
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#3DE0D8), to(#349CEB), color-stop(.4, #3DE0D8));
}

.border td, .border th {
border-left: 2px solid #666666;
border-top: 2px solid #666666;
padding: 10px;
text-align: center;
}

tr:nth-child(even){
background-color: yellow;
}
tr:nth-child(odd){
background-color: green;
}

html:

<table class="border">
<thead>
<tr>
<th><label>one</label></th>
<th><label>two</label></th>
<th><label>Three</label></th>
<th><label>Four</label></th>
</tr>
</thead>
<tbody>
<tr>
<td><label>one</label></td>
<td><label>two</label></td>
<td><label>Three</label></td>
<td><label>Four</label></td>
</tr>
<tr>
<td><label>one</label></td>
<td><label>two</label></td>
<td><label>Three</label></td>
<td><label>Four</label></td>
</tr>
<tr>
<td><label>one</label></td>
<td><label>two</label></td>
<td><label>Three</label></td>
<td><label>Four</label></td>
</tr>
</tbody>
</table>

关于html - 同时在表格的标题上获取边框半径和渐变时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19650348/

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