gpt4 book ai didi

html - 我怎样才能让一 strip 有文字的颜色条穿过屏幕?

转载 作者:太空宇宙 更新时间:2023-11-04 06:25:32 25 4
gpt4 key购买 nike

这是我的网站元素代码。当我执行它时,浅蓝色条以文本为中心,但不是水平移动,而是垂直移动。我真的希望它是水平的,有点像 YouTube 横幅。

这是它目前的样子:https://gyazo.com/bec50dc13260d0c3b572f55ab0def12c

我不希望它看起来像这样。我不希望它看起来像一座塔或一座建筑物。我希望它水平移动,就像地板或天花板一样。

        body,
html {
height: 100%;
margin: 0;
font-size: 16px;
font-family: "Lato", sans-serif;
font-weight: 400;
line-height: 1.8em;
}

.jumbotron {
top: 50%;
left: 50%;
background-image: url(image.jpg);
background-position: 0% 25%;
background-size: cover;
background-repeat: no-repeat;
border: 2px;
}

.navigation {
background-color: #330;
overflow: hidden;
display: grid;
grid-template-columns: auto auto auto auto auto;
}

.navigation a {
font-size: 20px;
text-decoration: none;
color: #f2f2f2;
text-align: center;
float: left;
}

.navigation a:hover {
background-color: #dddddd;
color: black;
}

.navigation a.active {
background-color: #4CAF50;
color: white;
}

.intro {
background-image: url("Engineering.jpg");
background-repeat: no-repeat;
background-position: center top;
background-size: cover;
background-color: rgba(0, 0, 0, 0.5);
height: 100%;
justify-content: center;
display: flex;
align-items: center;
}

h1 {
margin: auto;
z-index: 4;
text-align: center;
color: white;
font-size: 100px;
padding: 10px;
line-height: 1.8em;
}

.secondbg {
background-image: url("circuit.jpg");
background-repeat: no-repeat;
background-position: center top;
background-size: cover;
background-color: rgba(0, 0, 0, 0.5);
height: 100%;
justify-content: center;
display: flex;
align-items: top;

}

.barofcolour {

top: 50%;
left: 50%;
background-color: lightblue;
background-position: 0% 25%;
background-size: ;
background-repeat: no-repeat;
border: 2px;
}
 <body>
<div class="navigation">
<a class="active" href="#home">Home</a>
<a href="#aboutMe">About Me</a>
<a href="#careers">Careers</a>
<a href="#contactUs">Contact Us</a>
<a href="#webDev">Web Development</a>
</div>

<div class="intro">
<div class="jumbotron">
<h1>Computer Engineering</h1>

</div>


</div>

<div class="secondbg">
<div class = "barofcolour">
<div class="courseinfo">
<h2>About This Course
</h2>
</div>

</div>
</div>

任何帮助将不胜感激:)。

最佳答案

barofcolour 类的 CSS 中,只需设置属性 width:100%。应该可以解决问题!

我已经添加到this codepen中了

希望这能解决您的问题!

关于html - 我怎样才能让一 strip 有文字的颜色条穿过屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55116537/

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