0
I’m doing a website, but he’s got this problem with spacing and photo alignment. Note that the "training" part is ok, but in the "food" part there is a problem in the text (even if justified). However the biggest problem is already in the third topic, to understand how the alignment of the text is completely wrong
The problem is that both are the same way and with the same values, since they are to be equal (only changes the name of the classes).
Paragraph code with the right image
.t1{
font-family: "teko";
font-size: 25pt;
color: #7843e8;
padding-left: 20%;
padding-top: 8%;
}
.txt1{
font-family: "roboto";
text-align: justify;
padding-top: 1%;
padding-left: 20%;
padding-right: 45%;
line-height: 150%;
}
.imgtreino{
width: 250px;
height: 250px;
position: relative;
float: right;
padding-right: 25%;
bottom: 228px;
}
.btn1{
font-family: "cabin";
color: #7843e8;
position: relative;
top: 30px;
padding: 10px 40px;
margin-left: 20%;
border:2px solid #7843e8 ;
border-radius: 5px;
}
.btn1:hover{
background-color: #7843e8;
color: white;
transition: .5s;
}
Paragraph code with left image
.t2{
font-family: "teko";
font-size: 25pt;
color: #7843e8;
margin-top: 10%;
padding-left: 36%;
}
.txt2{
font-family: "roboto";
text-align: justify;
padding-top: 1%;
padding-left: 36%;
padding-right: 30%;
line-height: 150%;
}
.imgcomida{
width: 250px;
height: 250px;
position: relative;
float: left;
padding-left: 16%;
bottom: 228px;
}
.btn2{
font-family: "cabin";
color: #7843e8;
position: relative;
top: 30px;
padding: 10px 40px;
margin-left: 4%;
border:2px solid #7843e8 ;
border-radius: 5px;
}
.btn2:hover{
background-color: #7843e8;
color: white;
transition: .5s;
}
I already tried to change the positions and it didn’t work
html code
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="css/nav.css">
<link rel="stylesheet" href="css/mainT.css">
<link rel="stylesheet" href="css/primeiro1.css">
<link rel="stylesheet" href="css/segundo.css">
<link rel="stylesheet" href="css/terceiro.css">
</head>
<body>
<header>
<div class="nav1">
<img class ="img1" src="imagens/gym freepik - white.png">
<ul>
<li id="items1"><a href=""> Treino </a></li>
<li id="items2"><a href=""> Comidas </a></li>
<li id="items3"><a href=""> Sono </a></li>
<li id="items4"><a href=""> Suplementos </a></li>
<li id="items5"><a href=""> Ergogenicos </a></li>
</ul>
</div>
</header>
<div class="MainT">
<p> Curso de Fisiculturismo </p>
</div>
<div class="primeiro">
<p class="t1" id="lk1"> Treino </p>
<p class="txt1">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vel imperdiet nulla. Morbi in venenatis eros, at efficitur sapien. Maecenas rhoncus pellentesque dolor a vulputate. Ut varius velit faucibus nibh elementum, nec iaculis elit pharetra. Integer consectetur elit vitae condimentum venenatis. Sed nec augue accumsan, dignissim nulla tincidunt, maximus arcu. Nulla orci ligula, suscipit semper lacus at, consectetur scelerisque ligula.
</p>
<img src="imagens/treino hex.png" class="imgtreino">
<a href="#" class="btn1"> VER MAIS</a>
</div>
<div class="segundo">
<p class="t2" id="lk2"> Comidas </p>
<p class="txt2">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec magna dui, sodales vel ligula ut, finibus tincidunt mauris. Nulla facilisi. Sed placerat et turpis ac suscipit. Aenean ac urna elementum velit ultrices pellentesque. Donec id vulputate ex, ut auctor enim. Donec dapibus nibh vitae magna facilisis, quis sollicitudin sem molestie. Nulla facilisi. Phasellus ac tincidunt nunc, nec imperdiet justo. Nunc lacus nunc, accumsan sit amet eleifend a, vestibulum vitae lorem. Nam venenatis molestie dui, a molestie mauris lacinia in. Integer sit amet faucibus risus, eget interdum leo.
</p>
<img src="imagens/alimen hex.png" class="imgcomida">
<a href="#" class="btn2"> VER MAIS</a>
</div>
<div class="terceiro">
<p class="t3" id="lk3"> Sono </p>
<p class="txt3">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras dictum fringilla neque ut porttitor. Sed a porttitor lorem. Aenean vitae purus ut nisl laoreet feugiat nec vitae dolor. Phasellus vitae odio nisi. Fusce sit amet ex sit amet enim malesuada placerat sit amet ac purus. Quisque in velit sem. Quisque vel justo eget urna dapibus volutpat egestas id metus. Nam condimentum libero arcu, in volutpat lacus pretium sit amet. Nullam sit amet quam pretium, sagittis justo vel, eleifend diam. Pellentesque nec nulla eu quam ultricies lacinia. Praesent nec nisl sit amet purus congue finibus. Etiam orci orci, rutrum ac lacus nec, ultricies euismod neque. Donec finibus purus vel sollicitudin porttitor. Etiam massa tellus, sollicitudin ac odio at, congue tristique lorem.
</p>
<img src="imagens/sono hex.png" class="imgsono">
<a href="#" class="btn3"> VER MAIS</a>
</div>
</body>
</html>
Amigo e Cade o HTML?? Only with CSS makes it difficult to answer you, offer as little code as possible for us to simulate your problem
– hugocsl
this in the post, had forgotten
– Lucas RM
Place
.primeiro, .segundo, .terceiro{
 clear: both;
}
and see if it solves.– Sam
Friend sorry to say, but using float, and padding and margins type 20%, 40%, 1%, hardly your layout will work, and will probably get less responsive than you imagine. I would start from 0 using flex. But if you want to follow up with this idea (which for me will never work), look about Clearfix, it will partially solve your problem
– hugocsl
It worked the clear Both Thank you very much
– Lucas RM
I’ll see about flex and see how I can change, I’m still at the beginning of the site
– Lucas RM
Lucas then is a great time to stop and not continue with something that will not work in the future. It’s just a tip...
– hugocsl