I have a GridView
in ASP.NET 2.0 that I want to have show only internal gridlines. Here is my markup and CSS so far:
<asp:GridView ID="myGrid" runat="server" GridLines="None" CssClass="myDataGridClass">
<Columns>
...columns here...
</Columns>
</asp:GridView>
CSS:
.myDataGridClass>tbody>tr>td /* Apply border to all cells */
{
border:1px solid black;
}
.myDataGridClass>tbody>tr>th /* Apply border to headers */
{
border:1px solid black;
}
.myDataGridClass>tbody>tr>td:last-child /* Remove right-side border */
{
border-right-width:0;
}
.myDataGridClass>tbody>tr>td:first-child /* Remove left-side border */
{
border-left-width:0;
}
.myDataGridClass>tbody>tr>th:last-child /* Remove right-side header border */
{
border-right-width:0;
}
.myDataGridClass>tbody>tr>th:first-child /* Remove left-side header border */
{
border-left-width:0;
}
.myDataGridClass>tbody>tr:last-child>td /* Remove bottom border */
{
border-bottom-width:0;
}
.myDataGridClass>tbody>tr>th /* Remove top border */
{
border-top-width:0;
}
Am I right in thinking that there must be an easier way to do this? My method above already does not work in IE, since I'm using last-child
.