CSS Clear Property
Duration: 4 min
This video lesson is available to enrolled students.
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This lecture introduces the CSS clear property, which controls how elements behave next to floated boxes by preventing them from wrapping around. The instructor presents the syntax selector { clear: value; } and defines the five possible values: none (default, allows floating on either side), left (pushes the element below floated elements on its left), right (pushes it below floated elements on its right), both (below floats on both sides), and inherit (takes the value from the parent). Hand-drawn red diagrams illustrate floated boxes and how clear pushes subsequent elements downward. The lesson then moves to a worked example comparing two layouts: without clear, text in div2 wraps around the floated div1; with clear: left applied to div4, the element is pushed below the floating div3. Red circles and arrows link specific CSS rules to their rendered output, reinforcing the cause-and-effect relationship between code and layout.
Chapters
0:00 – 2:00 00:00-02:00
The slide titled 'CSS clear Property' states that the property controls behavior of elements next to floated elements. The syntax block shows 'selector { clear: value; }', followed by a list of values: none (default, allows elements to float on either side), left (pushed below floated elements on its left side), right (below floats on its right side), both (below floats on both sides), and inherit (inherits the clear value from its parent). The instructor underlines key terms, adds red checkmarks beside the syntax and values, and draws a red diagram labeled 'float' to visualize how floated boxes interact with the clear property.
2:00 – 3:38 02:00-03:38
A code example demonstrates the property in practice. The CSS includes '.div1 { float: left; padding: 10px; border: 1px solid green; }', '.div2 { padding: 10px; border: 3px solid red; width: 200px; }', '.div3 { float: left; ... }', and '.div4 { padding: 10px; border: 3px solid red; width: 200px; clear: left; }'. The instructor circles 'float: left' and draws a red arrow to the 'Without clear' output, where text in div2 wraps around the floated box. A second arrow connects 'clear: left' to the 'With clear: left' output, where div4 is pushed below the floating element. A cartoon face is drawn beside this diagram to highlight the layout change.
The lesson follows a definition-to-demonstration structure. First, the clear property is defined with its syntax and five values, each explained as controlling whether an element drops below left-side, right-side, or both-side floats. Visual diagrams reinforce that clear does not remove the float but forces subsequent elements to start below it. The worked example then contrasts two scenarios: without clear, inline content wraps around the floated box; with 'clear: left', the element is pushed down. This comparison makes the practical effect of each value concrete and exam-relevant.