คุณสมบัติเส้นขอบใช้เพื่อกำหนดคุณสมบัติของเส้นขอบสำหรับองค์ประกอบ เป็นชวเลขสำหรับ border-width, border-style และ border-color
ไวยากรณ์
ไวยากรณ์ของคุณสมบัติเส้นขอบ CSS มีดังต่อไปนี้ -
Selector {
border: /*value*/
} ตัวอย่าง
ตัวอย่างต่อไปนี้แสดงให้เห็นถึงคุณสมบัติเส้นขอบ CSS -
<!DOCTYPE html>
<html>
<head>
<style>
img {
margin-top: 14px;
margin-left: 30px;
border: 2px solid orange;
box-shadow: 0 0 12px 1px black;
}
#demo {
border: 4px dotted magenta;
}
</style>
</head>
<body>
<img src="https://www.tutorialspoint.com/swing/images/swing-mini-logo.jpg">
<img id="demo" src="https://www.tutorialspoint.com/scala/images/scala-mini-logo.jpg">
</body>
</html> ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -

ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
table {
margin: 1em;
border: 3px dashed green;
}
td {
font-size: 24px;
border: 2px double navy;
}
</style>
</head>
<body>
<table>
<tr>
<td>This</td>
<td>text</td>
</tr>
<tr>
<td>is</td>
<td>demo</td>
</tr>
</table>
</body>
</html> ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -
