Saturday, March 24, 2012

Setting the border color of a table

When i change the background color of my masterpage to blue, and afterwards set the back color of my cells to white, the table borders remain blue. Can i set them to black somehow?

Try this out with CSS class, You can also set font size, font name etc.

<HTML>
<HEAD>
<title>Page</title>

<style type="text/css">
.MyTable {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #000000;
height: 16px;
border: 1px solid Black;
}
</style>
</HEAD>
<body>
<form id="Form1" method="post" runat="server" ">
<TABLE id="Table1" class=" cell="MyTable" Spacing="0" cellPadding="0" width="780" border="0">
<TR>
<TD>
Some Table data
</TD>
</TR>
</TABLE>
</form>
</body>
</HTML



Is there any place where you're setting the table borders' color?

try this one, i tested it.

<HTML>
<HEAD>
<title>Page</title>


<style type="text/css">
.MyTable {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #000000;
height: 16px;
border: 1px solid Black;
}
</style>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" class="MyTable" Spacing="0" cellPadding="0" width="780" border="0">
<TR>
<TD>
cell 1
</TD>
<TD>
cell 2
</TD>
</TR><TR>
<TD>
R2 cell 1
</TD>
<TD>
R2 cell 2
</TD>
</TR>
</TABLE>
</form>
</body>
</HTML>


Hi,

In ASP.NET, table has bordercolor property which you can set as any color, like this: BorderColor="Red".

In HTML, you can set color as style="border-color:Blue".

Thanks.

0 comments:

Post a Comment