html和css選擇器使用

tdongmu發表於2020-11-30

標籤名選擇器的格式:

    <style type="text/css">
       div{
           border: 1px red solid;
       }
   </style>

id選擇器的格式:

<head>
    <meta charset="UTF-8">
    <title>css-html</title>

    <style type="text/css">
   #s100{
       border: red 2px solid;
   }
   </style>
</head>
<body>
<div id="s100">標籤一</div>
</body>

class選擇器:

<head>
    <meta charset="UTF-8">
    <title>css-html</title>

    <style type="text/css">
  .class01{
      border: 2px solid red;
  }
   </style>
</head>
<body>
<div class="class01">標籤一</div>
</body>

 

 

相關文章