在 :hover 上防止 CSS "bounce"
Prevent CSS "bounce" on :hover
我需要一些帮助来让过渡更顺畅:
http://codepen.io/abenjamin/pen/LVVpwX?editors=110
几个小时以来,我一直在进行调整和调整,但我调整得越多,我就越崩溃-_-
欢迎提出任何意见或建议!
html
<h1>Super Awesome CSS Menu</h1>
<div class="container">
<input type="checkbox" id="menu-toggle" name="menuToggle"/>
<label for="menu-toggle"><span><a href="#"><i class="fa fa-dribbble">
<figure>3</figure></i></a></span><span><a href="#"><i class="fa fa-facebook">
<figure>99+</figure></i></a></span><span><a href="#"><i class="fa fa-twitter">
<figure>3</figure></i></a></span>
<p>share</p>
</label>
</div>
css
@charset "UTF-8";
@import '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css';
body {
background: #3F7CAC;
text-align: center;
font-family: helvetica, arial, sans-serif;
padding: 50px;
}
h1 {
font-weight: 100;
text-transform: uppercase;
color: white;
font-size: 20px;
letter-spacing: 3px;
opacity: 0.1;
}
.container {
border: solid 10px rgba(255, 255, 255, 0.1);
display: block;
height: 400px;
width: 400px;
margin: 0 auto;
}
#menu-toggle {
display: none;
}
#menu-toggle + label {
margin-top: 50px;
display: inline-block;
text-align: center;
color: white;
padding: 0;
opacity: 0.7;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
}
#menu-toggle + label:hover {
cursor: pointer;
opacity: 1;
}
#menu-toggle + label span {
height: 10px;
width: 10px;
display: inline-block;
background: white;
border-radius: 50%;
}
#menu-toggle + label span + span {
margin-left: 5px;
}
#menu-toggle + label span a {
display: none;
text-align: center;
text-decoration: none;
color: #3F7CAC;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
}
#menu-toggle + label p {
text-transform: uppercase;
letter-spacing: 2px;
margin: 5px;
font-weight: 200;
font-size: 10px;
}
#menu-toggle:checked + label {
opacity: 1;
}
#menu-toggle:checked + label span {
height: 50px;
width: 50px;
padding: 3px;
text-align: center;
}
#menu-toggle:checked + label span a {
display: block;
opacity: 1;
line-height: 50px;
font-size: 20px;
border: 1px solid #3F7CAC;
border-radius: 50%;
height: 50px;
width: 50px;
box-sizing: border-box;
}
#menu-toggle:checked + label span a i {
margin-top: 14px;
box-sizing: border-box;
}
#menu-toggle:checked + label span a i figure {
box-sizing: border-box;
margin: 0 auto;
font-size: 11px;
width: 25px;
text-align: center;
height: 0px;
overflow: hidden;
}
#menu-toggle:checked + label span a:hover {
border: 1px solid rgba(224, 4, 130, 0.5);
color: #DE0482;
}
#menu-toggle:checked + label span a:hover > i {
margin-top: 7px;
}
#menu-toggle:checked + label span a:hover > i figure {
display: block;
margin-top: 2px;
height: 10px;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
}
#menu-toggle:checked + label p {
margin-top: 10px;
}
#menu-toggle:checked + label::before {
content: "✖";
display: block;
margin-bottom: 20px;
opacity: 0.5;
}
我不知道你到底想要什么,但我会试着猜一下。
如果您将此添加到您的抄送:
#menu-toggle + label span {
vertical-align: top;
}
是你想要的吗?
我需要一些帮助来让过渡更顺畅: http://codepen.io/abenjamin/pen/LVVpwX?editors=110
几个小时以来,我一直在进行调整和调整,但我调整得越多,我就越崩溃-_-
欢迎提出任何意见或建议!
html
<h1>Super Awesome CSS Menu</h1>
<div class="container">
<input type="checkbox" id="menu-toggle" name="menuToggle"/>
<label for="menu-toggle"><span><a href="#"><i class="fa fa-dribbble">
<figure>3</figure></i></a></span><span><a href="#"><i class="fa fa-facebook">
<figure>99+</figure></i></a></span><span><a href="#"><i class="fa fa-twitter">
<figure>3</figure></i></a></span>
<p>share</p>
</label>
</div>
css
@charset "UTF-8";
@import '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css';
body {
background: #3F7CAC;
text-align: center;
font-family: helvetica, arial, sans-serif;
padding: 50px;
}
h1 {
font-weight: 100;
text-transform: uppercase;
color: white;
font-size: 20px;
letter-spacing: 3px;
opacity: 0.1;
}
.container {
border: solid 10px rgba(255, 255, 255, 0.1);
display: block;
height: 400px;
width: 400px;
margin: 0 auto;
}
#menu-toggle {
display: none;
}
#menu-toggle + label {
margin-top: 50px;
display: inline-block;
text-align: center;
color: white;
padding: 0;
opacity: 0.7;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
}
#menu-toggle + label:hover {
cursor: pointer;
opacity: 1;
}
#menu-toggle + label span {
height: 10px;
width: 10px;
display: inline-block;
background: white;
border-radius: 50%;
}
#menu-toggle + label span + span {
margin-left: 5px;
}
#menu-toggle + label span a {
display: none;
text-align: center;
text-decoration: none;
color: #3F7CAC;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
}
#menu-toggle + label p {
text-transform: uppercase;
letter-spacing: 2px;
margin: 5px;
font-weight: 200;
font-size: 10px;
}
#menu-toggle:checked + label {
opacity: 1;
}
#menu-toggle:checked + label span {
height: 50px;
width: 50px;
padding: 3px;
text-align: center;
}
#menu-toggle:checked + label span a {
display: block;
opacity: 1;
line-height: 50px;
font-size: 20px;
border: 1px solid #3F7CAC;
border-radius: 50%;
height: 50px;
width: 50px;
box-sizing: border-box;
}
#menu-toggle:checked + label span a i {
margin-top: 14px;
box-sizing: border-box;
}
#menu-toggle:checked + label span a i figure {
box-sizing: border-box;
margin: 0 auto;
font-size: 11px;
width: 25px;
text-align: center;
height: 0px;
overflow: hidden;
}
#menu-toggle:checked + label span a:hover {
border: 1px solid rgba(224, 4, 130, 0.5);
color: #DE0482;
}
#menu-toggle:checked + label span a:hover > i {
margin-top: 7px;
}
#menu-toggle:checked + label span a:hover > i figure {
display: block;
margin-top: 2px;
height: 10px;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
}
#menu-toggle:checked + label p {
margin-top: 10px;
}
#menu-toggle:checked + label::before {
content: "✖";
display: block;
margin-bottom: 20px;
opacity: 0.5;
}
我不知道你到底想要什么,但我会试着猜一下。
如果您将此添加到您的抄送:
#menu-toggle + label span {
vertical-align: top;
}
是你想要的吗?