CSS Selectors Flashcards
What will this selector target?
.intro {
color: blue
{
Selects all elements with class=”intro”
What will this selector target?
#firstname { color: blue {
Selects the element with id=”firstname”
What will this selector target?
- {
color: blue
{
Selects all elements
What will this selector target?
p {
color: blue
{
Selects all p elements p
What will this selector target?
div, p {
color: blue
{
Selects all div elements and all p elements
What will this selector target?
div > p {
color: blue
{
Selects all p elements where the parent is a div> element
What will this selector target?
div + p {
color: blue
{
Selects all p> elements that are placed immediately after div> elements
What will this selector target?
p ~ ul {
color: blue
{
Selects every ul> element that are preceded by a p> element
What will this selector target?
[target] {
color: blue
{
Selects all elements with a target attribute
What will this selector target?
[target=_blank] {
color: blue
{
Selects all elements with target=”_blank”
What will this selector target?
[title~=flower] {
color: blue
{
Selects all elements with a title attribute containing the word “flower”
What will this selector target?
[lang|=en] {
color: blue
{
Selects all elements with a lang attribute value starting with “en”
What will this selector target?
a[href^=”https”] {
color: blue
{
Selects every a> element whose href attribute value begins with “https”
What will this selector target?
a[href$=”.pdf”] {
color: blue
{
Selects every a> element whose href attribute value ends with “.pdf”
What will this selector target?
a[href*=”w3schools”] {
color: blue
{
Selects every a> element whose href attribute value contains the substring “w3schools”
What will this selector target?
a:active {
color: blue
{
Selects the active link
What will this selector target?
p::after {
color: blue
{
Insert something after the content of each p> element
What will this selector target?
p::before {
color: blue
{
Insert something before the content of each p> element
What will this selector target?
input:checked {
color: blue
{
Selects every checked input> element
What will this selector target?
input:disabled {
color: blue
{
Selects every disabled input> element
What will this selector target?
p:empty {
color: blue
{
Selects every p> element that has no children (including text nodes)
What will this selector target?
input:enabled {
color: blue
{
Selects every enabled input> element
What will this selector target?
p:first-child {
color: blue
{
Selects every p> element that is the first child of its parent
What will this selector target?
p::first-letter {
color: blue
{
Selects the first letter of every p> element