• 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

Inheritance within a Table

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<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..
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

But, why doesn't inheritance work for table here? For example


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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
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
    Bookmark Topic Watch Topic
  • New Topic