Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triangle with white border

Tags:

html

css

How can I create Triangle with white border using CSS? Like the image below.

enter image description here

when i add this css

.triangle {
    width:0;
    height:0;
    border-top: 20px solid transparent; 
    border-left: 20px solid white; 
    border-bottom: 20px solid transparent;
    position:relative;

}
.triangle:before {
    content:'';
    width:0;
    height:0;
    border-top: 10px solid transparent; 
    border-left: 10px solid red; 
    border-bottom: 10px solid transparent;
    position:absolute;
    top:-10px;
    left:-17px;
}

result is

enter image description here

like image 404
Pawan Lakhara Avatar asked Jan 17 '26 17:01

Pawan Lakhara


1 Answers

CSS:

.triangle {
    width:0;
    height:0;
    border-top: 20px solid transparent; 
    border-left: 20px solid white; 
    border-bottom: 20px solid transparent;
    position:relative;

}
.triangle:before {
    content:'';
    width:0;
    height:0;
    border-top: 10px solid transparent; 
    border-left: 10px solid red; 
    border-bottom: 10px solid transparent;
    position:absolute;
    top:-10px;
    left:-17px;
}

HTML:

<div class="triangle"></div>

Fiddle

like image 193
Muhammad Talha Akbar Avatar answered Jan 20 '26 08:01

Muhammad Talha Akbar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!