I just leanred CSS and try to doing some tutorials.
I have a button with this CSS
.btn {
padding: 9px 25px;
border-radius: 5px;
margin-left: 24px;
cursor: pointer;
}
.btn-sign-up {
font-size: 14px;
border-color: rgba(238, 67, 116, 1);
}
I just want button just change the color, and remove the border while i hover it.
But the result is just like this:
image of the result
I've googled it, but got stuck because the result i got just another tutorial how to make my button move, not to make it doesn't move.
Sorry for my bad english. Thanks in advance!
Edit: After i try to make another button, this is because of border: none; that makes my button move slightly. Is it any other way to make border away but the button doesn't move?
this is happening because you are removing the border. Instead of removing it, make it the same color as the background.
.button {
border: 1px solid red;
}
.button:hover {
background: red;
border-color: red;
}
Or, if you want the border to really disappear, use transparent:
.button:hover {
background: red;
border-color: transparent;
}
see below code, on .btn:hover you can write your css
.btn:hover {
background-color: red;
color: #fff;
}
.btn {
padding: 9px 25px;
border-radius: 5px;
margin-left: 24px;
cursor: pointer;
display: inline-block;
background-color: #fff;
border: 1px solid red;
}
.btn:hover {
background-color: red;
color: #fff;
}
.btn-sign-up {
font-size: 14px;
border-color: rgba(238, 67, 116, 1);
}
<div class="btn">one</div>
<div class="btn">two</div>
Related
How to add border bottom on hover effect as in this image
Add :hover for your button like this:
button {
width: 300px;
height: 60px;
border-radius: 10px;
background-color: #d94346;
border: none;
color: white;
font-weight: bold;
font-size: 1.3rem;
}
/* Add hover effect */
button:hover {
border-bottom: #bb262a 6px solid;
}
<button>Hover</button>
Is this result what you were expecting for ?
A box-shadowwould be more appropriate in my opinion.
EDIT: Comparing to the other answers I see, this way the button text won't move. 2 options.
button {
font-size: 30px;
padding: 30px 250px;
color: white;
background-color: #d84446;
border: none;
border-radius: 15px;
}
button:hover {
box-shadow: 0px 7px 0px #bb262a;
cursor: pointer;
}
<button>Hover</button>
you should do it in the other order
button:hover {
border-bottom: 4px solid #bb262a;
}
I was messing around in HTML when I saw this small bug
I made this button using SCSS and gave it a border radius of 5px. If you're able to notice, there's a small curve where the border raidus is supposed to be.
Close up:
Why is this happening?
Code
/* Button.scss file */
#import "../../util/variables";
button {
background-color: white;
color: black;
outline: none;
border: 1px currentColor solid;
padding: 0.3rem 0.85rem;
border-radius: $border-radius;
&:hover {
cursor: pointer;
}
&.primary {
background-color: $primary;
color: $primary-text;
}
&.secondary {
background-color: $secondary;
color: $secondary-text;
}
&.block {
display: block;
width: 100%;
margin-bottom: 0.5rem;
}
}
<!-- HTML -->
<button
class="button"
>
Login
</button>
EDIT:
$primary is #283593
I use firefox
button {
background-color: white;
color: black;
outline: none;
border: 1px currentColor solid;
padding: 0.3rem 0.85rem;
border-radius: 5px;
}
button:hover {
cursor: pointer;
}
button.primary {
background-color: #283593;
color: white;
}
button.block {
display: block;
width: 100%;
margin-bottom: 0.5rem;
}
<button class="button primary">Login</button>
This is an artifact caused by the imprecision of fractional numbers used in the rendering. You can expect it to vary depending on browser, and perhaps even GPU and rendering mode.
See also: Is floating point math broken?
I'm trying to style this button so that the text is white, with a white border like the other social media buttons. The code I used for all these buttons is identical and the button has the desired properties when I preview the HTML , but for some reason when I upload the file and visit the site (josholadunni.com) the button for LinkedIn is purple and doesn't have a border. Any help would be much appreciated!
.fa {
padding: 10px;
font-size: 30px;
width: 50px;
text-align: center;
text-decoration: none;
}
.fa:hover {
opacity: 0.7;
}
.fa-facebook {
background: transparent;
color: white;
border-color: white;
border-style: solid;
}
.fa-linkedin {
background: transparent;
color: white;
border-color: white;
border-style: solid;
}
.fa-instagram {
background: transparent;
color: white;
border-color: white;
border-style: solid;
}
<div id="socialmedia">
</div>
Links have a psuedo-element called :visited that applies some default styles after you've visited the URL they point to. You should apply your styles not only to .fa, but also to .fa:visited to get the result you want.
I am creating a touch device application. I have to create a Login button as shown in the image
I have created the remaining part myself . I am not able to create the LOGIN button style
Here is is an example. You can easily modify the css to your need :
.btn-login {
padding: 10px 30px;
color: #333;
border: 1px solid #333;
background: #fff;
border-radius: 20px;
transition: all ease-in-out 0.3s;
}
.btn-login:hover {
border-color: #fff;
background: #666;
color: #fff;
}
<p><a class="btn-login">LOGIN</a></p>
I also added some hover effects to it. Here's the CSS for this Button,
.log-in {
text-transform: uppercase;
padding: 10px;
width: 100px;
height: 40px;
color: #888;
border: 1px solid #888;
background: #fff;
border-radius: 30px;
line-height: 20px;
transition: all ease-in-out 0.3s;
}
.log-in:hover {
background: #4f8be1;
color: #fff;
border-color: #fff;
}
Hope this will work for you, Here's Code on codepen.io
See the Pen CSS Simple, Clean login button by vaibhav kubre (#vkubre) on CodePen.
my friends, i guess you may looking something like those:
// demos:
http://codepen.io/mehmetmert/pen/RNoJmj
http://codepen.io/clein/pen/xnmKL
http://codepen.io/andytran/pen/GpyKLM
I have two buttons, that I would like to have one on top, and one on the button of each other, how ever when I went to see how they looked, both buttons were inside of each other, I Cant seem to find the issue, but here's my code.
CSS
body { font-size: 16px; width: 600px; margin: 25px auto; }
button {
color:white;
display: inline;
margin: 30px;
padding: 7px 35px;
font: 300 150% langdon;
background: transparent;
border: 3px solid black;
cursor: pointer;
}
button:hover {
background: #f7f7f7;
border: 1px solid #8b8b8b;
}
button:active {
background: #2e2e2e;
border: 1px solid black;
color: white;
}
Currently the buttons show side by side: see this fiddle.
If you want the next button on a new line, then use display:block see this fiddle.