How can I make css curved line?

2019-06-21 04:18发布

How can I make css like this as picture below:

enter image description here

4条回答
你好瞎i
2楼-- · 2019-06-21 04:42

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

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-06-21 04:49

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

查看更多
该账号已被封号
4楼-- · 2019-06-21 04:57

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/

查看更多
一纸荒年 Trace。
5楼-- · 2019-06-21 05:01

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>

查看更多
登录 后发表回答