如何使用 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.