[英]How to set background image full as per screen size without giving height and make content center into it
请使用此代码:
.hero { width: 100%; height: 100vh; background: #000 url("https://crowdforangels.com/blog/wp-content/uploads/2017/01/notebook-1280538_1920.jpg") no-repeat; background-size: cover; display: flex; align-items: center; justify-content: center; }.hero.overlay { color: #fff; text-align:center; }
<section class="hero"> <div class="overlay"> <h1>WEB & GRAPHIC DESIGNER</h1> <a href="#">LEARN MORE</a> </div> </section>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.