- This topic is empty.
-
AuthorPosts
-
July 20, 2018 at 2:00 am #274396Luís HenriquesParticipant
Hello everyone,
Today I was trying to implement two sections side by side (I’ve used the article tag though) however because on the left section there is text and on the other section there is only an image, the bottoms of both sections don’t align.I know it has to do with the text adding it’s own spacing on the already stablished padding.
If anyone could give me some insight on this situation it would be greatly appreciated, I really can’t find a solution to this…
Here is the code:
HTML
<section id="intro"> <article class="intro_info"> <h1>Lorem Ipsum</h1> <p>At vero <br> eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores<p> </article> <article class="intro_img"> </article> </section>
-CSS
article.intro_info {
padding: 30px 0 17% 0;
background: -webkit-linear-gradient(left, #4a9339 0%,#7fbc55 100%);
width: 50%;
float: left;
padding-left: 10px;
}article.intro_img {
padding: 30px 0 17% 0;
background-image: url(‘https://res.cloudinary.com/dbssny2ox/image/upload/v1532076139/hardlevel_descr_zxs50o.jpg’);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
width: 50%;
float: left;
}
article.intro_info h1{
font-family: “Lato”;
font-size: 36px;
color: #fff;
letter-spacing: 2px;
content: ”;
width: 35px;
padding-bottom: 10px;
border-bottom: 3px solid #fff;
margin-bottom: 20px;
left: 0px;
}article.intro_info p{
font-family: “Lato”;
font-size: 20px;
color: #fff;
}
“`July 20, 2018 at 2:34 am #274397PoganyParticipantHi,
It’s thepadding-left: 10px
for thearticle.intro_info
, wich means that thearticle.intro_info
is 10px wider than thearticle.intro_img
.
A solution would be to addbox-sizing:border-box;
for both articles, for example like this:
https://codepen.io/giaco/pen/gjLqRZ?editors=1100July 20, 2018 at 2:53 am #274398Luís HenriquesParticipantThank you for the help, it is a greater way to display the content! But the problem still persists, the bottoms of both sections don’t match since the section with the text is still bigger than the other one with the image :\
July 20, 2018 at 3:02 am #274399BeverleyhParticipantTry flexbox – make
section
a flex container https://css-tricks.com/snippets/css/a-guide-to-flexbox/July 20, 2018 at 3:21 am #274400Luís HenriquesParticipantBeverleyh
Thank you so much it worked like a charm!Pogany
Your help was also greatly apreciated :D -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.