This question already has answers here:
What does the ">" (greater-than sign) CSS selector mean?
(8 answers)
Closed 1 year ago.
so I have this CSS file and it has this
.post > a {
position: absolute;
color: #fff;
font-size: 22px;
cursor: pointer;
}
and I'm not sure what does the a means exactly?
Selects all <a> elements where the parent is an element with a class post.
https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator
Related
This question already has answers here:
Is there a CSS parent selector?
(33 answers)
Closed 1 year ago.
I am trying to apply color only parent level, by using :not() operator. but no result. is it possible?
html:
<header>title <span>123</span></header>
CSS:
header:not(header span){
color: green;
}
<header>title <span>123</span></header>
header:not(header span){
color: green;
}
I would use two css rules, one specifically targeting the span to unset the color: green rule applied by the header css rule.
header {
color: green;
}
header span {
color: initial;
}
<header>title <span>123</span></header>
This question already has answers here:
Hide text in html which does not have any html tags [duplicate]
(3 answers)
Closed 4 years ago.
I have something like that in an AMP-Page (I cant change the structure as its given and !important is not possible for AMP):
<p class="test">hide me <a>show me</a></p>
How can I achieve hiding the html of the parent bot not the nested a-tag?
I tried this without success:
.test{display:none;}
.test a{display:block;}
and also:
.test:not(a){display:none;}
You can use font-size?
.test {
font-size: 0;
}
.test a {
font-size: 16px;
}
<p class="test">hide me <a>show me</a></p>
Using hidden and visible properties it is possible.
.test {visibility: hidden;}
a {visibility: visible;}
This question already has answers here:
CSS selector for first element with class
(23 answers)
Can I combine :nth-child() or :nth-of-type() with an arbitrary selector?
(8 answers)
Closed 5 years ago.
I'm trying to select the first td.is-active inside my tbody. The .is-active style is well accepted, but it's impossible to add a radius to the first (and only first) .is-active.
Full code here.
Or just my SCSS:
td {
&.is-active {
background-color: $color5;
&:first-child {
border-bottom-left-radius: 10px;
border-top-left-radius: 10px;
}
}
}
An idea ? Thanks.
CSS properties are not cumulative and do not support sub-selection. td.is-active:first-child will not select the first element within the .is-active group. It will select the first td if it has the .is-active class, and no td matches this condition.
td:first-child will always select the first td, regardless of its class.
You are looking for the :first-of-class selector, which, unfortunately, doesn't exist.
This question already has answers here:
Change last letter color
(8 answers)
Closed 8 years ago.
Is there a way to style just the last letter in CSS?
I know that for the first letter I can use:
p::first-letter {
color: red;
}
But how to style the last letter?
There is no last-letter selector instead wrap it in span and style it
p::first-letter, p span {
color: red;
}
<p>test test tes<span>t</span></p>
This question already has answers here:
Is it possible to exclude all css styling for one specific div container?
(2 answers)
Closed 8 years ago.
I have defined a style for input elements in HTML,
e.g.
input { font-family: Cambria; font-size: 13pt; }
So it by default applies to all the input elements I write in the page.
Now I want one specific input element with no style; can I do that?
The element selector has a lower priority than the class selector, so you can just add a class:
.special-input { font-family: sans-serif; font-size: 10pt; }