多种超链接下划线的CSS样式参考

网站超链接悬停动画可以帮助确保用户知道他们的光标在正确的位置。

如果您正在寻找既引人入胜又轻巧的动画,那么值得一试的效果集。

有许多吸引人的超链接方式可以增强您的链接体现,网站建设在这边给大家展示几种好看又实用的链接方式

 

多种超链接下划线的CSS样式参考

「点击以上图片可以超链接到实际的效果演示地址」

 

样式所用的html代码

 

<div class="wrapper">
<h1>Hyperlink :hover CSS Animations</h1>
<ol>
<li>
<div class="effect-one"><a>Underline – Inside out</a></div></li>
<li>
<div class="effect-two"><a>Underline – Right to Left</a></div></li>
<li>
<div class="effect-three"><a>Underline – Right to Left</a></div></li>
<li>
<div class="effect-four"><a>Underline – Bounce down</a></div></li>
<li>
<div class="effect-five"><a>Background color – Right to Left</a></div></li>
<li>
<div class="effect-six"><a>Background color – Left to Right</a></div></li>
<li>
<div class="effect-seven"><a>Background color – Bottom to Top</a></div></li>
<li>
<div class="effect-eight"><a>Background color – Top to Bottom</a></div></li>
</ol>
</div>

 

样式所用的CSS代码

 

/* Demo styles */

$mainColor: #21242C;
body {
font-family: 'Open Sans', sans-serif;
background: $mainColor;
color: white;
font-size: 20px;
padding: 0;
}
a {
cursor: pointer;
text-decoration: none;
}
ol, li {
margin: 0;
padding: 0;
}
li {
padding: 12px;
}
.wrapper {
width: 100%;
max-width: 400px;
margin: 0 auto 0 auto;
}

/**
* ANIMATIONS CSS ———————————
*/

// Animation 1
// Underline – Inside Out
.effect-one > a {
position: relative;
&:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
margin: -5px 0;
background-color: white;
visibility: hidden;
transform: scaleX(0);
transition: all 0.4s ease-in-out 0s;
}
&:hover:before {
visibility: visible;
transform: scaleX(1);
}
}

// Animation 2
// Underline – Right to Left
.effect-two > a {
display: inline-block;
position: relative;
&:after {
content: "";
display: block;
position: absolute;
width: 0;
bottom: 0;
height: 2px;
margin: -5px 0;
right: 0;
background-color: white;
transition: all 0.4s ease-in 0s;
}
&:hover:after {
width: 100%;
}
}

// Animation 3
// Underline – Left to Right
.effect-three > a {
display: inline-block;
position: relative;
&:after {
content: "";
display: block;
position: absolute;
width: 0;
bottom: 0;
height: 2px;
margin: -5px 0;
left: 0;
background-color: white;
transition: all 0.4s ease-in 0s;
}
&:hover:after {
width: 100%;
}
}

// Animation 4
// Background color – Right to Left
.effect-four > a {
padding: 0 0 4px 0;
border-bottom: 2px solid $mainColor;
transition: 0.3s ease;
&:hover{
padding: 0 0 6px 0;
border-color: white;
}
}

// Animation 5
// Background color – Left to Right
.effect-five > a {
padding: 0 5px;
box-shadow: inset 0 0 0 0 white;
transition: all 0.4s ease-in-out 0s;
&:hover{
box-shadow: inset -300px 0 0 0 white;
color: $mainColor;
}
}

// Animation 6
// Background color – Left to Right
.effect-six > a {
padding: 0 5px;
box-shadow: inset 0 0 0 0 white;
transition: all 0.4s ease-in-out 0s;
&:hover{
box-shadow: inset 300px 0 0 0 white;
color: $mainColor;
}
}

// Animation 7
// Background color – Bottom to Top
.effect-seven > a {
padding: 0 5px;
box-shadow: inset 0 0 0 0 white;
transition: all 0.5s ease-in-out 0s;
&:hover{
box-shadow: inset 0 -300px 0 0 white;
color: $mainColor;
}
}

// Animation 8
// Background color – Top to Bottom
.effect-eight > a {
padding: 0 5px;
box-shadow: inset 0 0 0 0 white;
transition: all 0.5s ease-in-out 0s;
&:hover{
box-shadow: inset 0 300px 0 0 white;
color: $mainColor;
}
}

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/262068.html

(0)
上一篇 2022年5月25日
下一篇 2022年5月25日

相关推荐

发表回复

登录后才能评论