Cách thực hiện - Dải băng CSS
Tìm hiểu cách tạo dải băng bằng CSS.
Cách tạo dải băng
Bước 1) Thêm HTML:
Trong ví dụ này, dải băng thuộc về thành phần nút:
Ví dụ
<button class="btn">A button for something cool <span
class="ribbon">NEW</span></button>
Bước 2) Thêm CSS:
Ví dụ
.btn {
border: none;
border-radius: 5px;
padding: 12px 20px;
font-size: 16px;
cursor: pointer;
background-color: #282A35;
color: white;
position:
relative;
}
.ribbon {
width: 60px;
font-size: 14px;
padding:
4px;
position: absolute;
right: -25px;
top:
-12px;
text-align: center;
border-radius: 25px;
transform: rotate(20deg);
background-color: #ff9800;
color: white;
}
Hãy tự mình thử »