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

Thuộc tính borderBottom trong HTML DOM Style

Thuộc tính borderBottom là shorthand cho viền dưới: gộp border-bottom-width, border-bottom-style, border-bottom-color.

Cú pháp

object.style.borderBottom = "width style color|initial|inherit"

Các tham số

Tham sốMô tả
WidthĐộ dày viền dưới.
StyleKiểu viền (solid, dashed, dotted...).
ColorMàu viền.
initialĐặt về mặc định.
inheritKế thừa từ cha.

Ví dụ

Thay đổi toàn bộ viền dưới ảnh:

<!DOCTYPE html> <html> <head> <style> 
  #IMG1 { 
    border-bottom: 7px solid orange; 
    box-shadow: 2px 2px 4px 1px seagreen; 
  } 
</style> 
<script> 
  function changeBorder(){ 
    document.getElementById("IMG1").style.borderBottom = "10px dotted pink"; 
    document.getElementById("Sample").innerHTML = "Viền dưới ảnh đã thay đổi"; 
  } 
</script> </head> 
<body> 
<h2>Học Kotlin</h2> 
<img id="IMG1" src="https://www.tutorialspoint.com/kotlin/images/kotlin.jpg"> 
<p>Nhấn nút để thay đổi viền dưới</p> 
<button onclick="changeBorder()">THAY ĐỔI VIỀN DƯỚI</button> 
<p id="Sample"></p> 
</body> </html>

Kết quả

Viền dưới ban đầu 7px solid orange:

Thuộc tính borderBottom trong HTML DOM Style

Sau khi nhấn nút: 10px dotted pink:

Thuộc tính borderBottom trong HTML DOM Style