左から: 左から始まり、左へ消える
中央から: 中央から始まり、中央へ消える
右から: 右から始まり、右へ消える
左から右へ: 左から始まり、右へ消える
<content> <p class="left">左から: <a href="#">左から始まり、左へ消える</a></p> <p class="middle">中央から: <a href="#">中央から始まり、中央へ消える</a></p> <p class="right">右から: <a href="#">右から始まり、右へ消える</a></p> <p class="pass">左から右へ: <a href="#">左から始まり、右へ消える</a></p> </content>
content {
color: #000;
font-size: 21pt;
font-family: sans-serif;
background: #efefef;
margin: 0px auto;
display: block;
width: 756px;
border:2px solid #ddd;
text-align: center;
padding: 20px;
font-weight: 300;
position: absolute;
top: 62%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
a {
font-weight: 400;
color: #0af;
padding-botom: 5px;
}
a:hover {
color: #e30;
}
.middle a {
text-decoration: none;
position: relative;
transition: all 0.6s;
}
.middle a:before {
content: "";
width: 0;
height: 0.08em;
position: absolute;
bottom: 0;
left: 50%;
background: #0af;
transition: all 0.3s;
}
.middle a:hover:before {
width: 100%;
left: 0;
background: #f50;
}
.left a {
text-decoration: none;
font-size: 1em;
position: relative;
transition: all 0.6s;
}
.left a:before {
content: "";
width: 0;
height: 0.1em;
position: absolute;
bottom: 0;
left: 0;
background: #0af;
transition: all 0.3s;
}
.left a:hover:before {
width: 100%;
left: 0;
background: #f50;
}
.right a {
text-decoration: none;
font-size: 1em;
position: relative;
transition: all 0.6s;
}
.right a:before {
content: "";
width: 0;
height: 0.1em;
position: absolute;
bottom: 0;
left: 100%;
background: #0af;
transition: all 0.3s;
}
.right a:hover:before {
width: 100%;
left: 0;
background: #f50;
}
.pass a {
text-decoration: none;
font-size: 1em;
position: relative;
transition: all 0.6s;
}
.pass a:before {
content: "";
width: 0;
height: 0.08em;
position: absolute;
bottom: 0;
right: 0;
background: #0af;
transition: all 0.3s;
}
.pass a:hover:before {
width: 100%;
left: 0;
background: #f50;
}