On 2011-12-18, Novice <novice@example> wrote:
>
> I have two concept questions.
>
> Question 1 (Inheritance):
> I have some CSS where I am setting the color of my H3 headings with a div
> called 'main' to one color, say black. In another div called 'index', which
> is NOT within 'main' but parallel to it, I set my H3 headings to a
> different color, say blue. I set the colors for 'main' first, then the
> values of 'index'. The colors I set for 'index', ALWAYS take effect for
> both 'main' AND 'index'.
>
> I don't understand this. I could see that the values for 'index' would
> clobber the values for 'main' if 'index' were somehow "above" (i.e. a
> superset of) 'main' but they are parallel to one another. Why does 'main'
> inherit its color from 'index' in this situation?
It shouldn't and I've never seen it do that in any browser.
> Just to make sure the situation is clear, here is the markup of the web
> page:
>
><div id="container">
> <div id="main">
> </div>
> <div id="index">
> </div>
></div>
>
> And this is the relevant bit of the CSS:
>
> #main h3 {color: #FF0000;}
> #index h3 {color: #0000FF;}
There are no h3s in your markup. But it were like this:
<div id="container">
<div id="main">
<h3>foo</h3>
</div>
<div id="index">
<h3>bar</h3>
</div>
</div>
Then foo would be red and bar blue as you expect.
> Question 2 (Omission):
> For some reason that escapes me, none of my H2 headings is appearing on my
> web page. They are properly coded in the HTML and both the HTML and CSS
> validate without any errors or warnings.
Then they should appear.
> Other heading levels, like H1 and H3 appear just fine. (I don't have
> any H4, H5, or H6). What's baffling me is that I have no CSS at all
> that says anything about H2 headings one way or the other. If a given
> tag isn't mentioned in CSS, shouldn't it be rendered in the default
> fashion rather than being omitted?
Yes it should and does.
> I'm not looking for someone to fix my CSS here. I'm really just trying
> to understand these basic concepts.
Your understanding of the basic concepts is correct. You may be jumping
to whatever remains, however improbable it may seem, without first
eliminating the possible.
Maybe you left out a </div> somewhere so your document is not what you
think, but I can only guess.
> With regards to question 1, shouldn't properties only be inherited from
> enclosing containers, not from parallel containers?
Yes, they are.
> With regards to
> question 2, shouldn't any tag that is not mentioned in the CSS simply be
> rendered in the default (visible) fashion, as opposed to omitted from the
> page altogether?
Yes, it is.