左/右浮动按钮在div [英] left/right float button inside div

查看:293
本文介绍了左/右浮动按钮在div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让按钮只在div区域中浮动?

How can i make button float only in div area ?

这里是我的例子css和html ..

Here is my example css and html..

HTML

<div class='test'>
  <div style='float: left;'>
    <button>test</button>
  </div>
  <div style='float: right;'>
    <button>test</button>
  </div>
</div>

CSS

.test {
  width:60%;
  display:inline;
  overflow: auto;
  white-space: nowrap;
  margin:0px auto;
}

或者你可以在这里看到现场样本 - > http://jsfiddle.net/ELAVS/

or you can see live sample here -> http://jsfiddle.net/ELAVS/

我想要喜欢这个..

/ p>

推荐答案

更改显示:inline显示:inline-block

Change display:inline to display:inline-block

.test {
  width:200px;
  display:inline-block;
  overflow: auto;
  white-space: nowrap;
  margin:0px auto;
  border:1px red solid;
}

这篇关于左/右浮动按钮在div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆