Kursinnehåll
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
Understanding Box Sizing in CSS
The box-sizing
property is used to control how the total size of an element is calculated, specifically concerning its width
and height
. There are three possible values for the box-sizing
property. Let's break down what each of these values means:
css
index.html
styles.css
Output
inherit
- The
inherit
value allows an element'sbox-sizing
property to inherit its value from its parent element; - This means that the
box-sizing
behavior of the current element is determined by thebox-sizing
property of its parent element; - It can help ensure a consistent
box-sizing
behavior throughout a document by setting it on a parent container.
1. What is the default value for the box-sizing
property?
2. If a parent element has box-sizing: border-box
and a child element has box-sizing: inherit
, what value will the child element use for the box-sizing
property?
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 2