0
上漿我有一個文本覆蓋一個Flexbox的頂部,一切看起來正常時,瀏覽器是全寬:文本覆蓋不Flexbox的
我的HTML看起來像這樣:
<a ng-if="::(options.link_template == 'Picture')" ng-href="{{::data.href}}" class="picture {{::options.class_name}}" target="{{::data.target}}">
<img src="{{::options.picture}}" alt="" width="100%" height="100%"/>
<h3><span>{{::options.title}}</span></h3>
</a>
我的CSS是這樣的:
a.picture {
position: relative;
//width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
a.picture img {
width: 360px;
height: 238px;
}
a.picture > h3 {
margin: 0;
position: absolute;
width: 100%;
text-align: center;
}
a.picture > h3 span {
display: block;
color: white;
font-weight: bold;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(51, 103, 150, 0.6);
padding: 10px;
}
什麼我從我的CSS缺失,使得與圖像疊加「鎖」?謝謝!
奏效!快速跟進問題,有沒有辦法使用flexboxes,使圖像是相同的寬度和高度,沒有指定實際的高度和寬度尺寸? – Dave
你的意思是相同的寬度和高度?一個正方形?另外,「沒有指定實際的高度和寬度尺寸」是什麼?圖片?還是父母? –
所以不是我指定的寬度是360px,高度是238px例如,有沒有辦法只使用flexbox,以便所有圖像都是相同的尺寸。我希望圖像能夠填充父項的整個空間,但我希望父母的尺寸相同,這是否合理? – Dave