Welcome to WebmasterWorld Guest from 54.161.25.142

Forum Moderators: not2easy

Message Too Old, No Replies

Prevent <li></li> collapse if empty

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

10+ Year Member



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?
8:48 pm on Sep 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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?

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

10+ Year Member



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>

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

WebmasterWorld Senior Member 10+ Year Member



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?
3:59 am on Sep 11, 2008 (gmt 0)

5+ Year Member



set a "line-height" in your style
4:42 am on Sep 11, 2008 (gmt 0)

10+ Year Member



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>

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

WebmasterWorld Senior Member 5+ Year Member



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.

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

5+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month