Last active
November 30, 2022 09:05
-
-
Save julian-stark/911e948b4d75855d6801387a54a10745 to your computer and use it in GitHub Desktop.
Simple CSS only corner 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
/* | |
Example: | |
https://share.cleanshot.com/yZOIpu | |
HTML: | |
<div class="box"> | |
<div class="ribbon"><span>News</span></div> | |
</div> | |
*/ | |
.box { | |
position: relative; | |
max-width: 600px; | |
width: 90%; | |
height: 400px; | |
background: #fff; | |
} | |
.ribbon { | |
width: 150px; | |
height: 150px; | |
overflow: hidden; | |
position: absolute; | |
top: 0; | |
right: 0; | |
} | |
.ribbon span { | |
position: absolute; | |
display: block; | |
width: 200px; | |
padding: 5px 0; | |
background-color: blue; | |
color: #fff; | |
text-transform: uppercase; | |
text-align: center; | |
font-size: 13px; | |
font-weight: 800; | |
left: 15px; | |
top: 20px; | |
transform: rotate(45deg); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment