如何設定一個指定高度的DIV_CSS/HTML

來源:互聯網
上載者:User
1、要設定一下overflow呀.將不要得hidden起來呀!
<!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"> <HTML><HEAD><TITLE>test</tITLE><STYLE type=text/css> #me{margin:0px; height:5px; background-color:#CC9966;overflow:hidden} </sTYLE><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></hEAD> <BODY><!--頁面頭部--> <!--頁面頭部結束--> <!-- 搜尋版塊--> </bODY></hTML>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]
2、font-size:1px;
<!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"> <HTML><HEAD><TITLE>test</tITLE><STYLE type=text/css> #me{margin:0px; height:5px; background-color:#CC9966;font-size:1px;} </sTYLE> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></hEAD> <BODY><!--頁面頭部--> <!--頁面頭部結束--> <!-- 搜尋版塊--> </bODY></hTML>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]
樓上也正確.其實原理差不多.
DIV屬於塊元素.在它裡面會有一些行元素等等.overflow:hidden是將這些隱藏元素隱藏起來.而用FONT-SIZE設定為1PX只是將之設為1PX.同理得.因為偶是小菜菜.所以說得是偶自己得理解.術語不正確別怪偶!
  • 相關文章

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.