Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS :Not attribute [duplicate]

I have a few HTML tables. These tables do not have CSS classes. The two tables have width="100%" attribute. Other tables don't have the width attribute.

Using only CSS I need to set the width of the tables which don't have width=100%. Something like this:

table:not(width="100%"){     width: myValue; } 
like image 590
Sanya530 Avatar asked Jan 15 '13 14:01

Sanya530


People also ask

What is not() in CSS?

:not() The :not() CSS pseudo-class represents elements that do not match a list of selectors. Since it prevents specific items from being selected, it is known as the negation pseudo-class. /* Selects any element that is NOT a paragraph */ :not(p) { color: blue; }

How do you write not equal to in CSS?

The :not(selector) selector is used to style every element that is not specified by the selector. Since it prevents specific items from being selected, it is also known as the negation pseudo-class. Example: In this example, we have used the :not selector and paragraph element.

How not works in CSS?

The :not() property in CSS is a negation pseudo class and accepts a simple selector or a selector list as an argument. It matches an element that is not represented by the argument. The passed argument may not contain additional selectors or any pseudo-element selectors.

What is not in scss?

:not() Back :not() is a CSS negation pseudo-class selector. It is a functional pseudo-class selector that takes a simple selector as an argument, and then matches one or more elements that are not represented by the argument.


1 Answers

Attribute selectors are surrounded by [], so your selector should look like this instead:

table:not([width="100%"]) {     width: myValue; } 
like image 153
BoltClock Avatar answered Sep 27 '22 19:09

BoltClock