CSS3 – Background shift button

The 3rd example by is a background shift effect. This effect manipulate the background-position attribute.
Again, thanks Joshua Johnson for his great examples.
Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners

You can use the following image bkg-1.jpg as the button background.
bkg-1

Complete example.

<!DOCTYPE html>
<html>
<head>
  <meta charset=utf-8 />
  <title>Design Shack Button Examples by Joshua Johnson</title>
  <style media='screen' type='text/css'>
  a.buttonText {
    color: white;
    text-decoration: none;
    font: 18px/1.5 Helvetica,Arial,sans-serif;
  }

  #button3 {
    /* Basic CSS */
    background: transparent url('bkg-1.jpg');
    background-position: 0 0;
    text-shadow: 0px 2px 0px rgba(0, 0, 0, 0.3);
    font-size: 22px;
    height: 58px;
    width: 155px;
    margin: 50px 0 0 50px;
    overflow: hidden;
    display: block;
    text-align: center;
    line-height: 58px;
    
    /* Rounded Corners */
    -webkit-border-radius: 5px; /* Chrome & Safari */
    -moz-border-radius: 5px;    /* Firefox */
    -khtml-border-radius: 5px;  /* Linux browsers */
    border-radius: 5px;         /* CSS3 */
    
    /* Shadow */
    -webkit-box-shadow: 0px 3px 1px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: 0px 3px 1px rgba(0, 0, 0, 0.2);
    box-shadow: 0px 3px 1px rgba(0, 0, 0, 0.2);
    
    /* Transition */
    -webkit-transition: All 0.8s ease;
    -moz-transition: All 0.8s ease;
    -o-transition: All 0.8s ease;
    -ms-transition: All 0.8s ease;
    transition: All 0.8s ease;
  }

  #button3:hover {
    background-position: 0 150px;
  }
  </style>
</head> 
<body>
  <p>Tutorial by Joshua Johnson. <a href='http://designshack.net/articles/css/four-simple-and-fun-css-button-hover-effects-for-beginners/'>View original example</a></p>
  <a href='#' id='button3' class='buttonText'>Sign Up Now</a>     
</body>
</html>

 

Done =)

Next:

Reference: Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners

Advertisement

3 thoughts on “CSS3 – Background shift button”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.