0

i'm trying to insert a border to a css shape that i created.

Here the css shape that i created

1

Here what happens when i insert the border

2

What do i need to change on my css?

.jologo{
   width: 200px;
   height: 0; 
   border-bottom: 40px solid #262627;
   border-left: 5px solid #f15c5c;
   border-right: 40px solid transparent;

}

Thanks

1 Answers1

2

Without changing the HTML, you could always add the border via an absolutely pseudo element. Just be sure to relatively position the parent element. (example)

.jologo:after {
    content:'';
    position:absolute;
    background:#f15c5c;
    height:40px;
    left:0;
    width:5px;
}

The reason your border wasn't working was because this is how borders are added to elements:

enter image description here

As a result, you will get a border that is skewed if the height of the element is 0.

Community
  • 1
  • 1
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304