[英]HTML table with rounded corners and gradient background
I have a table with some CSS to style the table with rounded corners and a gradient background in the first row (for column headings) but come of the gradient is overflowing outside the rounded corner despite me specifying overflow: hidden
; 我有一个带有CSS的表格,用于在第一行中为圆角和渐变背景设置表格样式(用于列标题),但是尽管我指定了overflow: hidden
,渐变的结果还是在圆角之外overflow: hidden
HTML: HTML:
<table id="tblIncidentQueue" class="DataTable">
<tr class="TableHeaderFooter">
<td colspan="5">
<strong>Show </strong>
<asp:DropDownList ID="drpNumOfResults" runat="server">
<asp:ListItem Text = "10" Value="10" ></asp:ListItem>
<asp:ListItem Text = "20" Value="20" ></asp:ListItem>
<asp:ListItem Text = "50" Value="50" ></asp:ListItem>
<asp:ListItem Text = "100" Value="100" ></asp:ListItem>
<asp:ListItem Text = "All" Value="All" ></asp:ListItem>
</asp:DropDownList>
<strong> entries</strong>
</td>
<td align="right">
<img src="../images/Icons/Refresh.png" border="0" />
<img src="../images/Icons/Down.png" border="0" />
</td>
</tr>
</table>
CSS: CSS:
.DataTable
{
margin: 10px;
-moz-border-radius : 10px; /* Firefox */
-webkit-border-radius : 10px; /* Safari & Chrome */
-khtml-border-radius : 10px; /* Linux browsers */
border-radius : 10px; /* CSS3 compatible browsers */
border-style: solid;
border-width: 1px;
border-color: #cccccc;
padding: 0px;
border-spacing: 0px;
overflow: hidden;
}
.TableHeaderFooter
{
background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
overflow: hidden;
}
Any help greatly appreciated! 任何帮助,不胜感激!
Put all your background code from .TableHeaderFooter into .DataTable. 将您所有的后台代码从.TableHeaderFooter放入.DataTable。 The edges will disappear. 边缘将消失。
.DataTable {
margin: 10px;
-moz-border-radius : 10px; /* Firefox */
-webkit-border-radius : 10px; /* Safari & Chrome */
-khtml-border-radius : 10px; /* Linux browsers */
border-radius : 10px; /* CSS3 compatible browsers */
border-style: solid;
border-width: 1px;
border-color: #cccccc;
padding: 0px;
border-spacing: 0px;
overflow: hidden;
background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}
.TableHeaderFooter {
}
You have to set property border-radius
for those td elements in TableHeaderFooter. 您必须在TableHeaderFooter中为那些td元素设置属性border-radius
。
.TableHeaderFooter td:first-child {
border-radius : 10px 0px 0px 10px; /* rounds the top and bottom left corner */
}
.TableHeaderFooter td:last-child {
border-radius : 0px 10px 10px 0px; /* rounds the top and bottom right corner */
}
Now you shouldn't see any overflowing backgrounds eg gradients (note that overflow property is useless in this case) 现在您不应该看到任何溢出的背景,例如渐变(请注意,在这种情况下,溢出属性是无用的)
I hope it helps 希望对您有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.