Cannot remove CSS style from element - css

I'm having trouble removing a shadow being applied to an element.
HTML of element in question
<form class="block" method="post" action="poll.php?do=pollvote&pollid=80">
I've already changed the form class to something else.
CSS of questionable shadow
#sidebar_container .block {
border: 1px solid #BFBFBF;
box-shadow: 0 0 4px 0 #888888;
padding: 6px;
Now the issue with this is, the way Vbulletin has everything worked out is that the same style applies to a ton of elements.. So simply changing it ruins quite a bit of other customizations.
I dont understand why simply changing the "form class" is not working... Checking in firebug, it still holds the regular form class regardless of what changes I make in the template.
For reference: http://www.eldersreach.com/forum.php?styleid=90
It is the Inner box shadow on the "Poll" element in the right corner of the container

This CSS
#sidebar_container .block {
padding: 6px;
border: 1px solid #bfbfbf;
box-shadow: 0px 0 4px 0 #888;
}
is applied to the <div class="block smaller">...</div> container. Not the <form class="block"...</form> element.
If you want to remove the box-shadow property from the container you need to put box-shadow: none; in the #sidebar_container .block {...} style definition block. Off course this will remove the box-shadow from all the <div>s with the class .block.
My suggestion would be:
Add one more class, e.g. <div class="block smaller noshadow">...</div> to the element of choice
Define one more CSS property after #sidebar_container .block {...} in your stylesheet, e.g.
#sidebar_container .block {...}
#sidebar_container .noshadow {
box-shadow: none;
}
That should do the job.

Related

How to change a button from curved corner to sharp?

I need to change a button on my website's homepage from a curved edge to sharp.
It is a WordPress website and I am trying to add this code via Additional CSS window.
I tried to perform the below code, but it did not work.
wobble-horizontal.shop-button.arrow-right.style2.black.bg-white
{
border:3px solid #bada55;
}
Any suggestion on how to make the button sharp-edged?
Edit: I have just realised I haven't mentioned "a" class at the beginning. It should be a.wobble. Sorry for the confusion.
Assuming that's just a div, it's as simple as setting the border-radius to 0px
Also, the library you're using could be high up in specificity, so you can also try border-radius: 0px !important; to try and force it.
Based on your border: 3px solid #bada55 line, I think you may have the wrong selector as that should be setting the border of that button a lime green and not gray.
#sharp {
border-radius: 0px;
}
#not-sharp {
border-radius: 10px;
}
div { background: red; margin: 10px; }
<div id="sharp">My Sharp Button</div>
<div id="not-sharp">My Not Sharp Button</div>
There seems to be another CSS script that is manipulating the border-radius property.
To have sharp borders, use:
border-radius: 0;
The code you were using just sets the border's thickness (3px), style (solid fill), and color(#bada55), not the radius.
If this does not do it, try tracing down what other CSS script is manipulating the border radius, or just use the !important directive to override:
border-radius: 0 !important;
border-radius: 0;
or border-radius: 0 !important; if your CSS is being overridden.
Setting border-radius to 0px should give you straight edges on the button

Box-shadow and border styles conflicting in Wordpress CSS

I'm having trouble applying an outline and drop shadow to some images in a Wordpress widget.
The '2017' theme adds some related rules which conflict with mine and cause the image to appear with a white vertical line in place of the border, which appears to crop the right of the image, as well as the top and bottom border and drop shadow. If I remove these rules in the Chrome DevTools the problem is fixed.
I can't simply remove those rules from the theme as I'm doing this as part of a plugin which users will add to their own sites, so I'd like to update my css to fix the problem without modifying the underlying theme.
Is there a way to do this?
The css in the theme (that I can delete in Chrome DevTools to fix) is:
/* Fixes linked images */
.entry-content a img,
.widget a img {
-webkit-box-shadow: 0 0 0 8px #fff;
box-shadow: 0 0 0 8px #fff;
}
I'm trying to override this in the plugin style sheet with:
.entry-content a img,
.widget a img {
-webkit-box-shadow: none;
box-shadow: none;
}
and adding this as inline CSS to the 'img' tag:
style="border:3px solid orange; box-shadow: 0px 2px 4px 1px #333; -webkit-box-shadow: 0px 2px 4px 1px #333;"
I've also tried adding this inline CSS to the 'a' tag which encloses the images:
style="-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;"
This has no effect however.
Can anyone help, please?
The rules of CSS (Cascading style sheets) are as follows:
a more specifically defined rule will override a general one (e.g. a rule specified for div.entry-content will override a rule specified for .entry-content)
the last declaration overrides all the others (e.g. an inline style in the style attribute will override something declared in the external style sheet) - use this rule sparingly as it gets confusing
adding !important to your property will override other declarations - use this rule sparingly as it gets confusing
so the answer is either:
div.entry-content a img,
div.widget a img {
-webkit-box-shadow: none;
box-shadow: none;
}
OR:
.entry-content a img,
.widget a img {
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
Thanks for the help!
It turned out though that the CSS in the theme was being applied to an image next to the one I was trying to apply the border and shadow to, so I had to override the CSS in that image, in addition to the one I was trying to modify.
So I had to apply this to the other image as well as retaining it in the 'a' tags:
style="-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;"

Optional bottom border on a div

I have two HTML samples... Basically there is always a name div in the info div but the total number of could be more.
1)
<div class="person">
<div class="info">
<div class="name">Isabelle of_Bavaria</div>
</div>
</div>
2)
<div class="person">
<div class="info">
<div class="name">King of France Charles_V the_Wise</div>
<div class="title"><label>Title:</label>King of France</div>
<div class="date"><label>Birth:</label>Jan 21st, 1337</div>
<div class="date"><label>Death:</label>Sep 16th, 1380</div>
</div>
</div>
I'm using this bit of CSS to add a line under the name as well as a box around the person div.
.person .name
{
position: relative;
text-align: center;
border-bottom: 1px dotted black;
}
.person
{
position: relative;
width: 250px;
height: auto;
border: 1px solid black;
margin-top: 5px;
padding: 5px;
}
Is there anything I can do with the css to prevent the name from having a border in sample 1 while leaving it in sample 2 without the need for additional classes or divs?
Try adding this piece of CSS at the top of your .person .name entry
.person .name:only-of-type
{
border-bottom: 0px transparent;
}
This piece of CSS means that if there is only one of the element type using the .name class in .person (in this example it's a div), it will not have a bottom border. You have to put it before the .person .name in order to overwrite it.
EDIT :
After thinking about it a bit more, i think the pseudo class :only-child would be better suited for your needs instead of :only-of-type since it will only apply if the .name is the only child of .person. So here's the updated CSS
.person .name:only-child
{
border-bottom: 0px transparent;
}
Something logically like this?
.person > .info[having more than one div child] > .name
{
border-bottom: ...
}
sadly, i don't think there's a [...] selector quite like that, however, there are "adjacent sibling selectors" ( http://www.w3.org/TR/CSS2/selector.html#adjacent-selectors )
Maybe as #PhilPerry has suggested, you could change the concept to being "put a top-border on the div immediately following the first-child (or name)", like so:
.name:first-child + div
{
border-top: ...
}

CSS background-color applies to active state, but not normal state

I have added a button styling to a div. The background-color does not apply to the normal state. However, as soon as I click down on the button and turn it into an active state, the background-color applies correctly. I cannot figure out why the background-color only appears in one stage and not the other. I have resorted to using !important to make it work. Below is the CSS:
.statusbutton {
-moz-box-shadow:inset 0 1px 0 0 #ffffff;
-webkit-box-shadow:inset 0 1px 0 0 #ffffff;
box-shadow:inset 0 1px 0 0 #ffffff;
height:43px;
width:40px;
border:1px solid #ccc;
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:2px;
display:inline-block;
background-color:#fbfbfb !important;
}
.statusbutton:active {
position:relative;
background-color:#fbfbfb;
top:1px;
}
EDIT: I realized the issue came from a later part of my stylesheet:
.red {
background:url(status-red.png) no-repeat center center;
}
I applied .red to the button afterwards, which caused the background image to override the background-color. The code below ended up fixing the issue:
.red {
background:url(status-red.png) no-repeat center center;
background-color:#fbfbfb;
}
Using !important is usually a bad idea. Is this your entire css file or is there more? There may be another css style with higher priority that is overriding your attempts to set the background color here. I would suggest setting up a jsfiddle if you're still having trouble
If you want this code works, you have to remove the !important from your CSS code otherwise this rule will take priority on the :active state, and remember to change the colors in both states (actually you use #fbfbfb for both normal and active state).

Styling 2 divs with css on focus or hover of an input

I have a html sturcture like that:
<form class="form">
<div class="row">
<input id="search" class="search-input" type="text" placeholder="Search">
<div class="input-icon" data-icon="s"></div>
<div class="triangle-left"></div>
</div>
</form>
and the following css code witch is important to know:
input[type="text"]:focus, input[type="text"]:hover, input[type="password"]:focus, input[type="password"]:hover {
border:1px solid #ffa800;
box-shadow: 0 0 5px #ffa800, 0 4px 4px rgba(0,0,0,.1) inset;
-moz-box-shadow: 0 0 5px #ffa800, 0 4px 4px rgba(0,0,0,.1) inset;
-webkit-box-shadow: 0 0 5px #ffa800, 0 4px 4px rgba(0,0,0,.1) inset;
}
input[type="text"]:focus + .input-icon:before, input[type="text"]:hover + .input-icon:before, input[type="password"]:focus + .input-icon:before, input[type="password"]:hover + .input-icon:before{
color:#ffa800;
border-color: #ffa800;
}
input[type="text"]:focus .triangle-left, input[type="text"]:hover .triangle-left, input[type="password"]:focus .triangle-left, input[type="password"]:hover .triangle-left{
border-color:transparent transparent transparent #ffa800;
}
The first code works great if i hover or focus the input the div with class input-icon get a new color and border-color. My question is can i also make changes in the second div (.triangle-left) ? i have tried it but i doesn't work. only first div is effected. if i change the div so first triangle-left than the css code works.
Do you know a way to do this or is the only possibility to use a small jquery script?
Thanks for your help:)
Regards
Crazymodder
As a quick edit:
http://jsfiddle.net/xngbv/
The problem is that you didn't actually have anything setting .triangle-left to use the styles you wanted for hover and focus. .triangle-left is a div, not any kind of an input, so the styles you had set in your last block, where you used .triangle-left, had no effect
Edit: the changes I made that affected the rendering are using
.triangle-left:focus, .triangle-left:hover
instead of
input[type="text"]:focus .triangle-left, input[type="text"]:hover .triangle-left
because the way you had it, the style applies to an input with type text when focused/hovered, that also has style triangle-left. Since the only element with class triange-left was a div, no elements were affected. What you want is to apply the style directly to the element that actually does have triangle-left set. If you didn't want to go by just the classname, you could use div.triangle-left:focus or something similar.

Resources