15,494 questions
2
votes
1
answer
72
views
CSS Universal Selector Combinator omits style on table tag (1st descendant) in a div
I have a table (in a div with an id) and I want to apply styling on it (to collapse its borders) using CSS's universal selector combinator (*) and all of the div's descendants (in order to isolate the ...
3
votes
2
answers
127
views
Is there a way to target a pseudo-element in CSS by its class?
I am looking to construct CSS to target this element...
<input type="button"
pseudo="-webkit-media-controls-play-button"
aria-label="play"
...
1
vote
3
answers
89
views
Targeting element which is has not a parent with :not(custom-component)
I am trying to target a paragraph only if it is not inside the custom component my-component. like this:
// Style all elements that are NOT inside my-component
:not(my-component) *{
color: red;
}
...
3
votes
1
answer
108
views
clicking a button with JavaScript using a class and anchor text, rather than ID
I am trying - and failing - to write JavaScript to click this button:
The HTML for the button varies depending on the page
Example 1
from this page:
<span class="a-button-text" aria-...
0
votes
0
answers
28
views
How to select the nth child element that contains a specific attribute in CSS [duplicate]
Below is my HTML code that showcase the problem. Without modifying the HTML structure or adding a class is it possible to select the 3rd span.chatbot-bot-response-inner that contains for example img[...
-1
votes
1
answer
54
views
Why does my image overflow with a defined max-width but works fine with a defined width? [closed]
When I have the width style of an image defined to be 100% of the parent then the image does not overflow. But, when I define the max-width to be 100% of the parent then it overflows. Here is my ...
0
votes
0
answers
65
views
PostCSS parent Selector is adding :is() pseudo after compilation and not producing compatible css
I have just migrated from SCSS to PostCSS and encountered only one issue I cannot resolve.
The issue concerns how to alter a the styles of a nested element when its parent has a specific class.
The ...
6
votes
1
answer
150
views
CSS nth-of-type; but how to only effect types directly in series
Let's say we have a list of items, with splitter elements (<h3>), for example dates :
<h2>Big Header</h2>
<div id='container'>
<h3>Week Title A</h3>
<...
1
vote
1
answer
73
views
Unexpected variable resolution order in CSS with var/property nesting [duplicate]
My goal is to have an architecture where the shadow is defined once, but the color changes depending on HTML attribute data-color-mode.
Note: code provided is just for the isolated problem ...
0
votes
1
answer
65
views
Hide a ::before overlay when a parent's attribute changes, after solving a duplicate pseudo-element issue
I'm developing a custom user stylesheet for YouTube to add a "WATCHED" overlay to video thumbnails.
My main objective is: The overlay should be visible on any video that has been watched, ...
3
votes
3
answers
135
views
Is it possible to select the first row in a table with CSS?
Given:
<table>
<caption>Table Title</caption>
<thead>
<tr>...</tr>
</thead>
<tbody>
<tr>...</tr>
</tbody>
</table&...
3
votes
1
answer
111
views
CSS selector computed aria name
Is it possible to select via a CSS selector (or xpath) an element based on its computed aria name (=accessible name)? For instance for buttons it is computed like
The button has an accessible label. ...
1
vote
1
answer
83
views
How to select all but the last-child, unless the last is also the first
Not that two lines versus one is an issue; but I'd like to learn if there is a more concise way of selecting all but the last-child unless the last-child is also the first-child or only-child, in ...
1
vote
1
answer
102
views
I can't select the css element to data scrape in R. How do I format it to select the information?
I am learning to scrape data and using the website https://quotes.toscrape.com/ as a training dataset. When I try to collect the about section links, I get this error: Error in html_attr(html_elements(...
0
votes
3
answers
64
views
Is there a way to stack a pseudo-element *behind* its <p> parent's text gradient fill?
Here is my snippet.
The <p> is the text "Cool CDs", which appears as a gradient-filled text (with the use of background-clip:text).
p::before is a slightly shifted-down stroke that I ...
0
votes
0
answers
12
views
CSS override issue: .abnormal class not overriding .plan-box div padding [duplicate]
I'm working on a pricing section where each plan is inside a `.plan-box`. All direct `<div>` elements inside `.plan-box` have a general style:
```css
.plan-box div {
padding: 15px;
...
0
votes
0
answers
31
views
How to check whether one element only has specific range of children types? [duplicate]
Minimal demo:
<div class="demo">
<img class="child1">
<p class='child2'>a</p>
</div>
<div class="demo">
<img class="...
1
vote
1
answer
56
views
Is whitespace required between the attribute selector sensitivty flag and a preceding token?
Regarding CSS attribute matching, is [href="http"i] legal syntax, no space between the ‘"’ and the ‘i’, or does there have to be whitespace, i.e. [href="http" i]?
The W3C ...
0
votes
3
answers
185
views
How to individually color html table cells
I want to individually color in cells on a 2x5 row html table, pictured in the above image.
I can't find any examples of :nth-child allowing you to individually select and set the color of multiple ...
0
votes
0
answers
67
views
Reusing CSS properties/extending without preprocessors
I'm using Publii (a static site generator) to create a website and ran in to a problem while creating a contact form.
The contact form itself works fine but while implementing floating labels I wanted ...
0
votes
0
answers
30
views
Which CSS cascade has prevalence in this case and why? [duplicate]
While doing this exercise, I came to the idea of "optimizing" the code trying to avoid the use of the class selector .white-text, and setting the property color: white using the class ...
1
vote
2
answers
81
views
Is there a way to use the subsequent-sibling combinator so that it matches only the first instance?
I'm trying to figure out a way--when hovering on an element--to affect that element and the next subsequent-sibling ONLY. In my example below, when I hover over the Header I only want the next Footer ...
2
votes
1
answer
76
views
Why are non-matching CSS classes contributing to selector specificity calculation? [duplicate]
I have the following HTML & CSS:
<div class="p-12 border both-have">
<div class="p-12 border both-have my-inner">
@import "tailwindcss";
.both-have, ....
1
vote
2
answers
74
views
css styling sequence of span and br with a background
I am trying to style a code block in Lexical Editor for which I cannot change the markup
Basically, a code block is a flat sequence of span and br, like :
<span class='inserted'>+</span>&...
0
votes
2
answers
44
views
Style nth-child when hovering a parent [duplicate]
Here's a dummy piece of code as an example :
<div id="parent">
<div class="child" id="childA"></div>
<div class="child" id="...
0
votes
1
answer
47
views
Can we combine '[class="a"]' and '[id="c d"]' in the same command?
I have a html where I want to get elements with class="a" and id="c d". If I have only one of them, I can use soup.select('[class="a"]') and soup.select('[id="c d&...
0
votes
0
answers
19
views
Is there a "previous sibling" selector while excluding the already active ones for star rating? [duplicate]
I have below star rating HTML for a review form.
As such the result is SSSSS where S represents * rating.
<p class="stars selected">
<span> ...
0
votes
0
answers
159
views
styling a host with sibling custom element selector
I am using web components with lit
I am trying to style a custom element with :host which has another custom element as sibling
Below is my code
import {html, css, LitElement} from 'lit';
import {...
0
votes
2
answers
93
views
CCS Multiple Column Table Alignment
I am very new to CSS but trying to format alignment in a HTML Table that contains (3) columns (each column with a header). I want the first column aligned center, the 2nd left and the third right.
...
0
votes
1
answer
51
views
nth-child odd and even working on main element rather than class [duplicate]
My code:
.project-gallery .portrait:nth-child(odd) { padding-left: 0 !important; }
.project-gallery .portrait:nth-child(even) { padding-right: 0 !important; }
<div class="project-gallery">
<...
0
votes
1
answer
34
views
Why does my CSS media query not apply on mobile devices even though the screen width matches?
I'm trying to make my website responsive using a media query, but the styles inside it are not applying on my phone, even though I'm sure the screen width is under 768px.
body {
background-color: ...
0
votes
0
answers
27
views
VSCode context menu font customization works on Windows but not macOS
I'm customising the font of VSCode's context menu by modifying this file:
C:\Users\varit\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\workbench.desktop.main.js
My changes ...
0
votes
1
answer
224
views
In CSS, how do I conditionally style the :root pseudo-element using attributes?
I have some JS which needs to effect some styling of an entire rendered HTML document. What I current use is the following CSS:
[myattr="true"] { direction: rtl; }
[myattr="false"]...
0
votes
1
answer
49
views
CSS selector for bookmarked URLs?
I am assuming the answer will be "no" but figured I'd ask people more knowledgable than me.
Is there any sort of CSS selector for matching URLs that I have bookmarked in my browser? I see ...
0
votes
1
answer
64
views
How to catch the value of an HTML text input named city in this code snippet?
want to build an automation that will extract the shipping address of a customer from the element that on the attached picture.
How to extract the value of the city to make the automation. I tried to ...
1
vote
1
answer
56
views
How to get the CSS-Selector of a disappearing message [duplicate]
I am trying to get the CSS Selector of the error message being displayed in the login/signup screen in https://automationexercise.com/login
I tried the solution given in How to find the element of a ...
-1
votes
2
answers
187
views
Monserrat Google Font issue showing different rendered fonts despite same CSS and @import
I am working on a Hubspot website that has two versions of the same custom theme. The theme version 1 (V1) is on the older pages and we are updating the site to version 2 (V2) so the new pages have ...
2
votes
2
answers
117
views
How to select the child of an indirect preceding ancestor using CSS
I'm wondering if it's possible to write a CSS selector that will target an element in a separate div when the current element within a sibling div is hovered over.
In my specific case, referencing the ...
3
votes
0
answers
99
views
Detecting ctrl-F focus in CSS
I'm working on an application that will return some of its results as a massive HTML table. To keep the rows and columns from being resized by text hundreds of cells away, any cell content that's more ...
0
votes
0
answers
21
views
Why Might nth-child(even) Be Unresponsive, but (odd) Works Fine? [duplicate]
Prefacing that I'm still a beginner in coding with both CSS and HTML. I am trying to create a sort of timeline with two columns, on the left and right of a middle track and with each timeline entry ...
0
votes
1
answer
40
views
when I limit the height of my image, I see the top of the image, but I want to see the bottom of the image
I have images in a carousel, and I have set the height to 40vh. The picture looks fine, except that as the screen gets larger, it zooms to the top of the image instead of the bottom where I want it ...
1
vote
0
answers
75
views
Web scraping a tournament bracket from trackwrestling.com
I'm trying to use the rvest package in R to scrape a tournament bracket from the 2024 NCAA div 1 wrestling tournament. I've used the selector gadget tool to determine that the CSS selector for the ...
-1
votes
1
answer
51
views
why is my html parser not outputting wanted number
my programming teacher made us program in python a calculator for calculating fuel consummation in L/100KM and i decided to go further and even have it calculate the price per 100km but heres the ...
0
votes
4
answers
86
views
Select only X deep amount of children, not all
I need to apply css to a parent and 3 nested deep children, this works:
.the-parent,
.the-parent > div,
.the-parent > div > div,
.the-parent > div > div > div{
display: flex
}
...
0
votes
1
answer
131
views
Selenium and Cookie Clicker Game - "stale element not found in the current frame"
basically I try to write a code that automatically clicks the cookie and, every 3 seconds, buys an item of the found elements without the class-attribute of "grayed" (as those are the ones u ...
0
votes
0
answers
34
views
How can I add a rectangle half under the text? [duplicate]
I want to create the effect above, however what I've tried results in this:
A line under the block of text, instead of all the text.
What I've tried (ignore the colors and font):
.item::after {
...
0
votes
2
answers
84
views
How do make sure background-color covers the entire width of scrollable element, not just the visible part?
I've got a flex container with 3 rows inside. The entire container is horizontally scrollable. (HTML & CSS in the fiddle)
I am then alternating the background colour (yellow) assigned to the rows. ...
0
votes
0
answers
35
views
How would I select the 2nd href for Exhibit#2 using CSS selector
I am trying to select the href for Exhibit 2 using a CSS selector
<td>
Order Granting Debtors' Motion for Entry of Order (I) Establishing a General Bar Date to File Proofs of Claim, (II) ...
1
vote
0
answers
127
views
Find element with different locator alternatives and let them race who will find the element first
Often an html element can be found by different locators. To find the <h2>...</h2> element
<div>
<section>
<div class="articleheader">
<...
0
votes
1
answer
106
views
Unable to select the product scope in selenium
I'm trying to get the Web Element by using streams in java and click on add to cart, but unable to get the element in the first place.
Here is the code.
WebDriver driver = new EdgeDriver();
driver....