Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Transparent CSS Triangle with Borders</h1>
<p>It's a crappy solution but it's working =)</p>
<div class="container">
    <div class="triangle"></div>
</div>



<div class="demo">
    <div class="container2">
        <div class="triangle2"></div>
    </div>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700);

* {
  	margin: 0;
  	padding: 0;
	font-family: 'Roboto', sans-serif;
	font-weight: 400;
}

body {
    padding: 20px 60px;
    background: url(https://images.unsplash.com/uploads/141158930417696a26471/1be620c3?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=1de98cb9239a377e266729722d2f6834&auto=format&fit=crop&w=1350&q=80) no-repeat center center fixed; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

h1 {
    margin-bottom: 20px;
    color: #fff;
    text-shadow: 0 0 4px #000;
}

p {
	color: rgba(255,255,255,.8);
	font-style: italic;
	margin-bottom: 1rem;
}

.container {
    width: 200px;
    height: 200px;
    position: relative;
    border-top: 4px solid #e74c3c;
}

.triangle {
    position: absolute;
    margin: auto;
    top: -70px;
    left: 0;
    right: 0;
    width: 137px;
    height: 137px;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    border-right: 4px solid #e74c3c;
    border-bottom: 4px solid #e74c3c;
}





.demo {
    position: fixed;
    margin: auto;
    right: 0;
    bottom: 0;    
    background: #fff;
    background: rgba(255, 255, 255, .9);
    width: 400px;
    height: 220px;
    padding-top: 120px;
}

.container2 {
    width: 200px;
    height: 200px;
    background: transparent;
    position: relative;
    border-top: 2px solid #7f8c8d;
    margin: 0 auto;
    animation:con 6s infinite linear;
    -webkit-animation:con 6s infinite linear;
    border-right: 0 dashed #000;
    border-left: 0 dashed #000;
    border-bottom: 0 dashed #000;
}

.triangle2 {
    position: absolute;
    margin: auto;
    top: -70px;
    left: 0;
    right: 0;
    width: 137px;
    height: 137px;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    background: transparent;
    border: 0px dashed #000;
    border-right: 2px solid #7f8c8d;
    border-bottom: 2px solid #7f8c8d;
    animation:tri 6s infinite linear;
    -webkit-animation:tri 6s infinite linear;
}

@keyframes con
{
    0% {background: transparent;}
    20% {background: red;}
    40% {background: transparent;}
    50% {border: 2px dashed #000;}
    70% {border: none; border-top: 4px solid #e74c3c;}
    100% {border: none; border-top: 4px solid #e74c3c;}
}

@-webkit-keyframes con
{
    0% {background: transparent;}
    20% {background: red;}
    40% {background: transparent;}
    50% {border: 2px dashed #000;}
    70% {border: none; border-top: 4px solid #e74c3c;}
    100% {border: none; border-top: 4px solid #e74c3c;}
}


@keyframes tri
{
    0% {background: transparent;}
    20% {background: blue;}
    40% {background: transparent;}
    50% {border: 2px dashed #000;}
    70% {border: none; border-right: 4px solid #e74c3c; border-bottom: 4px solid #e74c3c;}
    100% {border: none; border-right: 4px solid #e74c3c; border-bottom: 4px solid #e74c3c;}
}

@-webkit-keyframes tri
{
    0% {background: transparent;}
    20% {background: blue;}
    40% {background: transparent;}
    50% {border: 2px dashed #000;}
    70% {border: none; border-right: 4px solid #e74c3c; border-bottom: 4px solid #e74c3c;}
    100% {border: none; border-right: 4px solid #e74c3c; border-bottom: 4px solid #e74c3c;}
}
              
            
!

JS

              
                
              
            
!
999px

Console