can someone please teach me how to fix this error in my code, I’m quite new and can’t seem to find any info on it on the internet. I was trying to make my flexbox be right below this banner, but for some odd reason, the flexbox is pushed out of the page to the right and is not visible unless scrolled to said right. Anyone know how I can place this flexbox in the middle of the screen and under the banner because I am clueless on what I did wrong.
Images:
What page looks like when open
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;
}
I applied some padding to the top and if not there, it would be directly to the right of the banner, off screen. Any help is appreciated.
2
Answers
Please go through this link https://www.w3schools.com/css/css3_flexbox.asp to understand how you can implement flexbox properly. Other than that Image size can cause overflow so make sure to use the images of proper size. If you’re unable to do that, add the
overflow-x:hidden;
to the parent container of your image.Hope that helps!
Thanks
I edited your code with comments of what was wrong:
if you have any questions feel free to comment