Skip to content Skip to sidebar Skip to footer

Styling Buttons With Css

I've styled buttons to look like hyperlinks so i can use request.post instead of querystring. The only problem is that when selecting certain characters it is a bit difficult as th

Solution 1:

Try using display:block; and setting a width.

Alternatively, you could increase the padding, which is set at 0px.


Solution 2:

Here are some button styles HTML+CSS (no syling needed):

Hover:

<!DOCTYPE html>
<html>
<head>
<style>
.button {
  display: inline-block;
  border-radius: 4px;
  background-color: #f4511e;
  border: none;
  color: #FFFFFF;
  text-align: center;
  font-size: 28px;
  padding: 20px;
  width: 200px;
  transition: all 0.5s;
  cursor: pointer;
  margin: 5px;
}

.button span {
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: 0.5s;
}

.button span:after {
  content: '\00bb';
  position: absolute;
  opacity: 0;
  top: 0;
  right: -20px;
  transition: 0.5s;
}

.button:hover span {
  padding-right: 25px;
}

.button:hover span:after {
  opacity: 1;
  right: 0;
}
</style>
</head>
<body>

<h2>Animated Button</h2>

<button class="button" style="vertical-align:middle"><span>Hover </span></button>

</body>
</html>

Click:

<!DOCTYPE html>
<html>
<head>
<style>
.button {
  display: inline-block;
  padding: 15px 25px;
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  outline: none;
  color: #fff;
  background-color: #4CAF50;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
}

.button:hover {background-color: #3e8e41}

.button:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}
</style>
</head>
<body>


<button class="button">Click Me</button>

</body>
</html>

Fade in:

<!DOCTYPE html>
<html>
<head>
<style>
.button {
  display: inline-block;
  padding: 15px 25px;
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  outline: none;
  color: #fff;
  background-color: #4CAF50;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
}

.button:hover {background-color: #3e8e41}

.button:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}
</style>
</head>
<body>


<button class="button">Click Me</button>

</body>
</html>

Ripple:

<!DOCTYPE html>
<html>
<head>
<style>
.button {
    position: relative;
    background-color: #4CAF50;
    border: none;
    font-size: 28px;
    color: #FFFFFF;
    padding: 20px;
    width: 200px;
    text-align: center;
    -webkit-transition-duration: 0.4s; /* Safari */
    transition-duration: 0.4s;
    text-decoration: none;
    overflow: hidden;
    cursor: pointer;
}

.button:after {
    content: "";
    background: #f1f1f1;
    display: block;
    position: absolute;
    padding-top: 300%;
    padding-left: 350%;
    margin-left: -20px !important;
    margin-top: -120%;
    opacity: 0;
    transition: all 0.8s
}

.button:active:after {
    padding: 0;
    margin: 0;
    opacity: 1;
    transition: 0s
}
</style>
</head>
<body>


<button class="button">Click Me</button>

</body>
</html>

Hope this helps.


Solution 3:

Use this :D

Here an easy way to create some buttons. Run code snippet:

button {
  font-size: 150%;
  margin-right: 50px;
  margin-bottom: 50px;
  padding: 10px;
  border-radius: 10px;
  background-color: transparent;
  font-weight: lighter;
  transition: all 0.3s;
  box-shadow: silver 3px 3px 3px 0;
}

/*
    Button number "one"
*/

#one {
  color: #00d5ff;
  border: 1px solid #00d5ff;
}

#one:hover {
  color: white;
  background-color: #00d5ff;
}

/*
    Button number "two"
*/

#two {
  color: #b50000;
  border: 1px solid #b50000;
}

#two:hover {
  color: white;
  background-color: #b50000;
}

/*
    Button number "three"
*/

#three {
  color: #00ff2f;
  border: 1px solid #00ff2f;
}

#three:hover {
  color: white;
  background-color: #00ff2f;
}

/*
    Button number "four"
*/

#four {
  color: #2f00ff;
  border: 1px solid #2f00ff;
}

#four:hover {
  color: white;
  background-color: #2f00ff;
}

/*
    Button number "five"
*/

#five {
  color: #ff00bb;
  border: 1px solid #ff00bb;
}

#five:hover {
  color: white;
  background-color: #ff00bb;
}

/*
    Button number "six"
*/

#six {
  color: #ff0000;
  border: 1px solid #ff0000;
}

#six:hover {
  color: white;
  background-color: #ff0000;
}

/*
    Button number "seven"
*/

#seven {
  color: #ff8c00;
  border: 1px solid #ff8c00;
}

#seven:hover {
  color: white;
  background-color: #ff8c00;
}

/*
    Button number "eight"
*/

#eight {
  color: #ffee00;
  border: 1px solid #ffee00;
}

#eight:hover {
  color: white;
  background-color: #ffee00;
}

/*
    Button number "nine"
*/

#nine {
  color: #26ff00;
  border: 1px solid #26ff00;
}

#nine:hover {
  color: white;
  background-color: #26ff00;
}

/*
    Button number "ten"
*/

#ten {
  color: #00a2ff;
  border: 1px solid #00a2ff;
}

#ten:hover {
  color: white;
  background-color: #00a2ff;
}
<button id="one">1. Button</button>
<button id="two">2. Button</button>
<button id="three">3. Button</button>
<button id="four">4. Button</button>
<button id="five">5. Button</button>
<button id="six">6. Button</button>
<button id="seven">7.Button</button>
<button id="eight">8. Button</button>
<button id="nine">9. Button</button>
<button id="ten">10. Button</button> 

Post a Comment for "Styling Buttons With Css"