gpt4 book ai didi

html - 为什么我的叠加透明背景颜色没有覆盖整个屏幕

转载 作者:行者123 更新时间:2023-11-28 02:23:00 31 4
gpt4 key购买 nike

我有这个号召性用语页面,它有一个背景图像和图像顶部的背景颜色;但是,我无法使背景色占据整个屏幕。这里没什么帮助!谢谢 PS:我也在使用 bootstrap cdns。页面链接:http://pctechtips.org/apps/conf/CSS:

/*
full stack conf style
*/

body {
background-image: url("http://travelhdwallpapers.com/wp-content/uploads/2017/03/Chicago-Wallpaper-3.jpg");
background-size: cover;
position: relative;
z-index: -10;
}

.hero {
height: 100vh;
top: 0;
bottom: 0;
background-color: rgba(31, 34, 118, 0.5);
z-index: -5;
}

html

<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- bootstrap cdns css,js,popper.js,jquery -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">

</head>
<!-- bg-info = background blue, text-center = text white -->
<body class="text-white">
<div class="hero">
<div class="container text-center">
<h1 class="display-1" style="margin-top:12rem">Full Stack Conf</h1>
<p class="lead mb-5">Comming Soon, a One-day Conference About All Things Javascript!</p>
</div>
<div class="container text-center">
<div class="row">
<div class="col-6 mx-auto">
<div class="input-group">
<input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2">
<span class="input-group-btn">
<button class="btn btn-primary" type="button">Sign up</button>
</span>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</body>
</html>

最佳答案

好的,感谢上面评论的人,这就是答案

/*
full stack conf style
*/

body {
background-image: url("http://travelhdwallpapers.com/wp-content/uploads/2017/03/Chicago-Wallpaper-3.jpg");
background-size: cover;
position: relative;
z-index: -10;
}

.hero {
position: absolute;
height: 100vh;
width: 100%;
top: 0;
bottom: 0;
background-color: rgba(31, 34, 118, 0.5);
z-index: -5;
}

关于html - 为什么我的叠加透明背景颜色没有覆盖整个屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48100197/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com