RoR:有时当我的 CSS 链接不在 HEAD 中时,如何验证我的页面?
使用 w3 验证器时出现此错误: document type does not allowed element "link" here
我的意思是,我知道样式链接应该位于头部,但对于 RoR 项目来说,它更重要.. 高效的?仅加载您需要的内容?因为,可以说,样式表被加载到部分中。并且该部分在多个页面上使用。就干燥事物而言,将样式表包含在部分中是有意义的。
但干燥事物似乎违背了 W3C。
我该怎么办?
I get this error when using the w3 validator: document type does not allow element "link" here
I mean, I know style links are suppossed to be in the head, but for an RoR project, it's more.. efficient? to only load what you need? cause, lets say, A stylesheet is loaded in a partial. and that partial is used on multiple pages. It makes sense, as far as DRYing things up goes, to include the stylesheet with the partial.
But it seems like DRYing things goes against W3C.
What do I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不应该像这样将
元素放入您的内容中。您可以使用 ERB 的块将内容生成到布局模板的另一部分中,如下所示:
在应用程序布局中,您可以在其所属位置生成此内容:
You shouldn't be putting
<link>
elements into your content like that. You can use ERB's blocks to yield the content into another part of your layout template, like this:In your application layout, you can yield this content where it belongs: