Monday 26 May 2014

Why wont the colors show in my code_

Posted by Саша 11:39, under | No comments


Why wont the colors show in my code ? Why wont the colors show in my code ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled</title>
<style type="text/css">
.color1 {color: red;}
.color2 { color: blue;}
</style>
</head>

<body>
<table border="3" width="50%" cellpadding ="30">

<tr>
<td class="color1">&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td class="color2">&nbsp</td>
</tr>
<tr>
<td>&nbsp</td>
<td class="color1">&nbsp</td>
<td class="color2">&nbsp</td>
<td>&nbsp</td>
</tr>
<tr>
<td>&nbsp</td>
<td class="color2">&nbsp</td>
<td class="color1">&nbsp</td>
<td >&nbsp</td>
</tr>
<tr>
<td class="color2">&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td class="color1">&nbsp</td>
</tr>
</table>

</body>
</html>


Other Answers:




Simple! There is no text in the cells you denote to be color1 or color2. Place words there instead of a white space.

Try something like this:

...
<tr>
<td class="color2">Foo</td>
<td>&nbsp</td>
<td>&nbsp</td>
<td class="color1">Bar</td>
</tr>
...

Good luck to you!



If you're trying to get the table cells to look like filled in rectangles of color, you need to set the "background-color" property in your CSS. The "color" property only affects the text in an element.






0 коммент.:

Post a Comment