Sent by Chet on 9 August 2004 20:08
On Aug 9, 2004, at 12:33 PM, Big "Coffee Drinking" Bird wrote:
> I finally decided to take the plunge and redo a simple table based page
> that used java and I have a few questions.
OT, but were you really using Java, or do you mean Javascript?
> One is so simple I just cant seem to grasp the answer. been through a
> few
> books and many pages.
>
> Does inheritance happen in the css style sheet or in the html document.
> Does an item lower on the style sheet inherit from above.
Well, in a sense, both, depending on the way you mean this.
First, in a stylesheet, if I declare this:
p { color: blue;
padding: 5px;}
and then later, further down the sheet, I do this:
p { color: green;
border: 1px solid red;}
the definitions are combined, and the later version prevails in the
case of conflicts. In this example, the two declarations result in
this:
p { color: green;
padding: 5px;
border: 1px solid red; }
In an HTML document, you also experience a cascade. If I define these
two styles:
div { color: blue; }
p { background-color: red; }
and then have this markup:
<div>
<p> Hello! </p>
</div>
I end up with blue text on a red background because both styles are in
play. You can control this by carefully using specificity and
inheritance, and by using pseudoclasses and IDs to your advantage.
On the other hand, if I declare the div to have a border in the example
above, the p inside the div doesn't get a new border; look into Meyer's
book for more information, or the archives of this list.
> Second is about vertical centering. I just can't seem to get the text
> inside a box to be centered vertically. My work around was to pad the
> box
> and overlap to get the proper spacing.
Vertical centering is a bugaboo; check the list archives for exhaustive
discussions thereon by wiser folks than I.
----
"I think I need to go get lunch now, before I am trapped in here by the
guy with the hose." MAD 2003-10-08
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/