Aaron Benjamin
Aaron Benjamin

Reputation: 1389

Prevent CSS "bounce" on :hover

I need some help making transitions a little smoother: http://codepen.io/abenjamin/pen/LVVpwX?editors=110

I've been making tweaks and adjustment for a few hours, but the more I tweak, the more I break -_-

Any suggestions or recommendations are welcome!

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;
}

Upvotes: 0

Views: 1191

Answers (1)

Alvaro Men&#233;ndez
Alvaro Men&#233;ndez

Reputation: 9032

I don't know exactly what you want but I will try to guess it.

if you add this to your ccs:

#menu-toggle + label span {
  vertical-align: top;
}

is it what you want?

Upvotes: 2

Related Questions