選擇所有

剛好在

元素之後放置的元素


使用 元素 + 元素選擇器選擇放在第一個指定元素之後的元素。你可以嘗試執行以下程式碼來執行該操作:

示例

活動演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div + p {
            color: white;
            background-color: blue;
         }
      </style>
   </head>
   <body>
      <h1>Demo Website</h1>
      <h2>Fruits</h2>
      <div>
         <p>This is demo text.</p>
      </div>
      <p>Fruits are good for health.</p>
      <p>Fruits makes you healthy.</p>
   </body>
</html>

更新於:2020 年 6 月 24 日

295 次瀏覽

開始你的職業生涯

完成課程獲得認證

開始
廣告
© . All rights reserved.