I'm looking for a way, using only modern css, to select all elements which have a background-image which utilizes any sort of gradient and then overwrite that value with 'none'. Essentially, I need to wipe out all background gradients. This is what I have so far but it doesn't seem to work:
*[background-image*="gradient"]{
background-image: none !important;
}
I'm starting to think that attempting something like this is not sane, but I'd like to know for sure. Is this even possible? If so, what am I doing wrong?
You cannot solve this problem using HTML and CSS.
You could use Javascript to check the background-image of every element in the DOM. With a huge DOM this can become slow, but seems like you have no other choice.
How about this method. you only have to add the class gradient for all those elements which are using gradient effect. I understand its a bit of work but it will solve your problem.
*[class*='gradient'] {
background-image: none;
}
Related
Hi please check the photo below, what im doing is i want to have a background image below the slider with the fix size
Css Code
.swiper-slider-bg {
background: url('http://localhost/wordpress/wp-content/uploads/2017/11/bg-08-1.png');
background-size: auto 100%;
}
Current code
What I need to have
Define it in pixels instead of percentage. Or, as a much flexible alternate, you may also use pseudo to achieve the same.
:before or :after selector shall be useful for you. I am hoping that you know how to use these selectors so not explaining that stuff.
I think this is you need to want, refer below links for your use, It will be use your full page image slider.
https://www.w3schools.com/w3css/tryit.asp? filename=tryw3css_slideshow_self
https://codepen.io/jibbon/pen/BoisC
I have a weird one that I can't seem to be able to figure out. I am new to CSS and decided to use bootstrap to assist with styles etc.
the problem I have is when I try to assign two classes to a div element, 1 being the bootstrap column and another from my own stylesheet.
the code from my stylesheet seems to be ignored in some cases. now i have taken that one bit of code and css out and put it into the jsfiddle but it works fine. its only when combined with the rest of the html does it seem to have issues. also note that if i use inline styles it works...
I copied the entire code to js fiddle now so that you guys can replicate the issue. the section I am having issues with is the 4 images that are side by side
class="services-boxes"
anyway any assistance will be appreciated, as well as general feedback as I am new to this all! :)
https://jsfiddle.net/d9bv0grx/1/
Due to the way cascading style sheets work it (styles are be applied in order AND by specificity). It is most likely that styles you are expecting to see are being overridden by specificity.
Give this guide a read.
An example is that for <div id="selector">
#selector {background-color:red;}
div {background-color:green;}
You can expect to see a div with a red background, even though the green background is set afterwards, the id selector has greater specificity.
Then try and alter the specificity of your selectors in your css so that they will take precedence over in bootstrap.
Also just going to add, you have casing issues - you declare the class with lowercase in css, capitalised in your html.
You also have syntax issues in your css. Your css should look like:
.services-boxes {
padding:0;
max-height:500px;
width:100%;
}
Sort all this and you should be golden! jsfiddle
Looks like a combination of syntax errors. Your style should be declared like this:
.services-boxes {
padding:0px;
max-height: 500PX;
width:100%;
}
Note that the class is all lowercase (which should match style where declared which is currently Services-Boxes), a colon separating property and value (you has used = in some instances) and one set of curly braces per declaration (the above class .logo-image has 2 closing braces). Just a bit of formatting should see your code recognised
When you don't have total control over your HTML, you can use the !important property in css to give a priority to your styles.
.services-boxes {
color: red !important;
}
However keep in mind that you have to avoid the !important property as much as possible and do not use it unless you can't do it any other way.
I have a css homework to copy exactly a web site. I've done about 80% of my work but there're still some elements in the original website that i can't bring to my copy, for example, these separators:
I've tried some ways on the Internet but none of them seems to work with my current situation.
This is my work until now: https://dl.dropboxusercontent.com/u/178536659/xin/index.html.
Besides that, my teacher provided us some resources (included logos, images etc... to make a copy of the website). It includes some transparent-only horizontal rectangle images. I dont' know what it is used for ... Is it use for make these separators, i guess ?
So I hope you guys could help me with this ... any comments would be appreciated. Thanks so much in advanced !
They are simple borders, such as
ul#nav_menu li {
border-right: 1px solid #cecece;
}
Now remove the border of the first child from the element using some class or id and setting no border to it! Simple.
There are many ways to create vertical separators, the most common border-left/border-right or pseudo elements :before and :after, horizontal separators are made with <hr> tag.
Borders documentation:
http://www.w3schools.com/css/css_border.asp
Here are some good examples with pseudo-elements (which you can use with your images):
http://krasimirtsonev.com/blog/article/CSS-before-and-after-pseudo-elements-in-practice
You can also create divs, give them css properties to emulate a separator and place them in between or use images.
Use this in your CSS. I think it will work for you.
#header ul li{border-right:2px solid #d8d8d8;}#header ul li:last-child{border:none;}
I would like to add some right-positioned borders to my menu.
But the ones that I can use by default are not working for me. Can anyone recommend where to get a bit better looking borders, and how i add them in the css?
the css style you need :
#mymenu
{
border-right:solid 50px red;
}
You could try using jQuery (its more shape than actual border)
There's also a set of jQuery plugins to use on top of that.
Finally, there are some nice and easy css3 border properties that you could use.
I hope this helps.
I want the "tr" that's currently hovered over to change color, and then change back when the mouse is no longer over it. Is this possible using pure CSS, or is javascript the only solution? (I currently have a javascript solution, so I don't need examples of that)
Thanks!
Yes, this is possible in CSS. The example below will have a red background normally, and a green background when the row is hovered over.
tr td { background: #f00; }
tr:hover td { background: #0f0; }
However, it should be noted that this will not work in IE6, as it does not understand the ":hover" pseudo class on any elements other than <a>.
I believe that javascript is the only solution that will provide cross-browser support.
I think you can use :hover css attribute.