Saturday, February 8, 2020
CSS Selectors | gspace |
*{}
Selects all elements
:root{ ...... }
Selects the document's root element.
p{.....}
Selects all <p> elements
.intro{........}
Selects all elements with class="intro"
p.intro{}
Selects <p> elements with class="intro"
#firstname{.......}
Selects the element with id="firstname".
div , p { .... }
Selects all div elements and all <p> elements.
div p {...}
Selects all <p> elements inside <div> elements.
div + p{ ... }
Selects all <p> elements that are placed immediately after <div>.
div>p
Selects <p> elements where parent is a <div>.
p~ul{ ... }
Selects every <ul> element that is preceded by a <p> element.
[target]{ ... }
Selects all elements with a target attribute.
[target=_Self]{ ... }
Selects all elements with target="_Self"
:not(p){ ....... }
Selects every element that is not a <p> element.
p:empty{ ..... }
Selects every <p> elements that has no children.
p:first-child{ ..... }
Selects every <p> element that is the first child.
p:nth-child(2){ ..... }
Selects every <p> element that is second child.
p:only-child{ ...... }
Selects every <p> element that is the only child.
Saturday, February 8, 2020
CSS
web development
0 Response to CSS Selectors Cheat Sheet
Comments are personally moderated by our team. Promotions are not encouraged.
Post a Comment