如何在 JavaScript DOM 中設定底部邊框顏色?


要在 JavaScript 中設定底部邊框的顏色,請使用 borderBottomColor 屬性。它允許你設定邊框底部的邊框顏色。

示例

你可以嘗試執行以下程式碼瞭解如何在 JavaScript DOM 中設定底部邊框顏色 −

即時演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         #box {
            border: 2px dashed blue;
            width: 120px;
            height: 120px;
         }
      </style>
   </head>
   <body>
      <button onclick="display()">Set border bottom color</button>
      <div id="box">
         <p>Demo Text</p>
         <p>Demo Text</p>
      </div>
      <script>
         function display() {
            document.getElementById("box").style.borderBottomColor = "yellow";
         }
      </script>
   </body>
</html>

更新於: 23-6月 -2020

760 瀏覽量

開啟你的 職業生涯

透過完成課程獲得認證

開始學習
廣告
© . All rights reserved.