Skip to content

Instantly share code, notes, and snippets.

@WangShuXian6
Created December 3, 2021 09:49
Show Gist options
  • Save WangShuXian6/b47667e47bf801c3ee0c0a6f9e57660b to your computer and use it in GitHub Desktop.
Save WangShuXian6/b47667e47bf801c3ee0c0a6f9e57660b to your computer and use it in GitHub Desktop.
tooltips-border
<tips>this is tooltips!</tips>
<tips>this is new tooltips!</tips>
<tips class="line">this is tooltips!</tips>
<tips class="line">this is new tooltips!</tips>
html,body{
height: 100%;
margin:0;
display:flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1em;
}
tips{
position: relative;
--bg: linear-gradient(45deg, #ff3c41, #ff9800);
padding: 0.5em 0.8em calc(0.5em + 5px);
color: #fff;
filter: drop-shadow(0px 0px 0.5px #333) drop-shadow(0px 0px 0px #333) drop-shadow(0px 0px 0px #333) drop-shadow(0px 0px 0px #333) drop-shadow(0px 0px 0px #333)
}
tips::before,tips::after{
content:'';
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: var(--bg);
z-index: -1;
}
tips::before{
clip-path: inset(0 0 5px 0 round 5px);
}
tips::after{
clip-path: polygon(calc(50% - 5px) calc(100% - 5px), calc(50% + 5px) calc(100% - 5px), 50% 100%);
}
.line{
--bg: #fff;
color: #333
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment