Linked Questions
39 questions linked to/from Can I write a CSS selector selecting elements NOT having a certain class or attribute?
401
votes
3
answers
213k
views
CSS selector to match an element without attribute x [duplicate]
I'm working on a CSS file and find the need to style text input boxes, however, I'm running into problems. I need a simple declaration that matches all these elements:
<input />
<input type='...
60
votes
4
answers
65k
views
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 ...
2
votes
4
answers
8k
views
Is it possible to define in CSS NOT to apply style if element have certain class? [duplicate]
I have an application where styles are defined as
select {
border: 1px solid #6FA7D1;
outline:0;
height:25px;
padding-left: 5px;
font-family:Arial;
font-size:12px;
...
2
votes
2
answers
798
views
How to get all elements on a page except div's [duplicate]
So I'm trying to apply some css to every element on a page, but I don't want the css to apply to div's. I am currently using document.getElementsByTagName("*") to select every element, but ...
0
votes
2
answers
2k
views
Don't add the css to the link with the active class [duplicate]
is there a way in CSS that you wouldn't add the css to the li?
So here's my example html
<li class="nav-item">
<a class="nav-link active" id="components-tab" data-toggle="tab" href=...
1
vote
1
answer
343
views
How to apply css on a div that has no class or id? [duplicate]
I have two div and I want to apply some css on the first div that has no class or id .How can I do it ??
Html:
<div>some content</div>
<div class="text-1">
0
votes
1
answer
701
views
Apply CSS rules only if set classes are present, and not others [duplicate]
I need the rules to apply to this element:
<div class="a b"/>
And not this one:
<div class="a b c"/>
0
votes
2
answers
569
views
How to add style the elements in a div when the div doesnt have some class using css? [duplicate]
i want to add some style to the div elements when the div is not of some class
What i am trying to do?
i have a div with class "card". i have other elements in the div like footer, a tag and h4.
now ...
-2
votes
2
answers
190
views
What is the usage of the pseudo class :not()? [duplicate]
I saw this pseudo class :not() being used in a source code of a Youtube video page, searching in the MDN I saw this article explaining the pseudo class, but I couldn't understand why (and in which ...
-1
votes
1
answer
154
views
How can I prevent universal selector rules from affecting span? [duplicate]
I have this rule:
* {background-color:#ddd;font-family: Arial,Helvetica,sans-serif;font-size:13pt}
Unfortunately, it imposes the font-size on a < span > element. I want the span to continue to ...
73
votes
8
answers
68k
views
Not CSS selectors
Is there some kind of "not" CSS selector?
For example when I write the following line in my CSS, all input fields inside an tag with class classname will have a red background.
.classname input {
...
26
votes
4
answers
63k
views
How to select element that does not contain class that starts with a prefix
I am attempting to set a style for all the input elements that does not contain a class that begins with "border-radius":
input:not(class^="border-radius") {
This is not working. Any other ideas?
39
votes
2
answers
22k
views
Select elements without any class [duplicate]
I need to find, via jQuery selectors, all spans in a page that have no class.
Example:
<span class='Cool'>do not found me</span>
<span>me, me, take me please!!!</span>
13
votes
4
answers
11k
views
How to write a CSS Selector selecting elements NOT having a certain attribute?
How to write a CSS Selector selecting elements NOT having a certain attribute?
I have 2 <div> nodes as follows:
First:
<div class="weEq5" style="will-change; width;">
<button ...
7
votes
3
answers
8k
views
Select the only Element with no class or ID
I've seen both this and this question, but they're both Javascript-oriented.
I'm looking to select the only div which has no ID or Class.
Example:
<body>
<div class="X" ... />
<div ...