FlashKeepers

Web Development · College · College and University

CSS I: Selectors, Specificity and the Box Model

CSS selectors, combinators, pseudo-classes, specificity, cascade, inheritance, box model, units and colors.

About this set

41 basic cards for College Web Development. Set 1 of 3 in CSS. It opens with "What selector targets an HTML element by its class name?" and "What selector targets an HTML element by its ID?". Study it alongside the other College sets below.

41 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What selector targets an HTML element by its class name?
Show answerThe class selector, using a dot (.) prefix, e.g., .classname
What selector targets an HTML element by its ID?
Show answerThe ID selector, using a hash (#) prefix, e.g., #idname
What selector targets all elements of a given type?
Show answerThe element or type selector, e.g., p, div, span
What is the universal selector in CSS?
Show answerThe asterisk (*), which targets all elements on the page
What combinator is used to select all descendant elements?
Show answerThe space character (descendant combinator), e.g., div p selects all p elements inside any div
What combinator selects only direct child elements?
Show answerThe greater-than symbol (>), e.g., div > p selects p elements that are direct children of div
What combinator selects an element that immediately follows another?
Show answerThe adjacent sibling combinator (+), e.g., h1 + p selects the first p immediately after an h1
What combinator selects all siblings that follow an element?
Show answerThe general sibling combinator (~), e.g., h1 ~ p selects all p elements that follow an h1
What is an attribute selector? Give an example.
Show answerA selector that matches elements based on their attributes, e.g., input[type="text"] selects input elements with type="text"
What pseudo-class targets an element when the user hovers over it?
Show answer:hover
What pseudo-class represents an element that has received focus?
Show answer:focus
What pseudo-class targets the first child element of its parent?
Show answer:first-child
What pseudo-class targets the last child element of its parent?
Show answer:last-child
What pseudo-class selects elements based on a formula, like every other element?
Show answer:nth-child(), e.g., li:nth-child(2n) selects every second list item
What pseudo-element inserts content before an element's content?
Show answer::before

26 more cards in the app

Study this set free