Tsallaka zuwa abun ciki
Justice Tech School

display, visibility and hidden

display: none removes an element from layout. visibility: hidden keeps its space. opacity: 0 hides it but keeps it clickable. Choose by what the layout should do.

Example
<style>
.a { display: none } .b { visibility: hidden } div { background: #1e293b; margin: 4px 0; padding: 4px }
</style>
<div>Before</div><div class="a">removed</div><div class="b">invisible but takes space</div><div>After</div>

Exercise

Keep the space.

: hidden;

Quiz Test

Which removes the element from layout?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.