l o o s e l y typed

How to display an empty div in HTML using CSS

Empty div(s) collapse only if its height is not set. Thus setting height/min-height of the empty div will show it correctly.

To avoid specifying any explicit height, set the CSS min-height property as below -

min-height: 1px;

Other references/options/tricks -

  • http://stackoverflow.com/questions/1616879/is-it-possible-to-render-empty-div-style-width50-div-with-css-in-xhtml
  • http://stackoverflow.com/questions/6177593/why-does-my-empty-div-collapse-although-it-has-a-width-when-display-inline-is-us
  • http://stackoverflow.com/questions/1479239/how-to-force-an-hiddenempty-div-to-take-up-space
1 comment:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
( Labels: css, html, web-dev ) ( Posted on: July 18, 2012 )
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ►  2015 (1)
    • ►  June (1)
  • ►  2014 (2)
    • ►  August (2)
  • ►  2013 (9)
    • ►  October (1)
    • ►  September (2)
    • ►  April (5)
    • ►  February (1)
  • ▼  2012 (15)
    • ►  December (3)
    • ►  October (3)
    • ►  August (1)
    • ▼  July (1)
      • How to display an empty div in HTML using CSS
    • ►  June (1)
    • ►  April (5)
    • ►  March (1)

Labels

android (1) apache (1) backstretch (1) bootstrap (1) citrix-receiver (1) collaboration-tools (2) colors (1) css (1) eclipse (1) excel (1) fullpage.js (1) generic (1) google-apps (2) html (3) java (1) javascript (4) jquery (4) kde (2) kde-plasma-desktop (2) lampp (1) linux (1) microsoft (1) outlook.com (1) phpmyadmin (1) poi (1) putty (1) software (1) tools (1) trojan (1) ubuntu (12) ubuntu-compiz (1) ubuntu-unity (1) vim (1) web-dev (4) wordpress (1) xampp (1) zoho-apps (1)

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Search This Blog

Powered by Blogger.