2016-09-28 120 views

回答

1
.bar { 
    width: 200px; 
    height: 25px; 
    background: #6FD967; 
    border-right: 150px solid green; 
    background: repeating-linear-gradient(
     -45deg, 
     transparent, 
     transparent 4px, 
     transparent 1px, 
     green 7px 
    ), 
     linear-gradient(
     to bottom, 
     transparent, 
     transparent 
    ) 
    } 

工作小提琴:https://jsfiddle.net/mamata/q3ef8b7d/

0
.bar { 
    height: 100px; 
    width: 5px; 
    background: black; 
    transform: rotate(45deg); 
} 

工作小提琴:https://jsfiddle.net/b38zkr53/

使用转换,您可以创建对角线。

+0

好做。这是基本的。或者你想让整个代码为你编码? Loooooolololololllllll – 2016-09-28 09:40:36

+0

我知道绘制单一的对角线。我想知道很多对角线。无论如何,谢谢。 –

+0

使用伪前后或者你可以创建另一个类。 Loooool – 2016-09-28 09:47:03

0

.triangle,.triangle1 { 
 
    height: 100px; 
 
    width: 5px; 
 
    background: black; 
 
    transform: rotate(45deg); 
 
    margin-left: 200px; 
 
    display:inline-block; 
 
} 
 
.triangle1{ transform: rotate(137deg);margin-left:62px;} 
 
.triangle2{border-bottom:5px solid #000;width:20px;margin-left:200px;height:5px;}
<div class="triangle"></div><div class="triangle1"></div> 
 
<div class="triangle2">