homepage Welcome to WebmasterWorld Guest from 50.17.176.149
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: DrDoc

CSS Forum

    
Prevent <li></li> collapse if empty
matthewamzn




msg:3742280
 8:37 pm on Sep 10, 2008 (gmt 0)

I'm trying to make a table structure with lists. When there is nothing between <li></li> it seems to collapse. Is there a way to maintain it's width?

 

D_Blackwell




msg:3742294
 8:48 pm on Sep 10, 2008 (gmt 0)

Can you supply a CSS/HTML code sample that replicates the issue? I'm not understanding the reference and difference between 'collapse' and 'maintain its width.?

Could it be, in this case, as simple as:

<li>
&nbsp;
</li>

just to put something in the container?

matthewamzn




msg:3742313
 9:17 pm on Sep 10, 2008 (gmt 0)

I'm querying my database and there isn't always a result found. When there isn't a result I can't get CSS to keep the width.

.list1_origin {
width:60px;
display:block;
float:left;
overflow:hidden;
}

<li class="list1_origin">(result from database)</li>

D_Blackwell




msg:3742416
 1:38 am on Sep 11, 2008 (gmt 0)

Outside of my area, but can you handle it from that side? IF - no result found - THEN - and insert some sort of default 'place holder' which would provide the width?

lighting




msg:3742470
 3:59 am on Sep 11, 2008 (gmt 0)

set a "line-height" in your style

matthewamzn




msg:3742481
 4:42 am on Sep 11, 2008 (gmt 0)

I ended up adding a function. I guess css has to have something between the tags in order to set the width.

.list1_origin {
width:60px;
display:block;
float:left;
overflow:hidden;
}

function no_result_space($value) {
if (!isset($value)) {
echo "&nbsp;";
} else {
return $value;
}
}

<li class="list1_origin">no_result_space(some_value)</li>

alt131




msg:3742491
 5:36 am on Sep 11, 2008 (gmt 0)

matthewamzn - just missed you!

From a usability perspective, my first was with D_Blackwell - provide some indication the cell is intentionally "blank". (Although that may be obvious from the other data being displayed.)

Otherwise, simple height should do it. As in height:30px - whatever measurement will apear similar to the visual "line-height" of the <li>'s with content.

sgietz




msg:3742708
 1:17 pm on Sep 11, 2008 (gmt 0)

May I ask why you want to display empty results? :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved