将样式表放置在< body>标签 [英] Is it appropriate to place a stylesheet within the <body> tag
问题描述
将我的页面分割为多个部分(例如标题和内容),我不能避免在< body>
标签中放置指向外部样式表的链接。
Splitting my pages into parts (eg. header and content), I can't avoid placing links to external stylesheets within <body>
tags.
我不想将所有样式放在一个大文件中,或将所有样式表放在< head>
I don't want to place all styles in one big file or enclose all stylesheets within the <head>
tag because page-specific stylesheets shouldn't be loaded unnecessarily.
在这种情况下,将样式表放置在< body>
tag?有没有更好的选择?
In this case, is it appropriate to place a stylesheet within the <body>
tag? Is there a better alternative?
推荐答案
你不应该在body标签中放置样式, (PHP?)来链接标题和内容,为什么不写自己的类来生成您的页面?你可以有一个方法来添加样式到头,并输出页面例如。
you shouldn't place styles within the body tag, but assuming you're using a server side script (PHP?) to link both header and content, why not write your own class to generate your pages; you could have a method that add styles to the header, and one that outputs the page for instance.
这篇关于将样式表放置在< body>标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!