At the beginning of self-learning CSS encountered problems, "linked to the external style sheet" exercise, the code is as follows:
A, the CSS file code that is linked into. css
<style type= "Text/css" >
<!--
H1{background:gray;text-align:center;font-family: Official Script}
H3{background:blue;text-align:center;font-family: Official Script}
P{background:green;text-align:center;font-family: Official Script}
-
</style>
--------------------------------------------------------------------------------
B, HTML exercise page code. html
<meta charset= "UTF-8" >
<title> linking to external style sheets </title>
<link rel= "stylesheet" type= "Text/css" href= "was linked to an external CSS file. css" >
<body>
<p> call an external CSS in an HTML file to apply a link to an external style sheet method. </p>
</body>
-------------------------------------------------------------------------------
There's a lot of problems, I'm one by one.
1, the above A, B code unchanged, directly open with IE, all show normal, I want to have the effect. But with
Chrome and Firefox open, the first element tag (that is, H1 which row) does not have a CSS effect, the next two lines (
That is, H3, p) effect is normal. Why??
2, if the B code
The first line H1 loses the CSS effect, the following two lines are normal). Why?? Why??
3, I use the exercise answer all requirements in <style> </style> in the middle to add <!--xxxx-->, explained that the browser does not recognize CSS, but I see a lot of Web source and not this strange <!--xxxx-- Other CSS books do not have this requirement. So I tried to get rid of it, the result is magical, and appeared with 1, 2 exactly the same problem!!!! Why?? Why?? Why
I completely collapsed ~ ~ ~ to ask the expert guidance, thank you ~ ~ ~
Have problems starting with self-learning CSS, "link to external style sheet" in multi-browser display problem