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

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

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

.button:hoverspan {
  padding-right: 25px;
}

.button:hoverspan:after {
  opacity: 1;
  right: 0;
}
</style></head><body><h2>Animated Button</h2><buttonclass="button"style="vertical-align:middle"><span>Hover </span></button></body></html>

Click:

<!DOCTYPE html><html><head><style>.button {
  display: inline-block;
  padding: 15px25px;
  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: 09px#999;
}

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

.button:active {
  background-color: #3e8e41;
  box-shadow: 05px#666;
  transform: translateY(4px);
}
</style></head><body><buttonclass="button">Click Me</button></body></html>

Fade in:

<!DOCTYPE html><html><head><style>.button {
  display: inline-block;
  padding: 15px25px;
  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: 09px#999;
}

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

.button:active {
  background-color: #3e8e41;
  box-shadow: 05px#666;
  transform: translateY(4px);
}
</style></head><body><buttonclass="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><buttonclass="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 3px3px3px0;
}

/*
    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;
}
<buttonid="one">1. Button</button><buttonid="two">2. Button</button><buttonid="three">3. Button</button><buttonid="four">4. Button</button><buttonid="five">5. Button</button><buttonid="six">6. Button</button><buttonid="seven">7.Button</button><buttonid="eight">8. Button</button><buttonid="nine">9. Button</button><buttonid="ten">10. Button</button>

Post a Comment for "Styling Buttons With Css"