I'm working with bootstrap, but I wanted to change a few of the colors around (navbar and buttons). I have an un-modified bootstrap.css, and a custom.css that changes all of the properties that I want changed from the default.
In my index.html, I link the default bootstrap, and then the custom css file.
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="bootstrap/css/custom.css" rel="stylesheet" type="text/css"/>
I'm new to web stuff, but my understanding is that style sheets add to each other in the order they are linked. But when I open it in a browser, it doesn't use any of the changes specified in custom.css. Is my understanding wrong, or am I just going about this incorrectly?
Edits:
Original navbar-inner (bootstrap.css)
.navbar-inner {
min-height: 40px;
padding-right: 20px;
padding-left: 20px;
background-color: #fafafa; /* #fafafa */
background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2); /*#f2f2f2 */
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));
background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2);
background-image: -o-linear-gradient(top, #ffffff, #f2f2f2);
background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);
background-repeat: repeat-x;
border: 1px solid #d4d4d4;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);
*zoom: 1;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
}
navbar-inner with a few properties modified in custom.css
.navbar-inner {
background-image: -moz-linear-gradient(top, #002f6c, #002f64);
background-image: -ms-linear-gradient(top, #002f6c, #002f64);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#002f6c), to(#002f64));
background-image: -webkit-linear-gradient(top, #002f6c, #002f64);
background-image: -o-linear-gradient(top, #002f6c, #002f64);
background-image: linear-gradient(top, #002f6c, #002f64);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#'002f6c, endColorstr='#'002f64, GradientType=0);
}
HTML
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Test</a>
<ul class="nav pull-right">
<li class="pull-right">About</li>
<li class="pull-right">Contact</li>
</ul>
</div>
</div>
</div>
Do the first div classes also need to be changed? (They aren't)
I used this tool to generate the custom.css file.
Saying that CSS styles stack in the order they are applied isn't necessarily a correct one. CSS is applied in order of importance, or specificity.
For example, consider the following HTML:
<ul id="testList">
<li>Some data</li>
</ul>
If your first file has the CSS:
ul#testList { color: #f00; }
and your second file has:
ul { color: #00f; }
Then your first file has more specificity, even though the second file comes second in your markup. The first style is more precise in its declaration.
If however, you change your second style to have matching specificity, then your second declaration will override the first. Hope this helps!
Edit:
It turns out that the tool I used does not change every property required! It should have also changed the .navbar-inverse class. After applying changes there, it works as expected.
In other words, both files were linked correctly.
Thanks for the answers though! I certainly learned a few new things.
Related
How should I increase the size of icons(add,delete..) in jqgrid?I have written following code in ui.jqgrid.css
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon,
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-div span.ui-icon{float:left;margin: 2px; width:18px;}
.ui-jqgrid .ui-jqgrid-toppager {border-left: 0 none !important;border-right: 0 none !important; border-top: 0 none
!important; margin: 0 !important; padding: 0 !important; position: relative;white-space: nowrap;overflow: hidden;}
Free jqGrid supports vector based Font Awesome icons as alternative to raster icons of jQuery UI. To use Font Awesome you need just include the CSS of Font Awesome and to add iconSet: "fontAwesome" option. For example, https://jsfiddle.net/OlegKi/9f9exg91/1/ uses the following simple code
$("#grid1").jqGrid({
colModel: [...],
iconSet: "fontAwesome",
...
});
which displays
If you want for example increase the size of navigator icons in 1.5 of the standard size you can just add CSS rule
.navtable .ui-pg-button {
font-size: 150%;
}
and get the navigator buttons
see https://jsfiddle.net/OlegKi/9f9exg91/2/. You can see that the navigator buttons are wrapped automatically. See the wiki article.
If you want in increase the size of all the buttons of the pager then you can use CSS rule
.ui-pg-table .ui-pg-button {
font-size: 150%;
}
alternatives. See https://jsfiddle.net/OlegKi/9f9exg91/3/, which displays
Free jqGrid supports additionally iconsOverText: true option, which allows to get the following look of icons:
see https://jsfiddle.net/OlegKi/9f9exg91/4/
In general you can customize the buttons in easy way like you need. For example you can go to some button generator page like this one create custom button and to copy the CSS styles to .ui-jqgrid .navtable .ui-pg-button. I did this and created the next demo https://jsfiddle.net/OlegKi/9f9exg91/6/, which displays the following navigator bars:
Below you can find the CSS rules used in the last demo:
.ui-jqgrid .navtable .ui-pg-button:not(.ui-state-hover) {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 8;
-moz-border-radius: 8;
border-radius: 8px;
-webkit-box-shadow: 3px 3px 7px #666666;
-moz-box-shadow: 3px 3px 7px #666666;
box-shadow: 3px 3px 7px #666666;
color: #ffffff;
font-size: 14px;
padding: 6px 6px 6px 6px;
border: solid #0089de 1px;
text-decoration: none;
}
.ui-jqgrid .navtable .ui-pg-button.ui-state-hover,
.ui-jqgrid .navtable .ui-pg-button:hover{
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
padding: 6px 6px 6px 6px;
font-size: 14px;
text-decoration: none;
}
I used additional pagerRightWidth: 100 option in the last demo to fix the right part of the pager and to provide more place for the navigator icons.
UPDATED: One can use top pager by usage of toppager: true instead of pager: true or to use both pagers. If one would replace .navtable in the above CSS rules to .ui-pg-table then the style will be applied to all buttons of the pager: https://jsfiddle.net/OlegKi/9f9exg91/9/
Your query is missing some valid information but you can always use zoom in your CSS over proper selectors.
Another possible solution is to increase the font-size - see the classes
.ui-jqgrid .ui-jqgrid-view
and increase the font size you want.
Since you use Guriddo jqGrid 5.2.1 you can get quick and professional response in our public forum
In the following page:
I have a gray button (see the section with first book, it is the only gray button of the page) but it is expected to be a blue one. I cut&paste the code from a Mail service (see below).
The property:
background-color: #47abd5;
does not work. Why?
<style>
#mlb2-3734193 button.ml-subscribe-button {
cursor: pointer;
font-family: Open Sans!important;
font-size: 24px !important;
height: 60px;
width: 250px;
background-color: #47abd5;
color: #ffffff!important;
border: none;
border-radius: 2px;
padding: 0px 24px;
}
</style>
<link href="https://fonts.googleapis.com/css?family=Open+Sans& subset=latin,latin-ext" rel="stylesheet" type="text/css">
<form id="mlb2-3734193" action="//app.mailerlite.com/webforms/popup/z0d1n7" data-code="z0d1n7" data-id="243593" target="_blank">
<div stylclass="button-preview">
<button style="background-color: #47abd5;" type="submit" class="ml-subscribe-button">Iscriviti</button>
</div>
</form>
<script type="text/javascript" src="//static.mailerlite.com/js/w/button.min.js?veb3acdd46bf692c067c6a9fe9fbc07d6"></script>
Because of this css being applied to your button.
a.button,
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #dfdfdf), color-stop(1, #ffffff));
background: -ms-linear-gradient(bottom, #dfdfdf, #ffffff);
background: -moz-linear-gradient(center bottom, #dfdfdf 0%, #ffffff 100%);
background: -o-linear-gradient(#ffffff, #dfdfdf);
}
There is a background gradient which is overwriting your styles I suppose.
As #Turnip suggests change it to background instead of background-colour and it will work
remove background-color property just use background
like this:
#mlb2-3734193 button.ml-subscribe-button {
background: #47abd5;
}
You have to set the background-color property on the following class: .widget_circleicon-widget .circle-icon-box .circle-icon Then the background color of the book icon should change.
What I am trying to do is I want to keep the top 50% of the html button to have a gradient say from #FFF to #BBB and the bottom 50% should remain in one color lets say #111. I can't figure out a way to do it, any help would be largely appreciated.
The code of my button is:
<button class="Button1" type="submit">Submit</button>
The css:
.Button1 {
background-image: linear-gradient(to bottom, #fff 0%, #bbb 50%, #111 50%);
}
This should do the trick in latest browsers. It's up to you to make it cross-browser compatible. (I personally like the Photoshop-esque interface of http://www.colorzilla.com/gradient-editor/)
Here is a sample from Bootstrap that should help you out with button gradients. This also covers most modern browsers.
.btn-info {
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
background-color: #49afcd;
background-image: -moz-linear-gradient(top,#5bc0de,#2f96b4);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));
background-image: -webkit-linear-gradient(top,#5bc0de,#2f96b4);
background-image: -o-linear-gradient(top,#5bc0de,#2f96b4);
background-image: linear-gradient(to bottom,#5bc0de,#2f96b4);
background-repeat: repeat-x;
border-color: #2f96b4 #2f96b4 #1f6377;
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='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
Hope that helps.(these are sort of teal, so you'll have to change that part)
So I am trying to setup the fadeout css3 hr tag, it works on JSFiddle but I can't solve it on my site.
My CSS class on site:
.about-sidebar{
margin: 25px 0;
height: 1px;
background: black;
background: -webkit-gradient(linear, 0 0, 100% 0, from(#1F1F1F), to(#FFD700), color-stop(50%, black));
}
HTML:
<hr class="about-sidebar" />
I have tried taking the class out of the HR tag and surrounding it with a div but doesn't solve.
Site: http://travisingram.net/ it is the "Welcome to my Blog" on the sidebar.
Jsfiddle working:
http://jsfiddle.net/ZTz7Q/1633/
The reason it wasn't working on your website was because the <hr> didn't contain the class with the gradient styling. Currently, you just have <hr> which should be changed to <hr class="line"> or whatever class you're using.
Aside from that, the linear-gradients needs some tweaking and cross browser prefix vendors for more support.
jsFiddle example
I don't know what colors you want.. but here is black to transparent.
.line {
margin: 25px 0;
height: 5px;
background: black;
background: -moz-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.98) 2%, rgba(255,255,255,0) 90%);
background: -webkit-linear-gradient(left, rgba(0,0,0,1) 0%,rgba(0,0,0,0.98) 2%,rgba(255,255,255,0) 90%);
background: linear-gradient(to right, rgba(0,0,0,1) 0%,rgba(0,0,0,0.98) 2%,rgba(255,255,255,0) 90%);
}
As far as I am aware, IE9 should have CSS support for rounded corners. I have apparently coded my page in such a way as this does not occur in IE9 though - although it displays correctly in Chrome and FF.
*I have edited CSS to reflect suggestions as per answer below - the problem is still occurring *
I need top and bottom left corners only to be rounded for the div that contains the site main navigation.
The 'Activate Now' buttons are also not working, in the hosting package display boxes.
Site link to view is http://activehost.co.nz
I've checked other questions - and the most common cause (using prefixes) is not something I am doing.
Relevant CSS for sections is below.
Navigation:
#main_nav {
margin: 0px 0px 10px 0px;
float: right;
height: 37px;
/*background:url(../img/nav_bg.png);
background-repeat: repeat-x;*/
background-color: #286e38;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#6dc067), to(#286e38));
background-image: -moz-linear-gradient(top, #6dc067, #286e38);
background-image: -ms-linear-gradient(top, #6dc067, #286e38);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6dc067), color-stop(100%, #286e38));
background-image: -webkit-linear-gradient(top, #6dc067, #286e38);
background-image: -o-linear-gradient(top, #6dc067, #286e38);
background-image: linear-gradient(top, #6dc067, #286e38);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6dc067', endColorstr='#286e38', GradientType=0);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
border-radius: 20px 0px 0px 20px;
clear: right;
}
And the CSS for the 'Activate Now buttons:
.hosting_order {
position: absolute;
top: 148px;
border: none;
height: 35px !important;
background-color: #286e38;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#6dc067), to(#286e38));
background-image: -moz-linear-gradient(top, #6dc067, #286e38);
background-image: -ms-linear-gradient(top, #6dc067, #286e38);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6dc067), color-stop(100%, #286e38));
background-image: -webkit-linear-gradient(top, #6dc067, #286e38);
background-image: -o-linear-gradient(top, #6dc067, #286e38);
background-image: linear-gradient(top, #6dc067, #286e38);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6dc067', endColorstr='#286e38', GradientType=0);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
color: #ffffff;
width: 120px;
padding: 0px 20px;
font-weight: bolder;
font-size: 1.1em;
border-radius:20px;
box-shadow: 2px 2px #888888;
}
The background image CSS is to produce a gradient effect - I wonder if that's the problem?
It's because you combine filter and border-radius for same element. Try to apply border-radius to one element, and filter to its child element instead.
see this question regarding the meta tag and some other possible issues/process to eliminate: IE9 border-radius
For IE9, you are correct it doesn't like the border radius and the filter combined. Here is what I followed and it worked perfectly in IE9, as well as all the other browsers.
https://github.com/bfintal/jQuery.IE9Gradius.js
Hope that helps!
You only need to define one number for your border radius if you're using "bottom-left" and so on. By specifying two numbers IE9 may not interpret it correctly.
If you use the following, the first number is the top-left, second is top-right, third is bottom-right, and fourth is bottom-left.
-moz-border-radius: 8px 8px 0px 0px;
-webkit-border-radius: 8px 8px 0px 0px;
-0-border-radius: 8px 8px 0px 0px;
border-radius: 8px 8px 0px 0px;
Making the border radius compatible to IE browsers, follow these steps:
Open Setting option in IE.
Go to compatibility and view setting.
Uncheck "Display intranet sites in Compatibility view " as well as uncheck "Use microsoft compatibility list".