0

尝试将按钮浮动到右侧时遇到了一个奇怪的问题;

非浮动:

没有浮动 http://puu.sh/3Afx1.png

向右浮动(我希望它出现在右下角,但仍在范围内):

向右浮动 http://puu.sh/3AfzF.png

HTML:

                <div class="portlet box red modify-menus-page-portlet">
                        <div class="portlet-title">
                            <div class="caption"><i class="icon-external-link"></i>Custom URL</div>
                        </div>
                        <div class="portlet-body" style="display: block;">
                        Add a menu link to a custom URL.
                        <br>
                        <br>
                            <div class="control-group">
                                <div class="controls">
                                    <input type="text" placeholder="Enter custom text..." class="m-wrap span12">
                                    <input type="text" placeholder="Enter custom URL..." class="m-wrap span12">
                                </div>
                            </div>
                        <button style="float:right;" class="btn red add-menu-link-button">Add <i class="icon-arrow-right"></i></button>
                        </div>
                </div>

CSS:

.modify-menus-page-portlet {
  margin-left: 24px;
}

.portlet.box.red {
border: 1px solid #ef8476;
border-top: 0;
}

.portlet.box {
padding: 0px !important;
}

.modify-menus-page-portlet {
margin-left: 24px;
}

.portlet {
clear: both;
margin-top: 0px;
margin-bottom: 25px;
padding: 0px;
}

.portlet.box .portlet-body {
background-color: #fff;
padding: 10px;
}
.portlet-body {
clear: both;
padding: 0;
}
4

1 回答 1

1

添加overflow:auto到您的.modify-menus-page-portlet规则:

.modify-menus-page-portlet {
    margin-left: 24px;
    overflow:auto;
}
于 2013-07-11T13:10:45.227 回答