I have the following selector in a Wordpress CSS theme that I've been advised not to edit by the theme creators:
.entry img, img.thumbnail {
margin-bottom: 10px;
padding: 2px;
border: 1px solid #DDD;
background: white;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
So I added this in an auxiliary CSS to attempt to 'cancel' out the above CSS selector's effects:
.entry img, img.thumbnail {
margin-bottom: 0px;
padding: 0px;
border: 0px;
background: #fff;
-moz-box-shadow: 0;
-webkit-box-shadow: 0;
box-shadow: 0;
}
However, it doesn't seem to change anything. I'm not sure what I need to edit in the above snippet.
The border I'm trying to get rid of does disappear when I manually uncheck the following options in Google Chromes inspector:
-moz-box-shadow
-webkit-box-shadow
box-shadow
I !important to every CSS Rule or you can add wraper div and use it in css.
Like
HTML
<div id="wraper_div">
<div class="your_class"></div>
</div>
CSS:
#wraper_div .your_class{
/*CSS PROPERTY*/
}
If you inspect the element in for instance Chrome, does your rule apply after the default one?
If so, you could try adding !important to it to override.
.entry img, img.thumbnail {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
1st
Shadows should be set to none
2.
background should be reset without short hand because IE has problems with resetting by shorthand
try
background-color:#fff
instead of
background:#fff
3.
There is something called "specifity".
Youre code has the same specifity as the code it overrides, so it needs to be below the code it overrides, or have higher specifity.
Try target the code with one more selector:
.entry img, img.thumbnail
Higher specifity:
body .entry img, body img.thumbnail
Specifity means "authority" of a css rule. Different selectors have different "weight".
IDs have a weight of 100, classes 10, element selectors 1.
.entry img, img.thumbnail
Has 11 for the first statement and 10 for the second. Add body in front of both to give them +1 specifity, so they override the old code.
5.
If you care to support older IEs, loose the img.thumbnail, it can cause problems in IE, replace with .thumbnail only. You may do this if there are no other elements with the class .thumbnail then img elements.
Hope that helps.
Using none instead 0 fixes the issue. Order of CSS styles also matters, make sure to put these styles at the bottom of your CSS.
Working DEMO
.entry img, img.thumbnail {
margin-bottom: 0px;
padding: 0px;
border: 0px;
background: #fff;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
Related
Hey is it possible to make scrollbar "hidden" i dont wanna use overflow-y: hidden
just something like background: transparent or something like that
Here you will find a description how to hide the scrollbar just with CSS.
And here in the second example you will find a solution how to hide the scrollbar within a div for example.
The trick in the second example is to define a wider div container that the surrounding one.
.hidden-scrollbar .inner {
height:200px;
overflow:auto;
margin:15px -300px 15px 15px;
padding-right:300px;
}
Just play arround with the values of margin and padding.
There is a CSS rule that can hide scrollbars in Webkit-based browsers (Chrome and Safari). That rule is:
.element::-webkit-scrollbar { width: 0 !important }
u can change width / background-color and other properties .
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0);
}
this css code might work
In Webkit browsers:
::-webkit-scrollbar {
display: none;
}
So, my website has a header and a div containing Revolution Slider immediately after it. I'm trying to add a box-shadow below the header - and above the slider. But it doesn't work, unless I also add margin-bottom to the header - but that renders the whole exercise moot.
This is the code:
#header {
display:block;
min-height: 99px;
background: #FFFFFF;
border-top: 3px solid #8dddcd;
border-bottom: 1px solid #ecf0f1;
line-height: 99px;
box-shadow: 0 10px 10px 10px rgba(0,0,0,0.3);
}
#rev {
position: relative;
}
<div id="header"></div>
<div id="rev">the slider</div>
Could someone help me figure out what's causing this?
See the following questions:
Does css border-shadow add to an element's size
Is css box-shadow part of element's box model?
According to the box-shadow spec:
An outer box-shadow casts a shadow as if the border-box of the element were opaque. The shadow is drawn outside the border edge only
So if you don't want overlap, you'll have to add the margin youself
#header {
box-shadow: 5px 5px 5px 5px rgba(0,0,0,0.3);
margin-bottom: 10px;
}
#slider {
position: relative;
}
<div id="header">Header</div>
<div id="slider">Slider</div>
Actually, the issue turned out to be related to z-index properties of the different divs. With some tweaking I managed to get it all sorted out without using any margin.
Anyway, thank you all for your time and help!
If you need as you say the box-shadow below the header only and above the slider you can use minus in the last number in box shadow as the following:
box-shadow: 0 10px 10px -10px rgba(0,0,0,0.3);
This will make the box-shadow appear only at the bottom.
Working example:
#header {
display:block;
min-height: 99px;
background: #FFFFFF;
border-top: 3px solid #8dddcd;
border-bottom: 1px solid #ecf0f1;
line-height: 99px;
box-shadow: 0 10px 10px -10px rgba(0,0,0,0.3);
}
#rev {
position: relative;
}
<div id="header"></div>
<div id="rev">the slider</div>
When you use the default rendering mode for box-shadow(outer shadow), you need to add a margin in that direction(10px on y-axis in your example) so the overflowed box content will be visible.
If you want to display your box shadow inside the header, just add the keyword inset to your declaration.
I have a problem with the CSS precedence of an input box. A width of 96% is being applied while according to precedence rules an auto width should be applied. If I apply !important, the style I want is applied. However this is not how I would like to solve the problem.
I have an input box implemented in this way
<fieldset>
<label>Search</label>
<input type="text" class="standard-size"> <!-- Referring to this -->
</fieldset>
And impacted by these 2 CSS declarations:
fieldset input[type=text] {
width: 96%;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #BBBBBB;
height: 20px;
color: #666666;
-webkit-box-shadow: inset 0 2px 2px #ccc, 0 1px 0 #fff;
-moz-box-shadow: inset 0 2px 2px #ccc, 0 1px 0 #fff;
box-shadow: inset 0 2px 2px #ccc, 0 1px 0 #fff;
padding-left: 10px;
background-position: 10px 6px;
margin: 0;
display: block;
float: left;
margin: 0 10px;
}
.standard-size {
width: auto ;
}
According to this link:
http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
precedence works this way
(Inline Style , ID, Class, Element). A number on the left precedes any number on the right.
In my case:
fieldset input[type=text] translates to (0,0,0,2) because fieldset and input are 2 elements
AND
.standard-size translates to (0,0,1,0) because .standard-size is one CSS class
(0,0,1,0) should take precedence over (0,0,0,2) because the 1 is simply more to the left than the 2 and that makes it more important. So why is the width of 96% taking over?
Thank you
You forgot to count the [type=text] attribute selector, which is equivalent to a class selector (also mentioned in the article you linked to):
fieldset input[type=text] /* 1 attribute, 2 types -> specificity = (0, 0, 1, 2) */
.standard-size /* 1 class -> specificity = (0, 0, 1, 0) */
While an attribute selector and a class selector are equivalent, it's the two type selectors in your first rule that cause it to outweigh the second.
Because [type=text] is an attribute, it adds (0,0,1,0) (source). So your first set of rules actually has specificity (0,0,1,2), which is greater than (0,0,1,0).
I am requested to make the following design:
Here's how I'm trying to achieve the cascaded shadow:
box-shadow: -6px 0px 10px #514E49
But it results in the shadow being displayed in the opposite direction:
I tried changing the h-shadow parameter to 6px, but then the shadow is only visible in the rightmost edge.
I tried using inset as Emil suggested, but it causes the v-shadow to display inset as well and becomes visible inside the box, which should be avoided, here is what it looks like:
try this:
box-shadow:inset 6px 0px 10px #514E49;
edit:
box-shadow: 6px 0px 10px #514E49;
float:right;
http://jsfiddle.net/6V7Et/4/
you have to reverse the order of the menu
Another way to avoid float:right and reversing the menu is by using a negative spread and increased h-shadow like this:
.box {
background: #817E77;
display: inline-block;
width: 100px;
height: 40px;
box-shadow: inset 10px 0px 10px -4px #514E49;
float:left;
}
jsFiddle result
I believe this will best be tackled with z-index since your problem is the other divs are hiding the previously rendered ones.
so:
.box {
....your stuff here....
float:right
}
http://jsfiddle.net/XKNn4/
Another solution, one that doesn't involve reversing the order of the menu or using z-index would be to put the box-shadow on a pseudo-element.
demo
Relevant CSS:
li {
overflow: hidden;
position: relative;
box-shadow: 6px 0px 10px #514E49;
/* the other styles */
}
li:not(:first-child):after {
position: absolute;
right: 100%; width: 100%; height: 100%;
box-shadow: 6px 0px 10px #514E49;
content: '';
}
I have a site I'm working on using the Sinatra framework and I've uploaded it to Heroku. On Firefox, I'm able to see the page and all of it's contents but on Chrome the color for all text, borders, etc. is white. Why is it doing this and how do I fix it? Note that I'm also using Zurb foundation for the HTML framework and Sinatra for the backend.
Below is my CSS page.
/* LAYOUT */
/*========*/
.the-page {
-webkit-box-shadow: 4px 2px rgba(0,0,0,.1), -4px 0 2px rgba(0,0,0,.1);
-moz-box-shadow: 4px 0 2px rgba(0,0,0,.1), -4px 0 2px rgba(0,0,0,.1);
box-shadow: 4px 0 2px rgba(0,0,0,.1), -4px 0 2px rgba(0,0,0,.1);
}
/* MISC */
/*======*/
.center {text-align: center;}
.brown {color: #653000;}
.green {color: #003218;}
a{color: #653000;}
a:hover {color: #003218;}
.size20 { font-size: 20px;}
/* Prevent MOZ border outline */
:focus {outline:none;}
::-moz-focus-inner {border:0;}
/* FOOTER */
/* ====== */
html, body {
height: 100%;
color: #653000;
}
.body-wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -65px;
}
.footer, .push {
height: 65px;
}
.footer {
color: black;
}
I've tested with Chrome 24 here and looked at the applied CSS rules in the Developer Tools. By removing the row class from the <html> tag, I was able to see your website in Chrome.
The following rule appears to be the source of at least some of your trouble.
.row:before,.row:after{content:" ";display:table}
Chrome doesn't like the display:table rule applied to the <html> tag at all.