dev.knockout
dev.knockout

Reputation: 399

How can I make css curved line?

How can I make css like this as picture below:

enter image description here

Upvotes: 4

Views: 18796

Answers (4)

Ranjith
Ranjith

Reputation: 134

Can be achieved using manipulating 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/

Upvotes: 6

jbutler483
jbutler483

Reputation: 24559

You could use a pseudo element for this:

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>

You could then play with the height and width properties of the pseudo element to 'stretch' the line. Please note: this may require small adjustments to the top and left properties for positioning

Upvotes: 4

Ga&#235;l Barbin
Ga&#235;l Barbin

Reputation: 3929

An arrow in css, from 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>

You can alternatively use SVG: http://codepen.io/gaelb/pen/mJePGM

Upvotes: 3

PrakashSharma
PrakashSharma

Reputation: 386

Change height as per requirement !

You can play with parameters to suit your needs !!

.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>

Upvotes: 3

Related Questions