CSS issue with default button - css

How do I change link and background colours of a.btn.btn-default / btn.btn-default? I can’t find these in any CSS.
See here: https://www.webhosters.co.za/client/whois . There are two buttons at the bottom of the 404 error page. These buttons (home page and contact support) are in white text and white background. they are only visible when one hover over. How do I change the background and text?

Here is the small css snippet you can go through
section#main-body a.btn {
color: #fff;
background-color: #6aaf08;
border: 1px solid #6aaf08;
}
We are here inheriting button class Hope this helps
Happy coding!!

You can give class to that buttons and apply css on that like change in btn background and color
.contact-btn, homepage-btn{
background-color: #6aaf08 !important;
color: #fff !important;
}
or
you can add more parents to .btn-default so your css will be applied first and will be replace .btn-default property
#main-body .btn.btn-default {
background-color: #6aaf08;
color: #fff;
}
/* ------------------ or ------------ /*
if you don't want to add parents class in css you need to give important to that css property..
.btn.btn-default {
background-color: #6aaf08 !important;
color: #fff !important;
}

Great place for styling links is here
so, basically you would be looking for something like:
/* unvisited link */
a:link {
color: red;
background-color: white
}
/* visited link */
a:visited {
color: green;
background-color: white
}
/* mouse over link */
a:hover {
color: hotpink;
background-color: white
}
/* selected link */
a:active {
color: blue;
background-color: white
}

Related

how can i change the text-color of the last button in my mobile view menu?

I am using wordpress publisher template.
The color of the mobile menu should be #051039 except the last one which is like the button, my problem is the background color of button is same #051039, so I want to change it to white.
I try to solve this problem by adding extra css code to the id of the link:
#menu-item-430 {
text-align: center;
border-radius: 5px;
background-color: #051039;
color: #fff !important;
}
but nothing happened. How can I fix it?
This is my site:
https://ijimfang.com
Use this style
.rh-cover .rh-c-m .resp-menu li:last-child > a { color: #fff !important; }
You can try this code. Please add this code to style.css file of your currently activated theme.
#media only screen and (max-width: 600px) {
ul#resp-navigation li:last-child{
text-align: right;
border-radius: 5px;
background-color: #ffffff;
border: 1px solid #051039;
}
ul#resp-navigation li:last-child a{
color: #fff !important
}
}

Not able to style the ui-sref-active when its a parent of ui-sref

I have been working on a simle angular navigation app.
I have gone through the ui-sref-active and ui-sref concepts. According to my understanding the ui-sref-active can be styled if ui-sref assigned to a element has ui-sref-active assigned to its parent element. I have tried a plunker here :
http://plnkr.co/edit/EhOxCw8EeQhS5uTCQBR0?p=preview
Referring to the above link, I want to achieve the following :
When i hover,focus or click on any of those tabs(li tag / parent tag). The background color of the tab, the icon and text color should change. When hovered or focused the changes are working fine. But when i select the tab, the changes are not reflected (I want to highlight the active tab with a change in background color and styling the icon and text). How shall i make this work.
I want a less code instead of css. This is the code i could come up with.It works for hover and focus. Does not work for the selected tab or active tab that is selected. Please help
li {
padding: 28px 5px 8px 0px;
background: yellow
.fa {
font-size: 35px;
color: blue
}
p {
font-size: 18px;
color: blue
}
a {
text-decoration: none;
}
&:hover,
&:focus,
&:active {
background-color: green;
.fa {
color: #fff;
}
p {
color: #fff;
}
a {
text-decoration: none;
}
}
}

:hover an element with :active css loses the css

I have the following CSS:
.point.active,
.point:active {
color: #fff;
background-color: #31b0d5;
border-color: #269abc;
}
Example: http://jsfiddle.net/7zmjvaxL/
This is working. But when the element is active and I hover over it, it loses the CSS colors. How I can keep the color if the element is active and if I hover over it?
Thanks.
Bootstrap comes with a number of default settings for certain elements.
In your case it is forcing this rule:
.btn-default.active:hover {
color: #333;
background-color: #d4d4d4;
border-color: #8c8c8c;
}
Which is overriding your own rule set.
The best bet is to remove the class btn-default, because its not really a default button, its a customised one, and then add CSS rules for your element.
For example, this jsfiddle demo:
.btn-point {
color: #333;
background-color: #fff;
border-color: #ccc;
}
Try this :
.point.active,
.point:active,
.point:active:hover{
color: #fff;
background-color: #31b0d5;
border-color: #269abc;
}
Do you have .point:hover{} somewhere ?

How to reset background color of ::selection

/* Site */
::-webkit-selection {
background-color: #highlightBackground;
color: #highlightColor;
}
::-moz-selection {
background-color: #highlightBackground;
color: #highlightColor;
}
::selection {
background-color: #highlightBackground;
color: #highlightColor;
}
I am using semantic-ui as css framework, and I have been overriding its values today. I came across with selection option, which is overridden by default, and I would like to set it as computer default. As some of you know, you can change selection color in macbooks, so I would like my users to use computer's default selection color.
So, what should I do? I tried inherit and transparent but they don't work.
The solution is to use the system color highlight for the background and highlighttext for the foreground.
Colors like inherit won't work, because inherit means "use the same color as the parent element". That's not what we want!
The first example sets the selection colors to yellow on brown, to emulate the framework theme. Just to make sure changing those colors works at all.
/* colours from theme */
::-webkit-selection {
background-color: brown; color: yellow;
}
::-moz-selection {
background-color: brown; color: yellow;
}
::selection {
background-color: brown; color: yellow;
}
<div>This is a div in which you can make a selection</div>
Then we'll add the colors highlight and highlighttext to the end of the css (emulating our custom stylesheet) to show that the selection color is back to the default.
/* colours from theme */
::-webkit-selection {
background-color: brown; color: yellow;
}
::-moz-selection {
background-color: brown; color: yellow;
}
::selection {
background-color: brown; color: yellow;
}
/* overriding colors */
::-webkit-selection {
background-color: highlight; color: highlighttext;
}
::-moz-selection {
background-color: highlight; color: highlighttext;
}
::selection {
background-color: highlight; color: highlighttext;
}
<div>This is a div in which you can make a selection</div>
Disclaimer: these system colors are officially deprecated; there is no proper replacement yet though. Also, in Chrome it seems to reset the colors to slightly different ones than they have in the absence of any styles; I seem to have to do some more research.

bootstrap button on click showing default colour

I am trying to style the button colour with below code, the colours work until I click the button, the button shows the default colours, how do I specify the colours of the button onclick?
.btn-success {
color: #ffffff;
background-color: #161617;
border-color: #494F57;
}
.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-success.active,
.open .dropdown-toggle.btn-success {
color: #ffffff;
background-color: #1F2838;
border-color: #494F57;
}
.btn-success:active,
.btn-success.active,
.open .dropdown-toggle.btn-success {
background-image: none;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #161617;
border-color: #494F57;
}
.btn-success .badge {
color: #161617;
background-color: #ffffff;
}
The :active selector is what you need for the click.
.btn-sample:active {
// click styles here
}
It looks like you have that above so if you are still seeing a slightly different color it is most likely because of the box-shadow that is also applied to the active button state. Disable that like so:
.btn-sample:active {
box-shadow: none;
}
Edit:
The selector that is overriding your css is actually btn-success:active:focus. So you will need to add the following to your css:
.btn-success:active:focus {
color: #ffffff;
background-color: #161617;
border-color: #494F57;
}
Further to my comment below, you would be better off creating your own class such as btn-custom to which you can apply your desired styles. Combining this with the existing btn class, you can achieve your desired result with much less code as you won't need to override existing selectors.
You have to use the !important declaration to do that correcly.
.btn-success:hover, .btn-success:active, .btn-success:focus {
color: #ffffff !important;
background-color: #1F2838 !important;
border-color: #494F57 !important;
}
I fixed this behaviour with this css code:
.btn-primary {
background-color: #8ed3cc;
border: 0 !important;
padding: 1rem 5rem;
border-radius: 0;
font-family: 'Lato', sans-serif;
font-size: 1.2rem;
box-shadow: none !important;
}
.btn-primary:hover {
background-color: #69aca5 !important;
border: 0 !important;
box-shadow: none !important;
}
.btn-primary:focus {
background-color: #69aca5 !important;
border: 0 !important;
box-shadow: none !important;
}
Some inspiration from the bootstrap source for overriding these various button states where $off-white and $brand-black are defined by us:
.btn-success {
&:hover,
&:focus,
&.focus {
color: $off-white;
background-color: $brand-black;
}
&:active,
&.active,
&.disabled,
&:disabled {
color: $off-white;
background-color: $brand-black;
&:focus,
&.focus {
color: $off-white;
background-color: $brand-black;
}
}
}
That button press animation of the default color is due to the background image. Use this for each named style (btn-default, btn-success, etc):
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
background-image: none;
}
Just add the following code in your CSS
.btn-success.active.focus, .btn-success.active:focus, .btn-success.active:hover, .btn-success:active.focus, .btn-success:active:focus, .btn-success:active:hover, .open>.dropdown-toggle.btn-success.focus, .open>.dropdown-toggle.btn-success:focus, .open>.dropdown-toggle.btn-success:hover
{
color: #fff;
background-color: #161617;
border-color: #494F57;
}
If you are working on a personal project, and not with a team, it is worth noting that you can override pseudo class styles simply by applying "!important" to the same style declarations on the class:
.btn-success {
color: #ffffff !important;
background-color: #161617 !important;
border-color: #494F57 !important;
}
Generally, it's a good idea to stay away from !important because this will override any and all color, background-color and border-color style declarations on the btn-success class (unless you override the style declarations again with !important later in your style sheet although that's ridiculous).
If the goal is the smallest file size possible though and you are using this class everywhere in the same way - meaning no inline styles - then this may be your best option.
Alternatively, but using the same thinking, you may try naming a new custom class something like .btn-success-important, and only apply it after btn-success where you need to use the override.
There is one catch though: If you are combining .btn-success or your .btn-success-important with any other Bootstrap .btn-group, !important will override any pseudo class style declared within. In this case you may be better off with Guy's answer (the custom class without !important style declarations).
if you want remove the box-shadow just add box-shadown:none and make it important or if you want add box-shadows just add color values.
.btn-primary:not(:disabled):not(.disabled):active{
color: #fff;
background-color: #5b5fc6;
border-color: #5b5fc6;
box-shadow: none !important;
}
or
.btn-primary:not(:disabled):not(.disabled):active{
color: #fff;
background-color: #5b5fc6;
border-color: #5b5fc6;
box-shadow: 0 0 0 0.2rem #c9cbfa !important
}
to trigger any class whenever a button is clicked, you need :active selector and to fix the default behavior of the bootstrap button on click, you need to set the background-color to any color you want to along with !important. It will then override the default styling of the bootstrap class.
.btn-outline-primary:active{ background-color: [your color] !important}

Resources