[英]How can I get the img flush in the corner?
Currently my img
for this card looks like this: jsFiddle 目前,我对此卡的
img
如下所示: jsFiddle
This is part of the reactjs component: 这是reactjs组件的一部分:
<div className='col-lg-4 emp-row'>
<div className="col-lg-4">
<img src={this.props.details.avatar} alt=""/>
</div>
<div className="col-lg-8">
<div>
<span className='name'> {this.props.details.firstName}
{this.props.details.lastName}</span>
<div>
{this.props.details.bio.slice(0, 80)}
</div>
</div>
</div>
</div>
Notice how there are spaces around the img
? 请注意
img
周围有空格吗? I tried to change the height but it does not help. 我试图更改高度,但无济于事。
How can I get the img to display like this:? 我如何使img显示如下:?
You need to remove the padding around the img
containers: 您需要删除
img
容器周围的填充:
.emp-row {
display: flex;
flex-direction: row;
/* padding: 10px 0; <--- remove */
border: 1px solid black;
}
.col-lg-4 {
position: relative;
min-height: 1px;
padding-right: 15px;
/* padding-left: 15px; <--- remove */
}
https://jsfiddle.net/ss1syudL/5/ https://jsfiddle.net/ss1syudL/5/
You are using bootstrap, so the col-lg-4 has padding defined, thus you have 2 choices. 您正在使用引导程序,因此col-lg-4定义了填充,因此您有2个选择。
Add an extra class to the div containing the image and define padding as zero. 向包含图像的div添加一个额外的类,并将padding定义为零。
Add a class to the images and define css like: 在图像中添加一个类,并定义CSS,例如:
<img class='mugshot' src='.../etc'>
.mugshot{
margin: -10px;
margin-left: -15px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.