具有两个< style>是有效的HTML吗? HTML< head>中的元素标签? [英] Is it valid HTML to have two <style> elements inside your HTML <head> tag?

查看:261
本文介绍了具有两个< style>是有效的HTML吗? HTML< head>中的元素标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML头标签中包含两个<style>标签是否有效?

Is it valid to have two <style> tags inside of an HTML head tag?

例如,我尝试为未添加外部样式表的电子邮件客户端编写HTML页面.由于我们的模板系统可以正常工作,因此

For example I am trying to write an HTML page for email clients with no external stylesheets added. Due to the way our template system works it is much easier for us to have

<head>
 <style>
  .someStyle{}
 </style>
 <style>
  .someOtherStyle{}
 </style>
</head>

代替这个...

<head>
 <style>
  .someStyle{}
  .someOtherStyle{}
 </style>
</head>

如果选项2是唯一的方法,那么我会这样做,但是由于各种原因,选项1对于我们的框架代码来说效果更好.

If option 2 is the only way of doing this I will do that but option 1 for various reasons works better for our framework code.

推荐答案

<head></head>标记之间包含多个样式元素非常好. 您可以将任意数量的元素与<link><script>元素一起使用.

It's perfectly fine to have multiple style elements in between your <head> and </head> tags. You can have as many as you want, together with <link> or <script> elements.

这篇关于具有两个&lt; style&gt;是有效的HTML吗? HTML&lt; head&gt;中的元素标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆