Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've been reading some fairly old books to learn CSS. I've noticed that most of them recommend that style declarations to be written like this to remain backwards compatible with "older browsers" that don't support CSS:

<style type="text/css"><!--

(style declarations)

--></style>

So my question is, is this still a generally suggested practice (and is it still really used), considering that practically no one these days uses old browsers that can't handle style declarations?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
375 views
Welcome To Ask or Share your Answers For Others

1 Answer

So my question is, is this still a generally suggested practice

Only in cargo cult tutorials.

(and is it still really used)

Yes, but not to any useful effect. They are something that were useful in their day, and now (a decade and a half later) just won't die.

In HTML they are useless. In XHTML they are actively harmful (since script elements don't contain implicit CDATA in XHTML so if the document is parsed as XHTML then they will act as an actual comment and hide the script from the browser).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...