tibberous Posted August 18, 2012 Share Posted August 18, 2012 I need an empty div to show up at the height it will be once it has text, before it has text. Is there a way to force it to always display, without putting in ? Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/ Share on other sites More sharing options...
floridaflatlander Posted August 18, 2012 Share Posted August 18, 2012 Off hand I say add height or min height to the div or have font tags that are the same type font as you'll be using with a line height. Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370540 Share on other sites More sharing options...
BuildMyWeb Posted August 18, 2012 Share Posted August 18, 2012 Quote Off hand I say add height or min height to the div ... agrd Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370542 Share on other sites More sharing options...
floridaflatlander Posted August 18, 2012 Share Posted August 18, 2012 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. Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370546 Share on other sites More sharing options...
Mahngiel Posted August 19, 2012 Share Posted August 19, 2012 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. Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370615 Share on other sites More sharing options...
jardrake Posted August 19, 2012 Share Posted August 19, 2012 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. Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370721 Share on other sites More sharing options...
Mahngiel Posted August 19, 2012 Share Posted August 19, 2012 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. 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. Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370739 Share on other sites More sharing options...
BuildMyWeb Posted August 20, 2012 Share Posted August 20, 2012 @ 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. Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1370795 Share on other sites More sharing options...
hakimserwa Posted August 31, 2012 Share Posted August 31, 2012 why would you want to do that anyway Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1374168 Share on other sites More sharing options...
matthewtbaker Posted October 5, 2012 Share Posted October 5, 2012 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 Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1382863 Share on other sites More sharing options...
Mahngiel Posted October 5, 2012 Share Posted October 5, 2012 On 10/5/2012 at 12:56 PM, matthewtbaker said: ... and position. You can have either relative or absolute... There is also fixed and static Link to comment https://forums.phpfreaks.com/topic/267289-how-do-you-make-an-empty-div-render-without-nbsp-or-setting-dimensions/#findComment-1382885 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.