CSS Opacity

Duration: 3 min

This video lesson is available to enrolled students.

Enroll to watch — RSSB (Senior Computer Instructor)

AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This lecture introduces the CSS opacity property, which controls an element's transparency level. The instructor defines that a value of 1 is fully visible (the default), while 0 is completely transparent, with values in between creating varying levels of transparency. The syntax selector { opacity: value; } is presented alongside three visual examples showing a forest footbridge image at 0.2, 0.5, and 1.0 opacity. The lesson then transitions to a practical example using the :hover pseudo-class, where an img selector sets default opacity to 0.5 and img:hover overrides it to 1.0, demonstrating how images become fully opaque on mouse-over.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The slide titled 'CSS Opacity' states that the opacity property controls the transparency level of an element. Bullets read 'opacity: 1; → Fully visible (default)' and 'opacity: 0; → Completely transparent (invisible)', with values between 0 and 1 creating different levels. A syntax block shows 'selector { opacity: value; }' with red check marks drawn beneath it. Three photos of a forest footbridge are labeled 'opacity 0.2', 'opacity 0.5', and 'opacity 1.0 (default)', showing the image getting clearer left to right.

  2. 2:00 – 3:27 02:00-03:27

    The video transitions to a practical example titled 'Opacity and :hover'. The code shows an img selector setting default opacity to 0.5, overridden by img:hover { opacity: 1.0; }. The instructor uses red circles and arrows to connect the CSS rules to their visual effect, demonstrating how a forest image transitions from semi-transparent to fully opaque when hovered over. The on-screen text notes that 'Opacity is often used with :hover to change the opacity on mouse-over.'

The lesson progresses from conceptual definition to practical application. First, the opacity property is defined with its 0-to-1 scale and syntax. Visual examples using a forest footbridge image at three opacity levels (0.2, 0.5, 1.0) reinforce the concept. The second half applies this knowledge by combining opacity with the :hover pseudo-class, showing how default and hover states work together to create interactive effects. The instructor's use of red circles, arrows, and check marks helps connect code syntax to visual outcomes.

Loading lesson…