993 questions
1
vote
1
answer
44
views
Sass doesn't remove ":global" pseudo selector during compilation
I have dashboard.scss which contains:
@import '../../src/pages/DashboardPage/DashboardPage.module.scss',
'../../src/ui-components/atoms/Button/Button.module.scss',
'../../src/ui-components/...
1
vote
1
answer
74
views
How to make focus-within work in safari on mac IOS
I've created a css only dropdown filter (that opens on click instead of hover). I used :focus-within to accomplish this. I tought this was a crossbrowser-safe property, because Can I Use states that ...
1
vote
2
answers
122
views
nested css declaration with pseudo classes in svg style tag not working
I have and SVg and adding tag inside svg and using nested css delcration syntax and wehn using & it gives error of some XMl error ;
first see this html example
<style type="text/css">
...
1
vote
1
answer
54
views
Select only the first match after each instance of another kind of match
I have a table that is broken up into groups headed by specially formatted elements. The first row of each group requires some special formatting so it is appropriately spaced and delimited from the ...
-1
votes
4
answers
99
views
How to select an <em> html element that is Not a child of any <p> element? [closed]
/* CSS */
em {font-style: italic; background yellow}
::autonomous-not-child-of-a-p-element-? :: em {font-style:normal; background gray}
Given two situations both using <em> differently, in need ...
-4
votes
2
answers
72
views
How to change a pseudo selectors' precedence [duplicate]
CSS:
#container > a {
color: yellow!important;
}
a:focus-visible {
color: red!important;
}
HTML:
<div id="container">
<a href="#">Anchor 1</a>
...
1
vote
2
answers
206
views
How to have CSS affect every other element that's not invisible [closed]
I'm trying to work with CSS to alternate background color in my divs. I can do that, but which divs display changes. I'd like to be able to alternate only what's currently visible. Otherwise it's ...
-1
votes
6
answers
916
views
How to find the following HTML Element
I have a menu with submenu with a structure like this:
<ul>
<li>
<a class="navigation-item">Menu Item 1</a>
<a class="submenu-toggle"><a/&...
0
votes
2
answers
192
views
My css :hover properties do not get removed on mobile when the element is clicked and remain there. And the :active property also works after a delay
I have a button with a :active class instruction to scale down to produce a nice effect, it works fine on pc, but on my mobile device I found that the hover effect remained there after I pressed the ...
0
votes
1
answer
53
views
applying the same selectors on sibling have a slightly different behaviour
In my app, I have a component in which there are only two cards and I want to animate them when they are hovered and clicked.
I noticed that when one of them is currently active (clicked) the other ...
0
votes
0
answers
20
views
Cannot provide border after clip-path usage [duplicate]
I have this as required design:
All 6 figures you see are buttons and they must have different title. The design however is almost identical except bg-color. So I created my styled-btn component:
...
2
votes
0
answers
69
views
Can CSS detect when the user is NOT touching a touchscreen?
:root {
font-family: Avenir, Helvetica, Arial, sans-serif;
--form: 300px;
--half: 150px;
--size: 60px;
--pad: 8px;
--top: calc((var(--half) - var(--size)) / 2 - var(--pad));
--...
0
votes
2
answers
55
views
Why pseudo-elements can't be used as an argument within :has() pseudo-class?
The CSS specs give following reason why pseudo-elements can't be used as an argument within :has() pseudo-class:
Note: Pseudo-elements are generally excluded from :has() because many
of them exist ...
0
votes
0
answers
19
views
Why do the :focus state properties override the :active ones in my CSS? [duplicate]
I get that the solution is to place the :focus selector and properties before the :active ones but I don't get why, especially considering that focus and active are different states, even if clicking ...
1
vote
2
answers
285
views
CSS ":is()" pseudo-class with relative selectors
I want to style specific "sections that are directly inside the body" and "sections that are directly inside a div directly inside the body" with the ":is()" pseudo-class,...
0
votes
1
answer
45
views
How do I move my HTML border forward of my animated image?
Currently, I have a border surrounding the HTML of my website, so that it surrounds all content on every page. However, on my home page I have an image that slides in when the page loads and currently ...
0
votes
2
answers
55
views
Make all the targets of the ':target' pseudo-class visible
I want to make targets of the :target pseudo-class visible. That is, if the target is a block element, e.g. <p>, that <p> should be outlined; and if the target is an inline element, e.g. &...
2
votes
1
answer
72
views
Use 'not' pseduo-class to style all the elements except the one that is a child of a specific one
h1 { color: red; }
header h1 { color: revert; }
<body>
<header>
<h1>Title</h1>
</header>
<h1>Level-1 heading</h1>
<p>Body text.</p>
...
1
vote
1
answer
30
views
Pseudo-element z-index issues
I am trying to style lists in my website using pseudo elements to replace the default bullet point. However, the pseudo elements render on top of the dropdown menus in the navigation sidebar for some ...
0
votes
0
answers
46
views
How to Programmatically Activate a Pseudo-Class on an Element? [duplicate]
Question: Is there any way to programmatically activate pseudo-classes such as :hover, :active, :focus, etc., in JavaScript or React? If so, how can this be done without modifying the original ...
0
votes
1
answer
671
views
placeholder-shown pseudo class seems not to work on safari
When I use :not(::placeholder-shown), :NOT seems to be not working in safari browsers.
If you are not on safari: Below i added a way to use the safari browser with playwright so you can test it ...
-1
votes
2
answers
91
views
How to animate rotation of an image inside input control?
Based on this answer, I managed to put an image as my icon appearing inside an INPUT control at its right edge. If I use a GIF that rotates, I'm all set. I only need to set the class on my control and ...
0
votes
1
answer
49
views
Change cursor after two clicks using only html and css?
I know I can change the cursor with one click with the following CSS code:
#slide-arrow-prev:active {
cursor: not-allowed;
}
Is there anyway to change a cursor after two clicks using only html ...
-2
votes
2
answers
65
views
:not pseudo class cancel :hover animation
I have an element inside a button that I wanted to animate when I hover it and also when I click on the parent element, the button.
For that I used the :not and :active pseudo-classes to animate the ...
0
votes
2
answers
37
views
How to change pseudo class color to match the color of another class?
I have created a 'block' for a webpage that for example is called 'test-div'.
Test div also has an extra class added to it to change its background color ie.
test-div test-div-bg-bright-gold
test-div ...
1
vote
2
answers
164
views
How do I apply styles when hovering only the ::first-line of an element?
I want to make the first line of a paragraph bold only when the user hovers over the first line of the paragraph. I tried something like:
p::first-line:hover {
font-weight: bold;
}
Please note ...
0
votes
0
answers
30
views
Attach dynamically a pseudo-class :before to a label inside a component
I want to attach dynamically a pseudo-class :before to a label inside a component whose data come from a db.
I know one cannot manipulate pseudo-class (easily/safely) with JS vanilla. So I think about ...
4
votes
0
answers
377
views
:user-valid not working for input type date, and neither does :user-invalid
I'm encountering an issue with the CSS pseudo-class :user-valid not behaving as expected for an input of type date. Similarly, :user-invalid doesn't seem to produce the desired results. However, :...
0
votes
1
answer
38
views
How can I target an :after psuedo-element within HTML controls rendered by an ASP.NET asp:checkbox control? [duplicate]
I have seen code that applies to a simple input-label pair:
HTML
<input type="checkbox" id="toggle" class="checkbox" />
<label for="toggle" class=&...
-1
votes
1
answer
489
views
Is there a reason why my buttons aren't working towards my code? [closed]
For my buttons towards my code, it's not allowing the button to turn the cursor into a pointer when moving onto the button, and after a while my hover pseudo class selector is no longer working for ...
-1
votes
1
answer
70
views
Applying pseudo-class for a checkbox to a specific sibling
I am looking at realizing a CSS Native multilevel menu for a sidebar without using Javascript (or the setState in my current React implementation).
I have done almost everything, but I am getting ...
0
votes
1
answer
337
views
Why am I getting a parse error using the :has pseudo-class?
When I use the W3C CSS Validation Service on the following CSS code, I get a Parse Error ")". The error doesn't seem to be impacting the functionality. Any help is greatly appreciated.
...
0
votes
1
answer
35
views
How to correctly use :valid pseudoclass in mui components to change the border dynamically
I'm trying to change the border color from Mui TextFields,, with createThem from Mui v5, if the input is valid. The border gets set inside ::before and ::after pseudoclasses.
I'm using variant="...
1
vote
1
answer
41
views
Trouble with ::before,how to apply differently depending on contents of <div>?
Let's say I have:
<p>Paragraph.</p>
<div class="note">Naked Note Div.</div>
<div class="note">
<p>Paragraph in Note DIV.</p>
<p>...
0
votes
0
answers
2k
views
Use :has pseudoclass in tailwind on hover
I have a component with the following structure:
<li key={index} className="custom--item group">
<p className="font-medium mb-2">Person No.{index + 1}</p>
<...
0
votes
1
answer
30
views
Can I use the :not pseudoclass to swap animations of an HTML element depending on whether the cursor is covering it?
I am trying to learn CSS fundamentals before diving into use of front end frameworks like Tailwind. I've made a small project for myself of making a webpage, and my first task is to make a sidebar ...
0
votes
0
answers
106
views
Use of CSS pseudo class `:scope` to style elements
From mdn pseudo classes :scope
The :scope CSS pseudo-class represents elements that are a reference
point, or scope, for selectors to match against.
To my understanding a "custom" pseudo ...
0
votes
0
answers
70
views
CSS Underline using pseudo styles - thickness changes on position change issue
I am using CSS Underline using pseudo styles to create underline for text.
And facing an issue of underline thickness is changed on changing the position of the CSS property bottom on my website.
....
0
votes
2
answers
171
views
changing inline css variable using javascript does not reflect on psudo selector content property
writing text using ::after pseudo selector using content property and it's value comes from inline css variable. now on click of the text I am able to change the css variable value ( can be seen in ...
1
vote
3
answers
326
views
":target" pseudo-class when multiple "a" elements are used as destantions
Sometimes we may need to provide a path to a specific section on a web page using multiple different #-tail URLs, and for this task, as far as I know, we have to use multiple blank <a> elements. ...
-1
votes
3
answers
60
views
Style element and ::before on hover
I'm trying to use CSS to make the text "Permits Required" and the ::before pseudo-class turn red - the ::before contains an icon.
.knHeader__menu-list-item:hover::before {
color: #...
1
vote
1
answer
180
views
How to un-set a property in a CSS pseudo-class?
I have CSS like this
*:focus-visible {
outline: 2px solid blue; /* This value is dynamically set based on configuration */
}
I now have a button with class toggle that has
.toggle {
/* ... many ...
0
votes
2
answers
41
views
I don't see changes when using :has()
I recently discovered the :has() pseudo-class. When I tried to test it I didn't see any changes. I really don't know why.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
...
-1
votes
1
answer
191
views
How to rewrite this pseudo-class selector in JS to work in Mozilla?
I have this seudo-class selector in a script:
querySelectorAll("header:has(+ div.content)");
When I display the page in Firefox, I get the following error:
Uncaught DOMException: Document....
1
vote
4
answers
119
views
toggle button and text : working fine, but want to simplified the code as its too long and lengthy
I have some boxes that a lot of information inside them. I want the information less at first and if the user wants to read more information, they click the button "See More". Then if they ...
0
votes
2
answers
96
views
`:hover` pseudoclass not applying to `<p>`, while `p:hover` does
When I hover over the <a>, it correctly changes color. But when I hover over the <p>, nothing happens. I do not understand why <p> does not change color when hovered.
If I replace ...
1
vote
1
answer
309
views
How to use a compound selector in CSS pseudo-class function :host-context(<selector>)
In the :host-context() - MDN DOcs it is stated that:
The :host-context() CSS pseudo-class function selects the shadow host of the shadow DOM containing the CSS it is used inside (so you can select a ...
0
votes
0
answers
265
views
How can I select a this DOM element using a CSS selector in Google Tag Manager?
I have created a variable in Google Tag Manager where the variable type is DOM Element and the selection method is CSS Selector. I am trying to select a line of text from a page but getting a null ...
2
votes
0
answers
40
views
How can I select an input field with value in css? [duplicate]
My input field has a label in the same position as the placeholder. When I click on the input field, the label moves up and appears at the top border of the input field, which looks really nice.
...
0
votes
1
answer
73
views
how can I target element:checked to an element in another parent [duplicate]
Hello everyone I'm a beginner trying to get better at css. How can you target an element from another div in events like hover, checked, etc.
see example of what I mean below:
<div>
<input ...