topskill.dev
CoursesTracks
0
All courses/CSSBackground Layer
Visual Style
3 / 9
← 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

Background Layer

Paint a gradient behind the welcome message

A gradient blends colors across a surface. CSS can generate that image directly, so the market welcome panel does not need an image file.

css
.hero {
  background-color: #7c3aed;
  background-image: linear-gradient(135deg, #7c3aed, #ec4899);
}

background-image places the gradient above the solid background-color. In linear-gradient(...), the first value sets its direction: 135deg runs diagonally toward the lower right. The comma-separated colors are the start and end of the blend. The opaque gradient covers the solid color; removing the image declaration reveals the violet fallback.

The dark backing behind the text is supplied so the small white text remains readable over the pink area. Sizing and centering are also supplied; focus on the background declarations.

Compare the layers

Run. Change 135deg to 90deg and Run again: the blend now runs left to right. Restore 135deg. Temporarily remove background-image, Run to see the solid violet layer, then undo that removal before moving on.

Hint 1
1 / 1
HINT 1

background-image can hold a gradient without an image file.

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