VStudio ASP.NET gives the following message:
Attribute 'bgcolor' is considered outdated. A newer construct is recommended.
What is the recommended construct?
bgcolor
is within a <td>
element.
Another related message is :
Attribute 'bordercolor' is not a valid attribute of element 'table'.
Does anyone know where I might find the newer replacements?
The newer replacement is cascading style sheets (CSS).
The HTML5 does not support the bgcolor attribute.
The bgcolor attribute deprecated in HTML5. Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
Note: The bgcolor attribute is not supported in HTML5.
BGColor
was deprecated in the W3C HTML 4.0 Specification.
Newer Web sites and web applications use CSS (Cascading Style Sheets) to render the same thing, as follows:
body {
background-color : #ffffff;
}
For tables, do the following:
<table>
<tr id="row1">
<th>Header 1</th> <td>Cell 1</td> <td>Cell 2</td>
</tr>
<tr id="row2">
<th>Header 2</th> <td>Cell 3</td> <td>Cell 4</td>
</tr>
<tr id="row3">
<th>Header 3</th> <td>Cell 5</td> <td>Cell 6</td>
</tr>
</table>
And in your CSS:
th { text-align: center; font-weight: bold; vertical-align: baseline }
td { vertical-align: middle }
table { border-collapse: collapse; background-color: #ffffff }
tr#row1 { border-top: 3px solid blue }
tr#row2 { border-top: 1px solid black }
tr#row3 { border-top: 1px solid black }
That will make it so the table will have a background color, and do different stuff with the rest of the table data/table rows.
Simply put that in your style sheet and reference it on your web page like so:
<link rel="stylesheet" href="style.css" TYPE="text/css" media="screen">
You can put just about whatever you like in your CSS, more information on CSS here, and here.
Best guess would be CSS's background-color
and border-color
:
<table style="border-color: #ffffff;">
<td style="background-color: #000000;">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With