Hu bojun explained the reasons for invalid comments in CSS and Hu bojun explained the failure of css.
In a webpage automatically generated by Dreamweaver, style sheets in the head are usually in the following format:
<Style type = "text/css">
<! --
......
-->
</Style>
An html annotation is automatically added at the beginning and end of the style sheet: <! -- And -->. If you think this is the same as the html comment mark, writing the comment will invalidate the style sheet definition.
When <! -- After adding the following words, all the following content will be ignored until </style> ends.
This is a low-level error that is easily overlooked. The reason is simple. The comments Syntax of CSS is:
/*......*/
Instead:
<! --
......
-->
The latter is the simplified html syntax. The two are not the same thing.
So, why is there such an html annotation tag in the automatically generated style?
This is to be compatible with earlier browsers. The old browser does not support styles. Therefore, the content of the style sheet is displayed on the page when you encounter styles. However, in earlier versions, browsers recognize the html annotation tag, so the tag is added.
This part of the content will be ignored as a comment, and the style sheet will not be displayed on the page.
Browsers that support style will ignore <! -- Mark to use the style sheet normally. This is probably one of the reasons why the notes in the style sheet should be marked.
Conclusion: If you use <! --> This annotation may cause errors in css styles. Replace it.
Welcome to read my full set of online Java teaching UHD video:
Http://v.youku.com/v_show/id_XODQ1NjU0NDc2.html this is one of the video connection, you can drag to the youku video below, subscribe to my account, because later I will have more videos available for free
Baidu search: Enter the Fcs_D code farmer, or enter "Hu bojun" to view many of my videos.
Or add my ID: fcsboy. I can send you a notification in time.
QQ group: 237053693