CSS - display: none; VS visibility: hidden;
dono CSS properties hain jo kisi HTML element ko page par hide karne ke
liye use hoti hain, lekin inke beech kuch important differences hain:
display: none;
- Element completely remove ho jata hai DOM layout se. Matlab, wo space
occupy nahi karega aur page layout uske bina adjust ho jata hai.
- Element page par exist hi nahi karta, to user iske saath interact nahi kar sakta.
- Jab aap kisi element ko completely hide karna chahte hain jisse wo page ka layout effect na kare.
visibility: hidden;
- Element page ke layout me exist karega, lekin invisible rahega. Matlab, wo apni jagah ka space occupy karega, lekin dikhai nahi dega.
- Element ke saath interaction nahi hoga (e.g., click, hover), lekin uska space page par dikhega.
- Jab aap kisi element ko temporarily invisible karna chahte hain lekin layout disturb nahi karna chahte.