Jump to content

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


Recommended Posts

agrd

 

Argh, I think it's argh

 

anyway back to business ...

 

... 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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.