2016-04-02 18 views
2

ich weiß nicht, wie Dreiecksform in css2 zu drehen, hier habe ich verwendet CSS wieCss-Transformation (Dreieck)

HTML:

<div class="frontcornertop"></div> 

CSS:

.frontcornertop { 
transition: none 0s ease 0s ; 
line-height: 39px; 
margin: 0px; 
padding: 0px; 
letter-spacing: 1px; 
font-weight: 600; 
font-size: 30px; 
left: -345px; 
border-right: 0px solid transparent; 
border-bottom-color: rgba(51, 51, 51, 0.5); 
border-width: 345px 0px 345px 345px; 
} 

it will produce like,

, aber ich brauche wie

enter image description here

Höhe 350px

wie kann ich diese drehen ??

Danke.

+0

Meinst du wirklich CSS2 oder meinst du CSS3? Sie können einige Ideen hier finden - http://stackoverflow.com/questions/15580009/are-diagonal-border-lines-possible-in-html-css/28263183#28263183 – Harry

+0

Wenn Sie ein CSS-Dreieck erstellen müssen, dann [ benutze diesen online genialen Generator] (http://apps.eky.hk/css-triangle-generator/). – Vucko

Antwort

1

Sie können dies mit grundlegenden CSS:

body { 
 
    background: white; 
 
} 
 

 
#triangle { 
 
    width: 0; 
 
    height: 0; 
 
    border-top: 350px solid transparent; 
 
    border-bottom: 350px solid transparent; 
 
    border-right: 500px solid black; 
 
} 
 

 
#inner { 
 
    position: relative; 
 
    top: -330px; 
 
    left: 11px; 
 
    width: 0; 
 
    height: 0; 
 
    border-top: 330px solid transparent; 
 
    border-bottom: 330px solid transparent; 
 
    border-right: 480px solid white; 
 
}
<div id="triangle"> 
 
    <div id="inner"></div> 
 
</div>

3

Sie div dieses CSS drehen kann:

Transform: rotate(90deg); 

Aber ich habe eine Idee für Ihre Form:

.shape { 
    width: 0; 
    height: 0; 
    border-top: 10px solid transparent;  
    border-bottom: 10px solid transparent; 
    border-right:10px solid blue; 
}