Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Tim Cooke
Sheriffs:
Rob Spoor
Liutauras Vilda
paul wheaton
Saloon Keepers:
Tim Holloway
Tim Moores
Mikalai Zaikin
Carey Brown
Piet Souris
Bartenders:
Stephan van Hulst
Forum:
HTML Pages with CSS and JavaScript
Inheritance within a Table
Alec Lee
Ranch Hand
Posts: 569
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In the following code, I expect the text inside my table to inherit the red color defined by the <div>. But in IE6, the text are still displayed in black and left aligned. Did I make anything mistake?
<html> <head><style> .red{ color:red; text-align:center } </style></head> <body> <div class=red>text outside table <table border=1 width=75%> <tr > <td>table cell text</td> </tr> </table> </div> </body></html>
chsanthosh kumar
Ranch Hand
Posts: 56
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<html>
<head>
<style type="text/css">
div ,table {
color:red;
text-align:center
}
</style></head>
<body>
<div>text outside table
<table border=1 width=75%>
<tr >
<td>table cell text</td>
</tr>
</table>
</div>
</body></html>
I think this will help you..
---------------------<br />SCJP(1.4)With 95%<br /> <br />Do it Right and Forget it!
Alec Lee
Ranch Hand
Posts: 569
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks,
But, why doesn't inheritance work for table here? For example
<html><head> <style type="text/css"> div { color:red; text-align:center } </style></head> <body> <div class=red>text outside table <table border=1 width=75%> <tr > <td>table cell text</td> </tr> </table> <ul> <li>some text</li> <li>some more text</li> </ul> </div> </body> </html>
The list and list elements inherited the red from the <div> automatically. We don't need to define it explicitly.
chsanthosh kumar
Ranch Hand
Posts: 56
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
it's because of the proper DocType
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
div {
color:red;
text-align:center
}
</style>
</head>
<body>
<div>text outside table
<table border="1" width="75%">
<tr >
<td>table cell text</td>
</tr>
</table>
<ul>
<li>some text</li>
<li>some more text</li>
</ul>
</div>
</body>
</html>
---------------------<br />SCJP(1.4)With 95%<br /> <br />Do it Right and Forget it!
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Printing with DIV tags
Dynamically moving the DIV
layout and multibrowser hell
HTML Table Column Widths
Table nested inside a div
More...