Adding custom class based on Bootstrap CSS 2.3.2 - css

I've included Bootstrap CSS, and now want to add a custom class in my own CSS file.
It is simply an exact copy of .btn-success with modified colors and class name only:
.btn-mine {
color: #ffffff;
background-color: #ff8d53;
border-color: #ef8343;
}
.btn-mine:hover,
.btn-mine:focus,
.btn-mine:active,
.btn-mine.active,
.open .dropdown-toggle.btn-mine {
color: #ffffff;
background-color: #ea793e;
border-color: #dc5930;
}
.btn-mine:active,
.btn-mine.active,
.open .dropdown-toggle.btn-mine {
background-image: none;
}
.btn-mine.disabled,
.btn-mine[disabled],
fieldset[disabled] .btn-mine,
.btn-mine.disabled:hover,
.btn-mine[disabled]:hover,
fieldset[disabled] .btn-mine:hover,
.btn-mine.disabled:focus,
.btn-mine[disabled]:focus,
fieldset[disabled] .btn-mine:focus,
.btn-mine.disabled:active,
.btn-mine[disabled]:active,
fieldset[disabled] .btn-mine:active,
.btn-mine.disabled.active,
.btn-mine[disabled].active,
fieldset[disabled] .btn-mine.active {
background-color: #ff8d53;
border-color: #ff6314;
}
.btn-mine .caret {
border-top-color: #fff;
}
.dropup .btn-mine .caret {
border-bottom-color: #fff;
}
Unfortunately, this does not work, as shown here: http://jsfiddle.net/qG2n6/.
I know there are many 3rd-party Bootstrap button makers which can create buttons of any colors.
But I am more interested in knowing why my approach above does not work.
I copy all the styles that contains .btn-success in the original Bootstrap CSS, and only modify the colors and the class name, and I expected it to work.
What am I missing here?

.btn-success contains
.btn-success {
background-color: #5BB75B;
background-image: linear-gradient(to bottom, #62C462, #51A351);
background-repeat: repeat-x;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
color: #FFFFFF;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
While your class contains just some border and background color

You will need to override the background-image as well. That is where the slight gradient of the buttons in Bootstrap 2.3.2 comes from. See here:
.btn-mine {
color: #ffffff;
background-image: none;
background-color: #ff8d53;
border-color: #ef8343;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}
http://jsfiddle.net/qG2n6/1/
If you add background-image: none;, add the IE filter and alter the text shadow you will get your button. However, if you want a gradient to match the style of your version of Bootstrap you will need you own CSS gradient. You can use this tool to make one of your own:
http://www.colorzilla.com/gradient-editor/
Which might look something like this:
.btn-mine {
color: #ffffff;
border-color: #dc5930;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
background: #ff8d53;
background: -moz-linear-gradient(top, #ff8d53 0%, #ff732d 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff8d53), color-stop(100%,#ff732d));
background: -webkit-linear-gradient(top, #ff8d53 0%,#ff732d 100%);
background: -o-linear-gradient(top, #ff8d53 0%,#ff732d 100%);
background: -ms-linear-gradient(top, #ff8d53 0%,#ff732d 100%);
background: linear-gradient(to bottom, #ff8d53 0%,#ff732d 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff8d53', endColorstr='#ff732d',GradientType=0 );
background-repeat: repeat-x;
}
http://jsfiddle.net/qG2n6/3/

Related

blogger "dynamic views" header css

As you can see the header for my blog https://blog.cryformeqq.icu currently has drop shadow for the title, plus there's this weird gradient on top of the background color (which is supposed to be the same as the lighter grey under the navigation bar)
Anyone have any ideas? I tried a bunch of stuff I found online, none if it worked though.
Get rid of this style to get rid of the gradient: #header .header-bar { background-image: -moz-linear-gradient( center top, rgba(255, 255, 255, 0.1), rgba(100, 100, 100, 0.05) ); background-image: -webkit-gradient( linear, left top, left bottom, from(rgba(255, 255, 255, 0.3)), to(rgba(255, 255, 255, 0.05)) );.
Delete #header .header-bar .title h1 { text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.3); } to get rid of the text shadow.
Or overwrite with header .header-bar .title h1 { text-shadow: none; } and #header .header-bar { background-image: none; }

Select background white/transparent - Chrome OSx

For the life of me I can't remove the background/box shadow on a select box in Chrome on OSx. I need it to be flat white like the other inputs. Take a look here:
http://index1.staging.homeflow.co.uk/pdrum/register.html
Some code in use that isn't doing the job:
background: #ffffff;
background: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#ffffff));
background: -moz-linear-gradient(top, white, white);
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0px, rgba(255, 255, 255, 1) 0px);
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
Try:
select{
-webkit-appearance: none;
box-shadow: none !important;
}
:-webkit-autofill { color: #fff !important; }
You may also want to use:
select:focus { outline: none; }
Setting -webkit-appearance: inherit; on #pd-signin select removed it for me.
Then it seems you would need to add some arrow to indicate it is a drop-down.
Also in regards to SW4's comment:
I would not remove the outline on any focussed element as this is poor for accessibility.
Also refer to this article from Chris Coyier
Dropdown default styling - Chris Coyier
Firefox
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: '';
From this answer

How to add new property within existing css?

I have two css file.I have a class following in one css below
input[type="submit"], input[type="button"], .butLink {
padding: 3px 9px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3);
-webkit-box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3);
box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3);
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 12px;
font-weight: bold;
cursor: pointer;
color: #FFFFFF;
background: #A5BD24;
background: -moz-linear-gradient(top, #A5BD24 0%, #7DAC38 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#A5BD24), color-stop(100%,#7DAC38));
background: -webkit-linear-gradient(top, #A5BD24 0%,#7DAC38 100%);
background: -o-linear-gradient(top, #A5BD24 0%,#7DAC38 100%);
background: -ms-linear-gradient(top, #A5BD24 0%,#7DAC38 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a5bd24', endColorstr='#7DAC38',GradientType=0 );
background: linear-gradient(top, #A5BD24 0%,#7DAC38 100%);
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
border: 1px solid #781;
}
Now I want to change this style from another css file.I tried following below which isnt working -
input[type="submit"], input[type="button"], .butLink
{
background-color:#000 !important;
}
Any Idea?
Writing background will override previously defined properties.
Write:
input[type="submit"], input[type="button"], .butLink{
background:#000;
}
Try using the background rule instead of background-color, and make sure that your stylesheets are in the correct order in the <head> of your HTML. If they are in the correct order, the rule should not need the !important.
You can do it easily.
Option one: If you apply this css rule for the particular page so use internal css .Add this rule within the header tag like this
<style>
input[type="submit"], input[type="button"], .butLink
{
background-color:#000 !important;
}
</style>
It will perfectly works because internal css overwrite the external css rule.
Option two: If you apply this css rule for the all pages so use external css .Add this rule after the last css property:value;like this
color: #FFFFFF;
background: #A5BD24;
background:#000;/* This will overwrite with the previous background property value #A5BD24;
Hope the answer!

Overriding Twitter Bootstrap styles - Performance?

I'm developing a website using the Twitter Bootstrap CSS framework. Rather than host the (significantly sized) file and Font Awesome myself, I plan to use the Bootstrap CDN by NetDNA instead to get both, Bootstrap's CSS as well as Font Awesome.
However, some of the button styles in Bootstrap do not appeal to me, and I've decided to override them in a custom stylesheet.
I've already read this question about overriding CSS styles involving images, but does the same apply for background gradients and other assortments? (which make my (quite old) computer groan if used too much, leading me to believe they do put some strain on the computer)
For example, one of bootstrap's style rules is as follows:
.btn-primary {
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
background-color: #006dcc;
*background-color: #0044cc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
background-repeat: repeat-x;
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
which I'm tentatively overriding with:
.btn-primary {
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
background-image: none;
background-color: #057CB8;
border: none;
border-radius: 4px;
}
Will the earlier (possibly CPU intensive) properties be loaded anyway?
The browser starts reading the html from the top, and starts fetching all CSS. The page will not be painted until all the CSS has been downloaded.
The bootstrap CSS will get loaded, but it won't be painted.

What is the purpose of noise images blended into a CSS button?

I noticed that the buttons on unfuddle.com use a layer of noise, i was just wondering what the purpose of this is, i can't visibly notice the difference, but perhaps this is some cross browser hack?
It seems silly to build such an awesome CSS3 button that uses no images only to still load a noise image anyway.
Here is their CSS that goes with the buttons in question, note the gnoise.png?cbv-1346878364
.gp_button, a.gp_button, input.gp_button:not([type="radio"]) {
background-color: #C0EB00;
background-image: radial-gradient(at center center , #7EBD00 20%, #77B300 80%), url("/images/gnoise.png?cbv=1346878364");
border-color: #7FBF00;
border-radius: 4px 4px 4px 4px;
border-style: solid;
border-width: 1px;
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
color: #FFFFFF;
display: inline-block;
font-family: "Lato","Arial",sans-serif;
font-size: 20px;
font-weight: 700;
letter-spacing: 1px;
line-height: 34px;
margin-right: 1px;
padding: 0 1em;
text-decoration: none;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}
.gp_button:hover, a.gp_button:hover, input.gp_button:hover:not([type="radio"]) {
background-color: #A5C416;
background-image: radial-gradient(at center center , #85C700 20%, #7EBD00 80%), url("/images/gnoise.png?cbv=1346878364");
border-color: #7FBF00;
}
.gp_button:visited, a.gp_button:visited, input.gp_button:visited:not([type="radio"]) {
background-color: #C0EB00;
background-image: radial-gradient(at center center , #7EBD00 20%, #77B300 80%), url("/images/gnoise.png?cbv=1346878364");
border-color: #7FBF00;
}
.gp_button:active, a.gp_button:active, input.gp_button:active:not([type="radio"]) {
background-color: #C0EB00;
background-image: radial-gradient(at center center , #7EBD00 20%, #77B300 80%), url("/images/gnoise.png?cbv=1346878364");
border-color: #90D900;
box-shadow: 0 0 0 rgba(0, 0, 0, 0.1);
}
.oldie .gp_button, .oldie a.gp_button, .oldie input.gp_button:not([type="radio"]) {
background-color: #7EBD00;
border-color: #7FBF00;
border-radius: 4px 4px 4px 4px;
border-style: solid;
border-width: 1px;
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
color: #FFFFFF;
display: inline-block;
font-family: "Lato","Arial",sans-serif;
font-size: 20px;
font-weight: 700;
letter-spacing: 1px;
line-height: 34px;
margin-right: 1px;
padding: 0 1em;
text-decoration: none;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}
.oldie .gp_button:hover, .oldie a.gp_button:hover, .oldie input.gp_button:hover:not([type="radio"]) {
background-color: #85C700;
}
.oldie .gp_button:visited, .oldie a.gp_button:visited, .oldie input.gp_button:visited:not([type="radio"]) {
background-color: #7EBD00;
}
.oldie .gp_button:active, .oldie a.gp_button:active, .oldie input.gp_button:active:not([type="radio"]) {
background-color: #7EBD00;
border-color: #90D900;
}
gnoise.png goes on top of the background-color (along with the radial gradient) to add some visual complexity to an otherwise flat image. The effect is barely visible on a.gp_button, but you can see it if you zoom in on a screenshot using Photoshop, or use the eyedropper to compare pixel colors. The effect is more visible on the <footer> element, because of its darker background color.
By re-using one image on top of solid colors, they get a variety of colors while avoiding multiple HTTP requests which might slow down page loading.
It's just a guess, but the get parameter (?cbv=1346878364) could be used to ensure that, after an update to the image files, a new image file is actually pulled from the server instead of using a browser-cached version.
My guess is that it could have been there for browsers that don't support CSS3. However when I inspect the button in chrome it is overwritten by another image, which makes me believe that is not the case.
If it is not there for older browsers then chances are it is just a coding error. maybe they used it at some point and forgot to take it out.
But to answer your question. It isn't used for anything because it is been overwritten by this image. And if you are looking to replicate what they are doing then I would just remove it.
background-image: -webkit-radial-gradient(center center, #7ebd00 20%,#77b300 80%),url('/images/gnoise.png?cbv=1346878364');

Resources