我有这段代码:
#wrap {
position: relative;
width: auto;
background: silver;
border: 1px solid grey;
}
#text {
position: absolute;
width: 25%;
right: 0;
top: 0;
bottom: 0;
background: black;
opacity: 0.5;
filter: alpha(opacity=50);
}

<div>
<div id="wrap">
<img class="fit-img" src="~/Content/img/Assets/image.jpg">
<div id="text"></div>
</div>
</div>
&#13;
我需要在左侧放置ID为text
的DIV,而不是包装内容的右侧。有什么提示吗?
答案 0 :(得分:0)
只需删除right: 0;
并将其替换为此处的left: 0;
:
#text {
position: absolute;
width: 25%;
left: 0;
top: 0;
bottom: 0;
background: black;
opacity: 0.5;
filter: alpha(opacity=50);
}