我有一張圖片,需要在右下角添加標籤。帶圖像絕對位置的文字
當我在那裏拍攝時,它在圖像下方4px,沒有填充或邊距。
.postImage {
position: relative;
display: inline-block;
}
.post img.thumbnail {
width:100%;
height: 100%;
}
.commercial {
position: absolute;
bottom: 0;
right: 0;
background-color: #666;
color: #fff;
padding: 3px;
font-size: 14px;
font-weight: 100;
}
<div class="postImage">
<img class="thumbnail" src="https://dummyimage.com/600x400/f00/fff">
<span class="commercial">commercial</span>
</div>
什麼是解決它的最好方法?我不認爲
bottom: 4px;
是正確的。
謝謝
,因爲它們使用的正是這種目的,你也可以使用''