Heim  >  Artikel  >  Web-Frontend  >  css 定位_html/css_WEB-ITnose

css 定位_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:12:351303Durchsuche

大家好
如下html代码:








我想实现,mainTool 一直在底部,content  的高度是除了mainTool之外的。所以我的css这样写:
*{margin:0;padding:0;}html,body{    height: 100%;}body{    background: black;}#content {    height:100%;    border-bottom: 50px; }#mainTool  {    position:absolute;   //这里设置绝对定位,当有这一句时,整个mainTool都消失不见了。去掉的话就可以见到。    bottom: 0px;     //使它一直在底部    background-color: yellow ;    height: 50px;     //高度为固定的50px;}
 

不知道css是哪里出问题,求大家帮忙


回复讨论(解决方案)

#mainTool  {    position:absolute;    bottom: 0px;    background-color: yellow ;    height: 50px;    width:100%; /*增加这一条样式*/}

原来如此。谢谢。可以了。
CSS code
#mainTool  {
    position:absolute;
    bottom: 0px;
    background-color: yellow ;
    height: 50px;
    width:100%; /*增加这一条样式*/
}

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn