HTML:
CSS:PHP Code:<p id="sab">
Hello!
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
</p>
Why does'nt the CSS affect on the table?PHP Code:p#sab{background: #ff0;}
#sab table{background: #000; width:450px;}
Thanks!
HTML:
CSS:PHP Code:<p id="sab">
Hello!
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
</p>
Why does'nt the CSS affect on the table?PHP Code:p#sab{background: #ff0;}
#sab table{background: #000; width:450px;}
Thanks!
because tables are stupid - they don't follow the rules the same way everyone else does. Try giving it its own idCode:#sabtable{ background: #000; width: 450px; }
d-machine (03-20-2010)
<style>
p#sab{background: #ff0;}
#sab table{background: #000; width:450px;}
#gg{background: red;}
#hh{background:silver;}
#gg1{background:green;}
#hh1{background:blue;}
#gg2{background:yellow;}
#hh2{backgroundink;}
</style><p id="sab">
Hello!
<table>
<tr>
<td id=gg>1</td>
<td id=hh>2</td>
</tr><tr>
<td id=gg1>1</td>
<td id=hh1>2</td>
</tr><tr>
<td id=gg2>1</td>
<td id=hh2>2</td>
</tr>
</table>
</p>
d-machine (03-20-2010)
First off, you shouldn't put a table inside of a paragraph tag. Secondly, style the table specifically. You can't style the <p> tag and expect everything in it to be that way. Switch to a <div> tag and style the items inside of it like this:
#sab p {
background-color: #ff0;
}
#sab th {
blah bblah;
}
#sab tr {
blah blah;
}
Then wrap it all up:
<div id="sab">
<p>Here's some text about the table below</p>
<table>
<tr><td></td>
</tr>
</table>
</div>
d-machine (03-20-2010)
Bookmarks