কম্পিউটার টিউটোরিয়াল

CSS display: none এবং visibility: hidden-এর পার্থক্য


CSS display: none

display: none প্রোপার্টি এলিমেন্ট ডিলিট না করেই লুকাতে ব্যবহৃত হয়। এটি কোনো স্পেস নেয় না।

<!DOCTYPE html> <html>   <head>     <style>       h3 {         display: none;       }     </style>   </head>   <body>     <h2>This heading is visible</h2>     <h3>This is a hidden heading</h3>     <p>The hidden heading does not take up space even after hiding it since we have used display: none;.</p>   </body> </html>

CSS visibility: hidden

visibility: hidden প্রোপার্টিও এলিমেন্ট লুকায়, কিন্তু লেআউটে প্রভাব ফেলে অর্থাৎ স্পেস নেয়। উদাহরণ দেখুন:

<!DOCTYPE html> <html>   <head>     <style>       h3 {         visibility: hidden;       }     </style>   </head>   <body>     <h2>This heading is visible</h2>     <h3>This is a hidden heading</h3>     <p>The hidden heading takes up space even after hiding it.</p>   </body> </html>

  1. CSS Visibility vs Display

  2. CSS Display এবং Visibility-এর পার্থক্য

  3. CSS-এ Display None ব্যবহার

  4. CSS-এ Pseudo-Class এবং Pseudo-Element-এর পার্থক্য