Non logical CSS behavior !

liunx

Guest
Hi,
Suppose the following,

<html>
<head>
<style>
.block1{
color:red;
}
</style>
</head>
<body>
<div class="block1">
This text in red color. Ok
<table>
<tr>
<td>
This text, I think, should be in red, but it does not !?
</td>
</tr>
</table>
</div>

I think is not logical
The TABLE tag inside the block1 style spectrum by logic it should apply its color, specially,
there is no any defination for the table's color.
What do you think about this?
Is there any solution?
Is this misunderstand of mine?Well, the default color for tables is black, so you have to change that in order to make it different, as opposed to most elements default bg and fg colors being "inherit". I suggest, if you have a lot of cases like that, using .block1, .block1 * when setting colors, so the styling is set to the container and all contained elements.<head>
<style type="text/css">
<!--
.table1{
color:#ff0000;
}
-->
</style>
</head>
<body>
<table class="table1">
<tr>
<td>
This text is in red.
</td>
</tr>
</table>


Browsers have issues with tables, what do you want? Just don't use tables for layout and you should be fine. Alternately, you can use your html and have the css:


<style type="text/css">
<!--
.block1 table {
color:#ff0000;
}
-->
</style>:D
Thank you!
It's the first time to deal with creating a CSS's class like that. It's really a breakthrough for my knowledge with CSS.
 
Back
Top