首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在页面右下角添加固定按钮

如何在页面右下角添加固定按钮
EN

Stack Overflow用户
提问于 2013-10-05 02:23:07
回答 3查看 183.2K关注 0票数 37

我在我的网页底部添加一个固定按钮时遇到了一些问题。我一直在用像素测试不同的数字,但按钮没有显示在右侧页面的下面。

HTML

代码语言:javascript
复制
<a href="#head"><img src="upbutton.png" id="fixedbutton"></a>

CSS

代码语言:javascript
复制
.fixedbutton {
    position: fixed;
    bottom: 560px;
    right: 1000px; 
}
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-10-05 02:25:01

您在CSS (类)中指定了.fixedbutton,并在元素本身上指定了id

将CSS更改为以下内容,这将选择id which按钮

代码语言:javascript
复制
#fixedbutton {
    position: fixed;
    bottom: 0px;
    right: 0px; 
}

这是JoshC提供的jsFiddle

票数 86
EN

Stack Overflow用户

发布于 2021-08-04 17:57:32

代码语言:javascript
复制
.bottomFixButtionComponent{
  position: sticky;
  bottom: 0px;
  padding-top: 10px;
  background: yellowgreen;
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0px -4px 3px rgb(27 27 24 / 75%);
  }
代码语言:javascript
复制
       <h1> Bottom Fix component </h1>
      
        <div class="bottomFixButtionComponent"> 
          <button>Clear </button>
          <div>|</div>
          <button>Submit </button>
         </div>

票数 1
EN

Stack Overflow用户

发布于 2021-08-04 17:59:50

代码语言:javascript
复制
.bottomFixButtionComponent{
  position: fixed;
  bottom: 0px;
  padding-top: 10px;
  background: yellowgreen;
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0px -4px 3px rgb(27 27 24 / 75%);
  }
代码语言:javascript
复制
<h1> Bottom Fix component </h1>
      
        <div class="bottomFixButtionComponent"> 
          <button>Clear </button>
          <div>|</div>
          <button>Submit </button>
         </div>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19188211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档