What you will use in this project
- Selectors (class, id, attribute, pseudo)
- Box model and spacing
- Hover and interactive states
box-sizing reset.body a font family and a text color.In style.css:
* { box-sizing: border-box; }.body, set font-family to a stack like Arial, Helvetica, sans-serif.Tip: set a default text color on body so the whole page inherits it.
Refreshers: CSS Selectors.
.card a background, a border, padding, and rounded corners.In style.css:
.card { ... } rule.background-color.border, like 1px solid #ccc.padding so the text does not touch the edges.border-radius to round the corners.In style.css:
[data-role="engineer"] { ... } with a distinct color or border.Tip: also style .card h2 with a color and a tweaked margin so the name pops.
And style .role with a color (optionally text-transform: uppercase) so it reads as a label.
[data-role="engineer"] matches only cards with that exact value.
See Attribute selectors.
In style.css:
.card, set display: inline-block and a width, like 200px..card, set a small margin so cards do not touch.body, set max-width: 960px and margin: 0 auto.The max-width with margin: 0 auto is the classic centering trick.
See CSS Inline-Block.
:nth-child(odd).In style.css:
.card:hover { ... } changing background or border..card:nth-child(odd) { ... } with a different background tint.cursor: pointer on hover.:nth-child() accepts odd, even, or formulas like 2n+1.
See CSS Pseudo-classes.