在HTML中引入CSS的3种方式

2020-03-16  本文已影响0人  自己刮开看丶

1.行内样式表(又叫 内联样式)

<!DOCTYPE html>
<head>
      <title></title>
</head>
<body>
      <p style="color: red; "> I love China!</p>
</body>
</html>

2.内部样式表

<!DOCTYPE html>
<head>
      <title></title>
      <style type="text/css">
          p{
            color:red;
         }
      </style>
</head>
<body>
      <p> I love China!</p>
</body>
</html>

3.外部样式表

<!DOCTYPE html>
<head>
      <title></title>
      <link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
      <p> I love China!</p>
</body>
</html>

上一篇 下一篇

猜你喜欢

热点阅读