Hello
I'm making a simple product page, but I'm having some difficulties when positioning the elements as in the print below:
Firstly I was using attributes like: Left: ?? px; bottom: ?? px; , but it did not work very well, because the site was getting spaces where they were not like the print below:
Example of how I was doing:
<div class="3row">
<section>
<h2 class="TituloP1" style="position: relative; bottom: 2850px; left: 250px; font-size: 25px;">Kit Cirúrgico 20g para Implante</h2>
<img src="images/Rolete_de_Algodao.jpg" style="position: relative; border-style: solid; border-color: #BE1E2D; border-width: 1px; margin-top: 100px; margin-bottom: 100px; margin-right: 150px; margin-left: 80px; width: 350px; bottom: 2930px; left: 100px;"
/>
</section>
<section>
</section>
<section>
<h2 class="precodPor" style="color: #BE1E2D;font-size: 25px; position: relative; bottom: 3020px; left: 305px;">R$25,84</h2>
</section>
<section>
<a href="Adesivo_Magic_Bond_Esmalte.html" class="button style1" style="position: relative; bottom: 3070px; left: 240px;">Ver detalhes</a>
</section>
</div>
Spaces that were over:
SearchingtheinternetIfoundthiscodethatwouldpositiontheelementsusingUlandLi
CSSandHTML:
margin: 0;
/* removendo margin padrão */
padding: 0;
/* Removendo padding padrão */
text-align: center;
}
li {
display: inline-block;
width: 45%;
}
.left {
background-color: White;
}
.right {
background-color: White;
}
<ul class="produtos">
<li class="left half">
<h2 style="text-align: center; font-size: 25px;">Silicone de condesação Perfil</h2>
<img src="images/Silicone_de_Condensacao.jpg" style="border-style: solid; border-color: #BE1E2D; border-width: 1px; margin-top: 100px; margin-bottom: 100px; margin-right: 150px; margin-left: 80px; width: 350px;">
<h2 style=" text-decoration: line-through; color: gray;">R$179,99</h2>
<h2 class="precodPor" style="color: #BE1E2D;font-size: 25px;">R$166,00</h2>
<a href="Silicone_de_condesacao_Perfil.html" class="button style1" >Ver detalhes</a>
</li>
<li class="right half">
<h2 style="text-align: center; font-size: 25px;">Alginato Algi-Gel</h2>
<img src="images/Alginato-Gel_2.jpg" style="border-style: solid;
border-color: #BE1E2D;
border-width: 1px;
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px; width: 350px;">
<h2 class="precodPor" style="
color: #BE1E2D;
font-size: 25px;">R$12,50</h2>
<a href="Alginato_Algi-Gel.html" class="button style1">Ver detalhes</a>
</li>
</ul>