DEV Community

Harshad Prajapati
Harshad Prajapati

Posted on

Common CSS Interview questions - Opacity Zero vs Display none

So it's a common question.

Many of you are familiar with it.

However, having information can be beneficial not only for interviews but also for our actual development.

Opacity - zero
Imagine a dark room with no light. You are present inside, but you cannot see anything. Nevertheless, that room does exist in reality.

Therefore, in the end, something is present, but it remains unseen.

Display none
In this case, there is no room at all. You cannot enter the room, and it simply does not exist.

All the best 😊

Top comments (2)

Collapse
 
iamjaydev profile image
iamjaydev

Great post! I like your analogy.

Collapse
 
harshad_tweet profile image
Harshad Prajapati

@iamjaydev Thanks