Thuộc tính inset-block-end trong CSS dùng để xác định offset logic block end. Nó không dùng cho inline offset hoặc logical block. Thuộc tính này áp dụng cho mọi thuộc tính writing-mode.
Cú pháp:
inset-block-end: length | percentage | auto | inherit | initial | unset;
Giá trị thuộc tính:
- length: Đặt một giá trị cố định theo px, cm, pt... Giá trị âm vẫn được chấp nhận. Giá trị mặc định là 0px.
- percentage: Tương tự length, nhưng giá trị được tính theo phần trăm kích thước cửa sổ.
- auto: Sử dụng khi muốn trình duyệt tự xác định inset-block-end.
- initial: Dùng để đặt giá trị của thuộc tính inset-block-end về mặc định.
- inherit: Dùng khi muốn phần tử kế thừa thuộc tính inset-block-end từ phần tử cha.
- unset: Dùng để bỏ cài đặt thuộc tính inset-block-end mặc định.
Các ví dụ dưới đây minh họa thuộc tính inset-block-end trong CSS.
Ví dụ 1:
HTML<!DOCTYPE html>
<html>
<head>
<title>CSS | inset-block-end Property</title>
<style>
h1 {
color: green;
}
div {
background-color: green;
width: 200px;
height: 20px;
}
.one {
position: relative;
inset-block-end: 30px;
background-color: cyan;
}
</style>
</head>
<body>
<center>
<h1>Geeksforgeeks</h1>
<b>CSS | inset-block-end Property</b>
<br><br>
<div>
<p class="one">
A Computer Science Portal for Geeks
</p>
</div>
</center>
</body>
</html>
Đầu ra:
Ví dụ 2:
HTML<!DOCTYPE html>
<html>
<head>
<title>CSS | inset-block-end Property</title>
<style>
h1 {
color: green;
}
div {
background-color: green;
width: 200px;
height: 120px;
}
.one {
writing-mode: vertical-rl;
position: relative;
inset-block-end: 50px;
background-color: cyan;
}
</style>
</head>
<body>
<center>
<h1>Geeksforgeeks</h1>
<b>CSS | inset-block-end Property</b>
<br><br>
<div>
<p class="one">
A Computer Science Portal for Geeks
</p>
</div>
</center>
</body>
</html>
Đầu ra:
Trình duyệt được hỗ trợ: Các trình duyệt hỗ trợ thuộc tính inset-block-end được liệt kê dưới đây:
- Firefox 63+
- Google Chrome 87+
- Edge 87+
- Opera 73+
- Safari 14.1+
Tham khảo: https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block-end