Can I use CSS3 with XHTML 1.0?

痞子三分冷 提交于 2019-12-23 17:01:12

问题


Can I use CSS3 properties with XHTML, or only with HTML5 web pages?

Is there any relation between HTML version and CSS, or is it totally indifferent?

Thanks.


回答1:


If the browser support CSS3 and XHTML 1.0, you can use both.

The two standards are not tightly linked to each other, that is what version of CSS you use has no relation to what version of (X)HTML you use.

This is one of the benefits of the separation of content (XHTML) from display (CSS).




回答2:


I think you can, I just check this fragment of code:

<div style="text-shadow: 2px 2px 2px #000;">Something</div>

The style is definitely a CSS3 only. And according the http://w3c.org/validator, this bit of code is valid. If you have any doubt, just use that to check




回答3:


You can just add the properties (or selectors) and the browsers that undersands it would render it no matter what DOCTYPE you use. The CSS might not validate though. Thank you progressive enhancement and graceful degradation!



来源:https://stackoverflow.com/questions/9318237/can-i-use-css3-with-xhtml-1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!