Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to add border-radius to the border of an element

Tags:

css

Image to explain the issue

I am adding a left border to the list-item element. width of border is 4px. Also, it needs to have rounded corners (border-radius of 4px).

Is this possible through CSS? I had gone through some tutorials and not able to fix this via CSS.

like image 368
Riten Avatar asked Oct 26 '25 09:10

Riten


1 Answers

You can do this by pseudoclass :before

h1 {
  position: relative;
  padding-left: 10px;
}
h1:before {
  content: '';
  height: 100%;
  width: 4px;
  border-radius: 10px;
  background: #000;
  display: block;
  position: absolute;
  left: 0;
}
<h1>Element Text</h1>
like image 130
Vsevolod Fedorov Avatar answered Oct 28 '25 02:10

Vsevolod Fedorov