Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> JavaScript

Cách đặt hình dạng góc viền dưới bên phải trong JavaScript DOM?

Sử dụng borderBottomRightRadius để đặt bán kính bo góc viền dưới bên phải.

Ví dụ

<!DOCTYPE html>
<html>
  <head>
    <style>
      #box { border: 2px dashed blue; width: 120px; height: 120px; }
    </style>
  </head>
  <body>
    <button onclick="display()">Đặt góc dưới phải</button>
    <div id="box"><p>Demo Text</p><p>Demo Text</p></div>
    <script>
      function display() {
        document.getElementById("box").style.borderBottomRightRadius = "30px";
      }
    </script>
  </body>
</html>