0
我試圖在CSS中做出「鉗位效果」。CSS選擇器作爲鉗位效果後的圖像
見圖片: https://s27.postimg.org/j6m72z5kj/h_transylvania.png
我不知道這種效果究竟是如何命名的,所以我叫他「鉗效應」。
有人可以告訴我爲什麼::之後不工作?(可以有「鉗位效應」 - 見圖像鏈接)。
我的代碼:
h2 {
margin-top: 40px;
}
.container {
background-color: #fff;
width: 250px;
height: auto;
padding: 20px;
}
img.mypicture {
width: 230px;
}
.recomandded {
position: absolute;
display: inline-block;
top: 125px;
left: 1px;
color: #fff;
background-color: #ff0047;
font-size: 13px;
font-weight: 700;
font-family: Lato,Arial,sans-serif;
padding: 3px 16px 3px 6px;
border-radius: 4px 0 0 4px;
box-shadow: 1px 2px 2px 0 rgba(0,0,0,0.4);
}
.recomandded::after {
content: "";
display: inline-block;
border: 6px solid #dd0843;
border-bottom-color: transparent;
border-right-color: transparent;
position: absolute;
top: 29px;
left: 0;
}
<div class="container">
<h2>Beautiful Flower</h2>
<img class="mypicture" src="https://upload.wikimedia.org/wikipedia/commons/f/fe/Frangipani_flowers.jpg" />
<div class="recomandded">RECOMMENDED</div>
</div>
謝謝沙哈爾的幫助!你的解決方案工作 – mariusfv