【发布时间】:2022-06-15 12:31:04
【问题描述】:
我有一个带有视频背景的标题,在桌面上看起来不错,但在移动设备上它被推到左侧而不是全宽。
我尝试了所有我能想到的方法,但仍然无法按我的意愿工作。 它大约是从左侧开始的移动视图宽度的 2/3。 有趣的是,如果我删除所有图像,然后标题会起作用并散布以填充我想要的整个宽度。
有什么想法吗?
这是我的代码:
.header {
width: 100%;
height: 200px;
display: block;
overflow: hidden;
margin-bottom: 50px;
}
/* This h1 is in case video doesn't work */
.header h1 {
margin-top: 30px;
color: #3F4EFF;
}
.example_container {
display: flex;
padding-left: 0px;
padding-top: 20px;
margin: ;
justify-content: ;
width: 100%;
}
.exampletext-container {
display: flex;
padding-left: 30px;
margin: auto;
width: 700px;
}
.exampletext-container pre {
font-size: 20px;
padding-top: 20px;
color: black;
font-family: Montserrat;
white-space: pre-wrap;
word-wrap: break-word;
}
.exampletext-container img {
padding-top: 20px;
padding-left: 00px;
padding-bottom: 30px;
height: 250px;
width: 600px;
margin: auto;
}
.footer {
background-color: pink;
width: 100%;
height: 125px;
display: block;
}
.footer p {
font-family: Montserrat;
font-size: 10px;
color: white;
text-align: center;
padding-top: 15px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<link
href="https://fonts.googleapis.com/css?family=Montserrat:400,800"
rel="stylesheet"
/>
<link rel="stylesheet" type="text/css" href="css/styletest.css" />
<title>example</title>
</head>
<body style="background-color: #90ee903b">
<div class="header">
<div class="video6">
<video
autoplay
muted
defaultMuted
playsinline
src="images/touchblue4.mp4"
></video>
</div>
</div>
<main>
<div class="example_container">
<div class="exampletext-container">
<pre>
couple of paragraphs
<img src="images/example.png">
couple of paragraphs
<img src="images/example.png">
couple of paragraphs
<img src="images/example.png">
couple of paragraphs
<img src="images/example.png">
</pre>
</div>
</div>
<div class="footer">
<p>A paragraph.</p>
</div>
</main>
</body>
</html>
【问题讨论】:
-
在没有看到相关代码的情况下,我们无法正确了解正在发生的事情——任何答案都只是猜测。请看stackoverflow.com/help/minimal-reproducible-example
-
请提供足够的代码,以便其他人更好地理解或重现问题。