Home > Web Front-end > HTML Tutorial > About li placeholder issue_html/css_WEB-ITnose

About li placeholder issue_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:20:29
Original
1624 people have browsed it

This post was last edited by liwan123 on 2013-04-10 18:44:27

CSS

Now I have multiple divs with code similar to



      >

  • The Great Master sent away

  • Group Company

  • 2001-06-01

  • To be implemented soon



The css style is .lsoftware-summary{float:left;padding:1px;width:960px;}
.lsoftware-summary li{float:left;line-height:26px; white-space:nowrap;overflow:hidden;font-size:14px;text-align:center;margin-left:1px;background:#E1F0FF;display:block;}
.lbianhao{width:120px;zoom: 1;}
.lmingcheng{width:510px;zoom:1;}
.lbumen{width:160px;zoom:1;}
.lriqi{width:90px;zoom:1;}
.lzhuangtai{width:70px;zoom:1;}
.ztfontcolorg{color:#F00;}
.ztfontcolorx{color:#000;}
.ztfontcolorj{color:#090;}
.ztfontcolorz{color:#900;}
Now there is a problem. When the content between
  • Group Company
  • is empty, the placeholder is not displayed directly, but The li at the back is directly added to the front. I don’t know how to solve this problem?

    Reply to the discussion (solution)

    Use JS to determine whether the element Class=lbumen has a value. If it has no value, hide the element or hide the upper level UL

    <style type="text/css">.lsoftware-summary{float:left;padding:1px;width:960px;} .lsoftware-summary li{float:left;line-height:26px;white-space:nowrap;overflow:hidden;font-size:14px;text-align:center;margin-left:1px;background:#E1F0FF;display:block;} .lbianhao{width:120px;zoom:1;} .lmingcheng{width:510px;zoom:1;} .lbumen{width:160px;zoom:1;} .lriqi{width:90px;zoom:1;} .lzhuangtai{width:70px;zoom:1;} .ztfontcolorg{color:#F00;} .ztfontcolorx{color:#000;} .ztfontcolorj{color:#090;} .ztfontcolorz{color:#900;}</style><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script type="text/javascript">	$(function(){		if($("div ul li:eq(2)").text()==""){			$(this).hide();		}	});</script><DIV class="lsoftware-summary ztfontcolorx" name="testD"> <UL class="clearfix">   <ul>     <li class="lbianhao">206231991</li>   </ul>    <LI class="lmingcheng"> 的发生大法师打发</LI>   <LI class="lbumen">集团公司</LI>   <LI class="lriqi">2001-06-01</LI>   <LI class="lzhuangtai">即将实施</LI> </UL> </DIV>
    Copy after login

    What I mean is to force li to occupy space, not to hide it when there is no content in li. Is there any good way to do this?

    Set the height or use an empty text placeholder

    Thank you, I used whitespace symbols to achieve it, haha ​​


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title></title><style>.lsoftware-summary{float:left;padding:1px;width:960px;}.lsoftware-summary li{float:left;line-height:26px;white-space:nowrap;overflow:hidden;font-size:14px;text-align:center;margin-left:1px;background:#E1F0FF;display:block;}.lbianhao{width:120px;zoom:1; float:left; display:inline; height:26px; line-height:26px;}.lmingcheng{width:510px;zoom:1;}.lbumen{width:160px;zoom:1;}.lriqi{width:90px;zoom:1;}.lzhuangtai{width:70px;zoom:1;}.ztfontcolorg{color:#F00;}.ztfontcolorx{color:#000;}.ztfontcolorj{color:#090;}.ztfontcolorz{color:#900;}</style></head><body><DIV class="lsoftware-summary ztfontcolorx" name="testD"><UL class="clearfix">  <ul>    <li class="lbianhao"></li>  </ul>   <LI class="lmingcheng"> 的发生大法师打发</LI>  <LI class="lbumen">集团公司</LI>  <LI class="lriqi">2001-06-01</LI>  <LI class="lzhuangtai">即将实施</LI></UL></DIV></body></html>
    Copy after login

    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template