我正面临着一个我无法解决的问题。
在HTML和CSS中,我插入了一段视频,然后插入了一张图片作为背景,并对其进行了格式化。但是,视频和图像(两个元素)之间存在差距。我不能把这个弄走。
这里有人有解决方案吗?
多谢你们的支持。
HTML-代码:
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text</title>
<link rel="stylesheet" href="Stil.css" />
</head>
<body>
<div class="Start">
<h1>TextText</h1>
<div class="video-player">
<div class="layer"></div>
<video autoplay loop muted>
<source src="video.mp4" type="video/mp4">
</video>
</div>
</div>
<article class="text">
<section id="highlight">
<div>
<header>
<p> text,text,text,text.
</p>
</section>
</article>
</body>
</html>
CSS-代码:
html {
color:black;
margin-top: 0;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
font-size: 14px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
margin: 0;
padding: 0;
}
.Start {
position: relative;
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
overflow:hidden;
}
.Start h1 {
text-align: center;
color: cornsilk;
font-size: 10em;
font-family: "Cookie";
padding: 0px;
margin: 0px;
z-index: 1;
opacity: 1;
}
.video-player {
position: absolute;
top: 0;
left: 0;
width: 100%;
margin: 0mm;
}
.layer{
position: absolute;
background-color: rgb(0, 0, 0);
width: 100%;
height: 100vh;
opacity: 0.8;
margin: 0mm;
}
.text{
background-image: url("picture.png");
background-position: center;
background-size:cover;
margin-bottom:0em;
padding-bottom: 0em;
padding-top: 0em;
margin-top: 0em;
height: 70em;
}
section[id="highlight"]{
font-size: 2em;
color:white;
text-align: center;
line-height: 3em;
font-style:italic
}
发布于 2021-07-21 22:46:31
section[id="highlight"] {
overflow:hidden
}
问题可能出在段落标记上,因此您要么使用上面的标记,要么删除段落的页边距顶部
section[id="highlight"] p {
margin-top:0;
}
https://stackoverflow.com/questions/68471524
复制相似问题