我怎样才能制作css曲线?

时间:2015-05-05 04:35:22

标签: css css3 css-shapes

如何制作如下图所示的CSS:

enter image description here

4 个答案:

答案 0 :(得分:4)

您可以使用伪元素:



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>
&#13;
&#13;
&#13;

然后,您可以使用伪元素的高度和宽度属性来“拉伸”&#39;这条线。 请注意:这可能需要对顶部和左侧属性进行小幅调整以进行定位

答案 1 :(得分:4)

可以使用操纵边界半径

来实现

CSS

SELECT document, the_day, the_day - lag(the_day) OVER w AS gap
    FROM mytable
    where active=true and fault=false
    WINDOW w AS (PARTITION BY document ORDER BY document,the_day)

HTML

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

https://jsfiddle.net/u663m81s/

答案 2 :(得分:3)

根据要求改变高度!

您可以使用参数来满足您的需求!

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

答案 3 :(得分:3)

css中的箭头,来自css-tricks.com/ShapesOfCSS

&#13;
&#13;
#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);
}
&#13;
<div id="curvedarrow"></div>
&#13;
&#13;
&#13;

您也可以使用SVG:http://codepen.io/gaelb/pen/mJePGM