首页 > 解决方案 > 将样式声明放在正文中是否合法?

问题描述

将样式声明放在 body 标签内是否合法?另一种说法是,如果我需要的话,有什么理由不把它放在身体标签内吗?

前:

<html>
<head>
  <style>
    #Ellipse_1{stroke:rgb(0,0,0);stroke-width:8px;}
  </style>
</head>
<body>
    <svg style="position:absolute;width:121px;height:121px;">
        <ellipse id="Ellipse_1" rx="60.5" ry="60.5" cx="147.5" cy="164.5">
    </svg>
</body>
</html>

后:

<html>
<head>
</head>
<body>
  <style>
    #Ellipse_1{stroke:rgb(0,0,0);stroke-width:8px;}
  </style>
  <svg style="position:absolute;width:121px;height:121px;">
    <ellipse id="Ellipse_1" rx="60.5" ry="60.5" cx="147.5" cy="164.5">
  </svg>
</body>
</html>

标签: csshtml

解决方案


推荐阅读