How to deselect with CSS?


Tags: css,css-selectors

Problem :

i would like to deselect and #id item from a selection without changing HTML or adding any classname,

lets say i want to emulate this Jquery sentence in CSS

 $('img').not('#thisone').CSS();

is it possible?



Solution :

Use CSS3's :not() selector (which has an equivalent jQuery selector):

img:not(#thisone) {
}

If you need better browser support, there's always the fact that ID selectors, being the most specific simple selectors, are good for overrides:

img {
    /* All images */
}

#thisone {
    /* Revert styles for this particular image */
}

    CSS Howto..

    CSS - How to set gradient color background for different heights

    How to reverse a jQuery animation back to original CSS properties

    How to get two column float left div layout to word wrap?

    How to justify 4 divs in one row [duplicate]

    How do i create a gem which will generate a css file from a template

    How to Programatically Toggle a Zurb Foundation Switch Control, in Chrome?

    How to expand link on hoover? Add “<” “>” symbols around link?

    How do I turn CSS into example HTML? Is there a shortcut to understanding affects of CSS on nested HTML tags?

    how to make div fixed at a particular scroll level

    How to delete first pseudo after

    Bootstrap 3 - How to change the hyperlink title text showing as tooltip using javascript/jquery?

    how to add a css class to a list when the particular li is clicked using jquery?

    How to make animation smooth

    How can I control the css of cloned
    with Javascript?

    How to fix animation problems css3

    how to get 2 div's text to align along the bottom?

    How to make flexbox grid images responsive

    How can I make use of `::selection` for in chrome browsers?

    how to change css content attribute of a list item

    How To Embed font-awesome CSS into DOM Scripting (javascript)?

    How to correct Div overlapping?

    How to position multiple elements on one line, if they are in an absolute element?

    How Do I Set the condition for a user to have to fill in a Textfield

    How to make responsive popup div?

    How to use animation with transform CSS

    How can I align a button at the bottom of a div?

    How can I properly add CSS and JavaScript to an HTML document?

    How do I create a cut-out hexagon shape?

    How can I change the style of thumbnails?

    how to give css only the 1st label span?