Created
June 17, 2013 08:54
-
-
Save samediamba/5795564 to your computer and use it in GitHub Desktop.
Responsive CSS Ribbon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- RIBBON 1 --> | |
<div class="container one"> | |
<div class="bk l"> | |
<div class="arrow top"></div> | |
<div class="arrow bottom"></div> | |
</div> | |
<div class="skew l"></div> | |
<div class="main"> | |
<div></div> | |
</div> | |
<div class="skew r"></div> | |
<div class="bk r"> | |
<div class="arrow top"></div> | |
<div class="arrow bottom"></div> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
box-sizing: border-box; | |
} | |
.container { | |
width: 80%; | |
max-width: 1000px; | |
height: 80px; | |
margin: 40px auto; | |
position: relative; | |
} | |
.one > div { | |
height: 50px; | |
} | |
.main { | |
background: #0fadc0; | |
position: relative; | |
display: block; | |
width: 90%; | |
left: 50%; | |
top: 0; | |
padding: 5px; | |
margin-left: -45%; | |
z-index: 10; | |
} | |
.main > div { | |
border: 1px dashed #fff; | |
border-color: rgba(255, 255, 255, 0.5); | |
height: 40px; | |
} | |
.bk { | |
background: #1199a9; | |
position: absolute; | |
width: 8%; | |
top: 12px; | |
} | |
.bk.l { | |
left: 0; | |
} | |
.bk.r { | |
right: 0; | |
} | |
.skew { | |
position: absolute; | |
background: #0c7582; | |
width: 3%; | |
top: 6px; | |
z-index: 5; | |
} | |
.skew.l { | |
left: 5%; | |
transform: skew(00deg,20deg); | |
} | |
.skew.r { | |
right: 5%; | |
transform: skew(00deg,-20deg); | |
} | |
.bk.l > div { | |
left: -30px; | |
} | |
.bk.r > div { | |
right: -30px; | |
} | |
.arrow { | |
height: 25px !important; | |
position: absolute; | |
z-index: 2; | |
width: 0; | |
height: 0; | |
} | |
.arrow.top { | |
top: 0px; | |
border-top: 0px solid transparent; | |
border-bottom: 25px solid transparent; | |
border-right: 30px solid #1199a9; | |
} | |
.arrow.bottom { | |
top: 25px; | |
border-top: 25px solid transparent; | |
border-bottom:0px solid transparent; | |
border-right: 30px solid #1199a9; | |
} | |
.r .bottom { | |
border-top: 25px solid transparent; | |
border-bottom: 0px solid transparent; | |
border-left: 30px solid #1199a9; | |
border-right: none; | |
} | |
.r .top { | |
border-bottom: 25px solid transparent; | |
border-top: 0px solid transparent; | |
border-left: 30px solid #1199a9; | |
border-right: none; | |
} | |
@media all and (max-width: 1020px) { | |
.skew.l { | |
left: 5%; | |
transform: skew(00deg,25deg); | |
} | |
.skew.r { | |
right: 5%; | |
transform: skew(00deg,-25deg); | |
} | |
} | |
@media all and (max-width: 680px) { | |
.skew.l { | |
left: 5%; | |
transform: skew(00deg,30deg); | |
} | |
.skew.r { | |
right: 5%; | |
transform: skew(00deg,-30deg); | |
} | |
} | |
@media all and (max-width: 460px) { | |
.skew.l { | |
left: 5%; | |
transform: skew(00deg,40deg); | |
} | |
.skew.r { | |
right: 5%; | |
transform: skew(00deg,-40deg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here it is in action
https://codepen.io/anon/pen/RVxdPp