首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能让按钮向右浮动

不能让按钮向右浮动
EN

Stack Overflow用户
提问于 2016-03-10 13:18:58
回答 1查看 704关注 0票数 0

我正在开发一个Chrome扩展,我从本站上拿了一些可爱的切换开关来添加到我的主页上。

向右浮动似乎对切换没有影响,我想避免使用边距来定位它们。如果开关能在上面的第三组按钮下面排列,那就太好了。

有什么想法吗?

代码语言:javascript
复制
     <div class="row" id="row-6">
    <div class="debug">
      Debug Automation Chains
    </div>
    <div class="onoffswitch">
      <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="debug-switch">
      <label class="onoffswitch-label" for="debug-switch">
        <span class="onoffswitch-inner"></span>
        <span class="onoffswitch-switch"></span>
      </label>
    </div>
  </div>

  <div class="row" id="row-7">
    <div class="ui-dev-mode">
      UI Development Mode
    </div>
    <div class="onoffswitch">
      <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="devmode-switch">
      <label class="onoffswitch-label" for="devmode-switch">
        <span class="onoffswitch-inner"></span>
        <span class="onoffswitch-switch"></span>
      </label>
    </div>
  </div>`

`

代码语言:javascript
复制
.onoffswitch {
    position: relative;
    width: 90px;
    -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
    display: none;
}
.onoffswitch-label {
    display: block; overflow: hidden; cursor: pointer;
    border: 2px solid #8F8F8F; border-radius: 10px;
}
.onoffswitch-inner {
    display: block; width: 200%; margin-left: -100%;
    transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
    display: block; float: left; width: 50%; height: 17px; padding: 0; line-height: 17px;
    font-size: 10px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
    box-sizing: border-box;
}
.onoffswitch-inner:before {
    content: "ENABLED";
    padding-left: 10px;
    background-color: #00a3db; color: #FFFFFF;
}
.onoffswitch-inner:after {
    content: "DISABLED";
    padding-right: 10px;
    background-color: #EEEEEE; color: #999999;
    text-align: right;
}
.onoffswitch-switch {
    display: block; width: 9px; margin: 4px;
    background: #FFFFFF;
    position: absolute; top: 0; bottom: 0;
    right: 69px;
    border: 2px solid #8F8F8F; border-radius: 10px;
    transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 0px;
}

`

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-10 13:40:56

没有链接和一些css是很难帮助的。你能试一下以下几种方法吗?

代码语言:javascript
复制
.row{
    display: block;
    float: left;
    width: 100%;
}

.debug, .ui-dev-mode {
    float: left;
}

.onoffswitch {
  float: right;
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35917691

复制
相关文章

相似问题

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