topskill.dev
CoursesTracks
0
All courses/CSSCSS Rule Style an Exhibit Card
CSS Foundations
1 / 10
← CSS
●CSS Rule Style an Exhibit Card○Write Your First CSS Rule○CSS Selectors Target Exhibit Details○Target Exhibit Details○Apply CSS Three Sources○Apply CSS Three Ways○Specificity Resolve a Style Conflict○Resolve Specificity○Inheritance and the cascade✦Module Quiz
○Color Palette○Color Palette○Background Layer○Background Layer○Type Rhythm○Type Rhythm○Borders and Shadows○Borders and Shadows✦Module Quiz
○Box Model Seed Packet Card○Space a Seed Packet○Display Swap Table Labels○Arrange Swap Table Labels○Positioning Pickup Pin○Pin the Pickup Location○Sizing and Overflow○Size a Seed-Swap Notice○Sticky scroll headings✦Module Quiz
○Advanced Selectors Book Cart Sign○Target a Book Cart Sign○Pseudo-Classes Night Cart States○Style Night Cart States○Pseudo-Elements○Add a Book-Quote Mark✦Module Quiz
○Lantern Market navigation○Lantern Market navigation✦Module Quiz
○Community garden request card○Community garden request card✦Module Quiz
○Flex Direction○Flex Direction○Main-Axis Spacing○Main-Axis Spacing○Cross-Axis Alignment○Cross-Axis Alignment○Wrapping and Flex Items○Wrapping and Flex Items○Flexbox Navigation○Flexbox Navigation✦Module Quiz
○Grid Tracks○Grid Tracks○Grid Gaps○Grid Gaps○Grid Placement○Grid Placement○Responsive Grid○Responsive Grid✦Module Quiz
○River radio schedule○Harbor radio schedule✦Module Quiz
○Field note color system○Field note color system○Transforms○Rotate a Field Note○Resilient styles✦Module Quiz
○Kite festival signal○Garden festival signal✦Module Quiz
○Garden forecast○Harbor forecast○Fluid sizing○Fluid weather bulletin○Images that fit✦Module Quiz
○Seed inventory table○Tool checkout table✦Module Quiz
○Community maker profile○Maker profile sheet✦Module Quiz

CSS Rule Style an Exhibit Card

Your first CSS rule

In HTML, you used color, font-size, and background-color to see how styles attach to a page. This museum card gives those rules a closer look. Its heading and paragraph are already supplied. HTML gives the words their structure. CSS (Cascading Style Sheets) controls how they look. Open style.css beside index.html to see the two files working together.

Read one rule

css
h1 {
  color: #1b4d8c;
}

The selector, h1, chooses every level-one heading. Inside the braces, the property, color, names what changes: the text color. The value, #1b4d8c, chooses a particular blue. A property and value form a declaration. A colon separates them, a semicolon ends the declaration, and braces group declarations for one selector.

CSS ignores text between /* and */; those comments leave notes for the person editing a stylesheet. They do not change the preview.

The body rule uses background-color to paint behind the page content. Its supplied font-family: system-ui, sans-serif chooses the device's interface font, with a generic fallback. This is new typography vocabulary: the browser tries the named families from left to right. A generic fallback names a category rather than a particular installed font. Text inside the body can inherit the font: if it has no family of its own, it uses its parent’s family. Not every property inherits; padding and backgrounds, for example, do not. You will practice that distinction after specificity, then work on fonts in the next module.

Change one thing

Press Run. You should see a blue heading on a pale page. Change only the heading's color value to purple, then Run again. The paragraph should keep its original color. Restore #1b4d8c afterward.

This demo has no tasks to submit. Next, write the background and heading rules yourself for another exhibit.

Hint 1
1 / 1
HINT 1

This completed example is for reading and previewing before the exercise.

Files
  • ⋄index.html
  • ⋄style.css
Loading editor…