如何用 JavaScript 設定下邊框的樣式?


要設定下邊框的樣式,使用 JavaScript borderBottomStyle 屬性。它允許您新增下邊框。

示例

您可以嘗試執行以下程式碼來設定下邊框的樣式 −

<!DOCTYPE html>
<html>
   <body>
      <div id="box">Demo Text</div>
      <br>
      <button onclick="display()">Click to set style of bottom border</button>
      <script>
         function display() {
            document.getElementById("box").style.borderBottomStyle = "dashed";
         }
      </script>
   </body>
</html>

更新於:2020 年 6 月 23 日

284 次瀏覽

開啟你的 職業生涯

完成課程,獲得認證

開始
廣告
© . All rights reserved.