2014-02-05 60 views
0

我有3个按钮,我需要保持固定在页面的右下角。页脚按钮固定?

Example

但是,当我设置position:fixed,它直接到顶部(这也是固定的)。

我怎样才能让他们留在那里,但当我滚动跟着我?

谢谢!

回答

0

添加position: fixed; bottom: 0;,并删除top:0;,底部属性设置元素的底部边缘。

试试这个代码:

DEMO

#buton{text-align:right; 
    height: 100px; 
    width: 100%; 
    z-index: 100; 
    position: fixed; 
    bottom: 0; 
    } 
+0

莫名其妙地好,它遵循滚动,但它不是定位在角落里。 – Silviu

+0

http://jsfiddle.net/manojmcet/Fvn7J/1/ – Manoj

+0

Manoj,这很好,但他们固定在


。我怎样才能让它们变得更低? – Silviu

0

删除

top:0

,并设置

bottom:0; position: fixed; right: 0;

#buton { 
text-align: right; 
height: 100px; 
width: 100%; 
z-index: 100; 
position: fixed; 
bottom: 0; 
right: 0; 
} 

See Fiddle Demo

+0

仍然没有放在角落里。如果我保持windown最大化,它将重叠在我在那里的桌子上。它高于


Silviu

0

问题是与top:0;既然你需要的按钮固定停留在页面的右下角,你应该使用bottom: 0;position: fixed;

更新以下部分

#buton{ 
    text-align:right; 
    height: 100px; 
    top: 0; 
    width: 100%; 
    z-index: 100; 
    } 

以下给出的,

#buton{ 
    text-align:right; 
    height: 100px; 
    bottom:0; 
    position: fixed; 
    width: 100%; 
    z-index: 100; 
    } 

它会像魅力一样工作。

已经取得了一些变化,看到了演示..

UPDATE: See demo

0
  • 包裹一切在container,并给它的位置relative

  • 使#butonabsolutebottom:0

  • 保持myButton独立于任何位置的

working demo

html,body{ 
    height:100%; /* important */ 
} 
#conatiner { 
    position: relative;/* added*/ 
    height:100%;/* important */ 
} 
#buton { 
    text-align:right; 
    width: 100%; 
    z-index: 100; 
    position: absolute;/* added*/ 
    bottom: 0; 
}