使用 CSS 選擇器選擇 id 為“tutorials”的元素


若要選擇所有 id 為“tutorials”的元素,你可以嘗試執行以下程式碼。

使用 #id CSS 選擇器來實現此目的,

示例

即時演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         #tutorials {
            border: 3px solid red;
         }
      </style>
   </head>
   <body>
      <h1>Tutorialspoint</h1>
      <h2>Learning</h2>
      <p id = "tutorials">Tutorials on web dev, programming, database, networking, etc.</p>
      <p>Every tutorials has lessons with illustrations and figures.</p>
   </body>
</html>

更新於:2020 年 6 月 24 日

92 次瀏覽

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.