Kursinhalt
CSS Fundamentals
CSS Fundamentals
1. Getting Started with CSS
What is CSS and Why is it Important?Linking CSS to an HTML DocumentMastering CSS Selectors for Styling HTML ElementsChallenge: Apply Your First CSS StylesChallenge: Style with Class SelectorsEnhancing Styles with User Action Pseudo-ClassesChallenge: Apply User Action Pseudo-ClassesChanging Text Colors in CSSOptimizing Workflow for Efficient CSS CodingChallenge: Use Variables for Better CSS Management
3. The CSS Box Model & Spacing Elements
What is the CSS Box Model?Understanding Box Sizing in CSSAdding Space with Margins and PaddingChallenge: Apply Box Sizing to ElementsUsing Structural and Functional Pseudo-ClassesChallenge: Practice Structural Pseudo-ClassesUnderstanding Block, Inline, and Inline-Block ElementsWorking with Block-Level ElementsWorking with Inline ElementsChallenge: Predict Page Layout with Different Element Types
Challenge: Apply Flexbox Concepts
Let's explore the power of flexbox by creating a shop card with a product image, some description, and the price. By default, all the elements are stacked in a column, one below the other. However, our goal is to change this behavior using flexbox.
Task
Consider the following HTML structure:
html
The task is to modify the CSS to achieve the following:
- Identify the parent element containing both the product image (
img
tag with theproduct-image
class) and product information (div
tag with theproduct-info
class). - Apply flexbox to the identified parent element (the
div
tag with theshopping-card
class). - Vertically center the items within the shopping card.
index.html
index.css
- Apply
display: flex;
to the parent element with the classshopping-card
. - The default flex direction is row, so there is no need to change the value of the
flex-direction
property. - To center items vertically, use
align-items: center;
.
index.html
index.css
War alles klar?
Danke für Ihr Feedback!
Abschnitt 4. Kapitel 6