[英]HTML table with rounded corners and gradient background
我有一個帶有CSS的表格,用於在第一行中為圓角和漸變背景設置表格樣式(用於列標題),但是盡管我指定了overflow: hidden
,漸變的結果還是在圓角之外overflow: hidden
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:
.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;
}
任何幫助,不勝感激!
將您所有的后台代碼從.TableHeaderFooter放入.DataTable。 邊緣將消失。
.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 {
}
您必須在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 */
}
現在您不應該看到任何溢出的背景,例如漸變(請注意,在這種情況下,溢出屬性是無用的)
希望對您有所幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.