Get first and second element satisfying a CSS path [duplicate] - css

This question already has answers here:
How to get an 'nth-of-type' in Selenium
(2 answers)
Closed 3 years ago.
Let's say I have a CSS path:
.event__participant.event__participant--away
How can I get the first element satisfying that path? Or second element? Or X element? I'm using selenium and I don't want to be getting all 100+ of them. :nth-type-of doesn't work and I can't use nth-child because it has more children than just .event__participant--away.

Based on the css provided at the top in your original post the css in your script should be
Driver.FindElementsByCssSelector(".event__participant.event__participant--home:nth-of-type(1)")

Related

Is it possible to make divs overlap like cards *just* using css [duplicate]

This question already has answers here:
Partially overlap elements using CSS
(3 answers)
Closed 11 months ago.
Currently my site looks like this (making a browser based card game), please ignore the art for now - screenshot - I would like them to overlap slightly rather than wrapping around and creating a new line almost like someone is holding the cards. I have no idea where to even start with this without using js so I was wondering if anyone could help me come up with a solution that just uses pure css solution.
You can use margin-left and margin-right with negative values. Or you can set the card positions by using position: absolute and left and top properties.

How to highlight one specific word in text using only css? [duplicate]

This question already has answers here:
CSS "word" selector? [duplicate]
(4 answers)
Closed 3 years ago.
How to highlight one specific word in text using only css? I can`t add another tag inside tag p.
<p class="header_heading">
Some text that I need to highlight
</p>
Most likely you cannot do that unless you add some java script and parse text / add style for a single word.
Theoretically you can research for CSS pseudo element such as specific word or similar, but I do not remember anything that exists and can help unless you parse the content.

css how to use background-image [duplicate]

This question already has answers here:
CSS background-image - What is the correct usage?
(10 answers)
Closed 4 years ago.
background-image: url(../images/title2);
im also trying to apply it to a container
i have a rootfolder called learning project inside it looks like this
My html page is inside html and my css is inside css both called index I'm trying to get from my css to my image folder to title2 which is just a random name and it wont work
Can anyone help?
wrap the relative url in quotes
and thats it
background-image: url('../images/title2');

How does Chrome categorize CSS rules? [duplicate]

This question already has answers here:
What does it mean when a CSS rule is grayed out in Chrome's element inspector?
(8 answers)
Closed 7 years ago.
The Chrome web inspector has atleast 3 ways of showing CSS rules.
Normal, normal with a line through, and opaque. Here is a picture of the 3.
If I remember correctly I believe that means its inherited from a parent element. Strikethrough means it was overridden by another style.

CSS: selecting an element only if it contains a specific element [duplicate]

This question already has answers here:
Is there a CSS parent selector?
(33 answers)
Closed 9 years ago.
I am creating a print stylesheet and would like to hide all figure tags only if that tag contains an iframe, which happen to be embedded YouTube videos. If the figure tag contains anything else (i.e. an img), I want the tag and its contents to still be shown on the printed page.
I know that I could simply apply a class of "video", for example, to my figure tag where appropriate, but I want to see if there is a way to accomplish this via CSS without resorting to adding classes throughout my site. Also, even though I know they exist, I am not looking for a jQuery solution.
Thank you!
You are looking for a parent selector
CSS3 has none, but CSS4 has one that is like selecting using $.
Here are some similar questions with similar results:
Is there a CSS parent selector?
CSS Parent/Ancestor Selector
Complex CSS selector for parent of active child

Resources