How can I make a css curved line?

How can I make css as follows:

enter image description here

+4
source share
4 answers

To do this, you can use the pseudo-element:

div {
  height: 300px;
  width: 300px;
  background: lightgray;
  position: relative;
  border-bottom: 5px solid black;
  border-right: 5px solid black;
}
div:after {
  content: "";
  position: absolute;
  height: 100%;
  width: 100%;
  border: 3px solid transparent;
  border-bottom-color: black;
  top: -5px;
  left: 50%;
  border-radius: 50%;
  transform: rotate(45deg);
}
<div></div>
Run codeHide result

Then you can play with the height and width parameters of the pseudo-element to β€œstretch” the line. Please note: this may require minor adjustments for the top and left positioning properties.

+4
source

Can be achieved by manipulating the border radius.

CSS

.graph {
    height: 100px;
    width: 200px;
    background: transparent;
    border-radius: 0px 0px 0px 370px/225px;
    border: solid 5px grey;
    border-top:none;
    border-right:none;
    margin:20px;
}

.graph:before {
    height:20px;
    width: 10px;
    border: 5px solid grey;
    border-radius: 30px 30px 0px 0px /75px 75px 0px 0px ; 
    display: block;
    content: "";
    border-bottom:none;
    position:relative;
    top: -9px;
    left: -12px;
}

HTML

<div class = "graph"><div>

https://jsfiddle.net/u663m81s/

+4
source

!

!

.box{
  width:100px; height:80px;  
  border:solid 3px #000;
  border-color:transparent transparent #000 #000;
  border-radius: 0px 0px 0px 250px;
}
<div class="box"></div>
Hide result
+3

css, css-tricks.com/ShapesOfCSS

#curvedarrow {
  position: relative;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-right: 9px solid red;
  -webkit-transform: rotate(10deg);
  -moz-transform: rotate(10deg);
  -ms-transform: rotate(10deg);
  -o-transform: rotate(10deg);
}
#curvedarrow:after {
  content: "";
  position: absolute;
  border: 0 solid transparent;
  border-top: 3px solid red;
  border-radius: 20px 0 0 0;
  top: -12px;
  left: -9px;
  width: 12px;
  height: 12px;
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
}
<div id="curvedarrow"></div>
Hide result

SVG: http://codepen.io/gaelb/pen/mJePGM

+3

All Articles