I have a problem to design the Section tabs in the Home of a Web that I am developing.
Even though I have established the container with relative position, the boxes with absolute position continue taking as reference the width and height of the page itself, but not the one of its container.
Capture step and fragment of the code. Sure, it's silly, but I can not find the solution.
- CODE-- / I have tried to leave as a relative position only the container of the boxes that are positioned absolute, and also (as the following code shows) leaving the parent containers as relative, but with no result. /
The following is the code of the .CSS file
/*SECTION*/
/*Este bloque es el contenedor del propio section de la página (a section no le he definido ningún estilo css)*/
.contenedorSection{
width: 90%; height: 880px;
position: relative;
margin-left: auto; margin-right: auto;
border: 2px solid black;
}
/*Este bloque es el contenedor de los div que sirven como pestañas del Section*/
.contPestanasSect{
width: 100%; height: 880px;
**position: relative;**
}
/*Esta clase define a las pestañas del section, que son también div que continen etiqueta p*/
.pestSect{
width: 200px; height: 100px;
**position: absolute;**
/*define la posicion del texto*/
display: flex;
justify-content: center;
align-content: center;
flex-direction: column;
/*define el borde*/
border: 2px solid #1CD7DF;
}
/*los id que determinan la posición de cada pestaña dentro del section (en el caso de #a lo he dejado al 100% para que se vea claramente que sobrepasa el borde de su contenedor*/
#a{
top: 40%; left: 100%;
}
#b{
top: 60%; left: 65%;
}
#c{
top: 40%; left: 45%;
}
#d{
width: 240px;
top: 60%; left: 25%;
}
#e{
top: 40%; left: 5%;
}
Next I pass the structure of the HTML file
<!--BLOQUE SECTION-->
<div class="contenedorSection">
<section>
<div class="contPestanasSect">
<div class="pestSect" id="a"><p class="fuenteSection">ANALISIS</p></div>
<div class="pestSect" id="b"><p class="fuenteSection">NONSTOP</p></div>
<div class="pestSect" id="c"><p class="fuenteSection">PAJAS MENTALES</p></div>
<div class="pestSect" id="d"><p class="fuenteSection">MISCELANEAS</p></div>
<div class="pestSect" id="e"><p class="fuenteSection">CANDY-SHOP</p></div>
</div>
</section>
</div>
I hope you can help me. A greeting.