★ Must-know
<style> element in the same documentFurther detail
📌 An inline style overrides external and internal styles.
HTML supplies content; CSS supplies its style.
★ Must-know
The selector forms shown are:
*h1#myId.myClassThe color property sets foreground color, whereas background-color sets background color.
Further detail
rgb(255, 0, 0), or hexadecimal values, such as #ff0000.★ Must-know
text-align aligns text within its parent element; right means the parent's right side, not the page's right side.
font-weight can use names such as normal and bold or numeric values from 100 to 900 to control text weight.
Further detail
text-decoration supports underline, overline, and line-through, can use styles such as wavy or dotted and a color, and can be set to none, including to remove hyperlink decoration.
font-family can list multiple font families, such as Arial and Roboto, as fallback choices.
line-height sets line spacing and can be given as a length, a unitless number, or normal.
The listed text-transform values are:
★ Must-know
height and width set the dimensions of its content area.📌
display: inlinetakes only the required space and does not accept margin or padding as described;inline-blockallows margin and padding, whileblocktakes the available width.
📌
display: noneremoves an element from document flow without reserving space, whereasvisibility: hiddenhides it while reserving its space.
Further detail
A border can be specified with border-width, border-style, and border-color, or with the shorthand border, such as 2px solid black.
border-radius rounds an element's outer border edge; a value of **50%** can create a circular shape for a suitable element.
The four-value padding and margin shorthands use clockwise order: top, right, bottom, left.
The alpha channel in an RGBA color controls opacity from 0 to 1.
Picture each element as content inside padding, surrounded by border, with margin outside.
★ Must-know
A percentage such as width: 33% is commonly relative to the corresponding dimension of the parent element.
For font size, em is relative to the parent element's font size; for padding and margin, em is relative to the same element's font size.
📌
staticis the default position and ignores top, right, bottom, left, and z-index;relativeis positioned relative to itself and responds to those properties.
📌
absoluteis positioned relative to its closest positioned ancestor and removed from flow, whereasfixedis positioned relative to the browser and removed from flow.
Further detail
vh and vw are relative to 1% of the viewport height and width, respectively.
sticky positioning is based on the user's scroll position.
z-index determines stack level, and overlapping elements with larger z-index values cover those with smaller values.
The listed background-size values are:
Relative stays in the flow; absolute and fixed leave it.
★ Must-know
To use the flex model, set the container's display property to flex.
justify-content aligns items along the main axis, while align-items aligns them along the cross axis and align-content controls space between and around content along the cross axis.
Further detail
The listed flex-direction values are:
align-self aligns an individual flex item along the cross axis and overrides align-items for that item.
flex-grow and flex-shrink determine how much an item grows or shrinks relative to the other items when space is available; a value of 0 means it does not grow.
Container controls group alignment; an item can override it with align-self.
@media (width: **600px**), or a minimum width, as in @media (min-width: 600px).The listed transition properties are:
transition-propertytransition-durationtransition-timing-functiontransition-delayThe transition shorthand example is transition: font-size **2s** ease-in-out **0.2s**, giving property, duration, timing function, and delay in that order.
The transformations shown include:
rotate(45deg)scaletranslateskew(30deg)A keyframes rule can define animation states using from and to or percentage points such as 0%, 50%, and 100%.
The listed animation properties are:
animation-nameanimation-durationanimation-timing-functionanimation-delayanimation-iteration-countanimation-directionThe animation shorthand example is animation: myName **2s** linear **3s** infinite normal.
Define keyframes, then apply animation properties to the element.
Take a 23-question practice quiz on CSS Styling and Layout, with every answer explained.
1. What is the primary role of CSS in a web document?
2. A developer wants to place CSS rules in the same HTML document but separate from the elements they style. Where should the rules go?
Memorize the key concepts of CSS Styling and Layout with 57 flashcards.
What does CSS describe in a document?
The document’s style.
What three ways can CSS be included in an HTML document?
Inline on an element, in a `<style>` element, or in an external stylesheet.
Which symbol represents the universal CSS selector?
*
Upload your class notes and Revizly writes a study guide, a quiz and flashcards in about a minute.
Study guide maker