Jump to content

How do you make an empty div render without nbsp or setting dimensions?


tibberous

Recommended Posts

  Quote

agrd

 

Argh, I think it's argh

 

anyway back to business ...

 

  Quote

... or have font tags that are the same type font as you'll be using with a line height.

 

I guess that's all BuildMyWeb and I can add to the buffet.

For the record... the div will always exist in the DOM.  However, a div with no attributes / properties / content will have a 0 height - much akin to a clear-fix div (people still use those?). Like the two dudes above said, it can be easily fixered.

First, the DOM will show the div. But, I'm guessing you have only given it a height, which means the div may be 1 million pixels high, but you will never see it if its width is a 0. Trying giving it a width or a min-width.  :D

  Quote

First, the DOM will show the div. But, I'm guessing you have only given it a height, which means the div may be 1 million pixels high, but you will never see it if its width is a 0. Trying giving it a width or a min-width.  :D

 

What are you talking about? Divs are native block elements, which means you NEVER have to set width unless you're overriding it or are using it positioned.  Furthermore, your post further has no relevance to the OP.

@ floridaflatlander:

 

my apologies for not being clearer (or maybe you are just being clever ;)).

 

anywho, to be abundantly clear to other readers, i meant "Agreed."  as in i agree with floridaflatlander's statement.  without more information, i would say giving a height, or more precisely, a min-height would be the best start.

  • 2 weeks later...
  • 1 month later...

Sure is.

 

For your div set the height, width and position. You can have either relative or absolute, if you set absolute you can then set the top and left positions using

 

position: absolute;
top: 50px;
left: 100px;

 

Matt

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.