Skip to content

Instantly share code, notes, and snippets.

@julian-stark
Last active November 30, 2022 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julian-stark/911e948b4d75855d6801387a54a10745 to your computer and use it in GitHub Desktop.
Save julian-stark/911e948b4d75855d6801387a54a10745 to your computer and use it in GitHub Desktop.
Simple CSS only corner ribbon
/*
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