html - why img is not taking full width of parent?
问题描述
.landing{
position: inherit;
width: 100%;
height: 80vh;
z-index: 0;
}
.landing .wrapper + img{
width: 100%;
}
<div class="landing">
<div class="wrapper">
<img src="http://lorempixel.com/350/100/" alt="Our Building">
<img src="http://lorempixel.com/350/100/" alt="LOGO">
</div>
</div>
All i want is that image should take full with of its parent , please help me out . Thanks in advance
解决方案
You can use first-child
element:
.landing{
position: inherit;
width: 100%;
height: 80vh;
z-index: 0;
}
.landing .wrapper img:first-child {
width: 100%;
}
<div class="landing">
<div class="wrapper">
<img src="https://via.placeholder.com/350x100" alt="Our Building">
<img src="https://via.placeholder.com/350x100" alt="LOGO">
</div>
</div>
推荐阅读
- microservices - 微服务——双向通信
- fiware - Fiware IoT Agent - 数据丢失问题
- node.js - 如何使用 bash 脚本填充交互式提示?| 密码字段出错
- sql - 如何使用多个表更新单行?
- regex - 过滤 Powershell 结果以避免某些类型的输入模式?
- arduino - 为什么我在一种情况下得到“无效的操作数类型”,而在另一种类似的情况下却没有?
- sql - MSSQL 按不同的列值仅选择最后一条记录值
- splunk - 如何链接在 Splunk 中用作警报的搜索事件
- python - 如何在 Pandas DataFrame 中取消嵌套列?
- javascript - 从 Paylocity API 检索员工的 PTO