How TO - CSS 絲帶
瞭解如何使用 CSS 建立絲帶效果。
如何建立絲帶
步驟 1) 新增 HTML
在此示例中,絲帶屬於一個按鈕元素
示例
<button class="btn">一個很酷的東西的按鈕 <span class="ribbon">新</span></button>
步驟 2) 新增 CSS
示例
.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;
}
自己動手試一試 »