I want to use the display:none
property on all .gif
images (displayed using <img>
tags) on my website. Is there a CSS selector that can do that? Or is jQuery the best way to do this?
This doesn't work, but I'm looking for something like this:
img[gif] {
display:none;
}
I know it's a simple question; Google yielded no results.
Usage is simple — you insert the path to the image you want to include in your page inside the brackets of url() , for example: background-image: url('images/my-image. png'); Note about formatting: The quotes around the URL can be either single or double quotes, and they are optional.
Answer: Use the CSS background-image property You can simply use the CSS background-image property in combination with the :hover pseudo-class to replace or change the image on mouseover.
$('img[src*=". png"]').
A CSS selector is the first part of a CSS Rule. It is a pattern of elements and other terms that tell the browser which HTML elements should be selected to have the CSS property values inside the rule applied to them.
You can do:
img[src$=".gif"] {
display: none;
}
This looks at the end of the src
attribute for ".gif" on all <img>
elements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With