You can put the class trapézioInvertido
in a div
, and call your list within it.
.trapezioinvertido{
float:left;
border-top: 70px solid #c1c1c1;
border-left: 30px solid transparent;
border-right: 15px solid transparent;
height: 0;
width: 120px;
color:#000;
line-height:0px; /* Remover esta linha caso quera mais de 1 item na lista ou aumentar o line-height*/
list-style-type:none;
}
.lista{
position: absolute;
top:2%;
}
<div class="trapezioinvertido">
<ul class="lista">
<li><a href="#">Link</a></li>
<!--<li><a href="#">Link1</a></li> -->
</ul>
</div>
I created the class lista
defining the position as absolute
and his position.
Edit
To add to a list, you should add position: relative
in the list and change the position of each <a href="#">
, in this way:
.trapezioinvertido{
padding: 10px;
border-top: 70px solid #c1c1c1;
border-left: 30px solid transparent;
border-right: 15px solid transparent;
height: 0;
width: 120px;
color:#000;
text-align: center;
line-height:0px;
list-style-type:none;
position: relative;
}
li a.link{
position: absolute;
bottom: 60px;
left: 50px;
}
<ul>
<li class="trapezioinvertido" ><a href="#" class="link">Link</a></li>
<li class="trapezioinvertido" ><a href="#" class="link">Link2</a></li>
<li class="trapezioinvertido" ><a href="#" class="link">Link3</a></li>
</ul>
To better understand the positions
, see this response.
You want the whole trapeze to have the
href
, or just the Link?– Randrade
Whatever. If it’s not harder, I’d rather Link just keep href.
– Tiago P.C
Anyone can answer?
– Tiago P.C
The tricky thing is that your element has no height (
height:0
), then you’ll have to use absolute position as Randrade suggested.– Renan Gomes
Even if I assign a height the text does not align in the center because the shape is made with border. Has some solution?
– Tiago P.C
That’s what I said, and Randrade’s response is a solution.
– Renan Gomes