有人可以请教我如何修复这个错误在我的代码,我很新,似乎找不到任何信息,它在互联网上.我试图让我的flexbox在这个横幅的正下方,但由于一些奇怪的原因,flexbox被推到了页面的右边,除非滚动到右边,否则是不可见的。任何人都知道我如何把这个FlexBox放在屏幕中间和横幅下面,因为我对我做错了什么一无所知。
图片:
What page looks like when open
When scrolling to the right
HTML:
<div class="banner">
<p class="large">Features</p>
<p class="below-large">What Do We Bring to the Table?</p>
</div>
<div class="reasons">
<div class="firstColumn">
<p class="first">No Login</p>
<img class="firstIcon"src="lock_icon.png">
<p class="firstDesc">No need to fear that your information will be stolen and waste time logging in when our tests are open to anyone.</p>
</div>
<div class="secondColumn">
<p class="second">Accuracy</p>
<img class="secondIcon" src="target.png">
<p class="secondDesc">Our tests are deadly accurate and will release answers that have been meticulously chosen by our algorithims.</p>
</div>
<div class="thidColumn">
<p class="third">Ease</p>
<img class="thirdIcon" src="smile.png">
<p class="thirdDesc">Our tests are easy to access and easy to follow, so we can reach as many people as possible.</p>
</div>
</div>
CSS:
/*Banner*/
.banner{
padding-top: 100px;
padding-left:20px;
padding-bottom: 100px;
color: white;
display:block;
box-sizing: inline-box;
width: 100%;
float: left;
background-image: url('banner-backgrounds.png');
}
.large{
font-size: 56px;
font-weight: bold;
color: white;
}
.below-large{
font-style: italic;
font-size: 30px;
}
/*Reasons*/
.reasons{
padding-top: 400px;
text-align: center;
display: flex;
justify-content: space-between;
align-items: center;
}
.firstColumn{
flex-direction: column;
}
.first{
font-weight: bold;
font-size: 30px;
}
.secondColumn{
flex-direction: column;
}
.second{
font-weight: bold;
font-size: 30px;
}
.thirdColumn{
flex-direction: column;
}
.third{
font-weight: bold;
font-size: 30px;
}
我应用了一些填充到顶部,如果不在那里,它将直接到右边的横幅,关闭屏幕。任何帮助都很感激。
2条答案
按热度按时间kqhtkvqz1#
请通过此链接https://www.w3schools.com/css/css3_flexbox.asp了解如何正确实现flexbox。除此之外,图像大小可能会导致溢出,因此请确保使用适当大小的图像。如果您无法做到这一点,请将
overflow-x:hidden;
添加到映像的父容器中。希望有帮助!谢谢
tzcvj98z2#
我编辑了你的代码,并注解了错误:
Kevin Powell关于flex-box的推荐视频:https://www.youtube.com/watch?v=u044iM9xsWU
如果你有任何问题,请随时发表评论