Here is a little piece of code.
<style ...>
h1 { color: red }
h2 { color: olive }
em { color: red }
h1 em { color: blue }
</style ...>
<body>
<H1>This <h2>headline is <EM>very</EM> important</h2> to me.</H1>
<开发者_开发问答;/body>
I even tried this code at jsfiddle, but couldn't understand WHY that last two words to me appear in black color. I thought it would be red.
That's because you cannot nest h1-h6 tags. The <h2>
tag implicitly closes <h1>
so it is interpreted as:
<body>
<H1>This </H1><h2>headline is <EM>very</EM> important</h2> to me.
</body>
Note that styles have to go in the <head>
section.
But you could try putting it in a style sheet?
Also what is the ...
in the <style>
tags?
精彩评论