简体   繁体   English

中心底部图像 CSS 和 HTML

[英]Center bottom image CSS and HTML

I'm trying to center bottom the image of the person, also I need to make it responsive.我正在尝试将人的形象置于底部,我还需要使其具有响应性。 I tried different methods but it seems is not working, could you help me out with this please?我尝试了不同的方法,但似乎不起作用,请您帮我解决这个问题吗? I'm attaching an image as a reference.我附上一张图片作为参考。 Thanks.谢谢。

 .content-section { height: 80vh; background-image: url("https://media-exp1.licdn.com/dms/image/C561BAQHkRX0CouHDLw/company-background_10000/0/1575288490228?e=2159024400&v=beta&t=4d6L5ldeRu30uZNDQYydkL_tpLP6AEEx6ATq7LF9WGo"); background-position: center; background-repeat: no-repeat; background-size: cover; display: grid; justify-items: center; align-items: center; }.content-section img { position: absolute; width: 50%; bottom: EDGE; }
 <section class="content-section"> <img class="img-responsive" src="https://pierpoint.com/wp-content/uploads/Manufacturing-Recruitment-Image-RPO-Pierpoint-International-2-min.png"> </section>

在此处输入图像描述

I prefer to use flex.我更喜欢使用弹性。

.content-section {
    height: 80vh;
    background-image: url("https://media-exp1.licdn.com/dms/image/C561BAQHkRX0CouHDLw/company-background_10000/0/1575288490228?e=2159024400&v=beta&t=4d6L5ldeRu30uZNDQYydkL_tpLP6AEEx6ATq7LF9WGo");
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}
.content-section img {
    width: 50%;
}

Learn more on flex here .此处了解有关 flex 的更多信息。

Try this:尝试这个:

 .content-section { height: 80vh; background-image: url("https://media-exp1.licdn.com/dms/image/C561BAQHkRX0CouHDLw/company-background_10000/0/1575288490228?e=2159024400&v=beta&t=4d6L5ldeRu30uZNDQYydkL_tpLP6AEEx6ATq7LF9WGo"); background-position: center; background-repeat: no-repeat; background-size: cover; display: grid; justify-items: center; align-items: center; }.content-section img { width: 50%; display: block; margin: auto; }
 <section class="content-section"> <img class="img-responsive" src="https://pierpoint.com/wp-content/uploads/Manufacturing-Recruitment-Image-RPO-Pierpoint-International-2-min.png"> </section>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM