【问题标题】:Trying to place a form at the top of a div试图将表单放在 div 的顶部
【发布时间】:2016-09-29 02:20:25
【问题描述】:

我在页面底部放置了一个小框。我试图在 div 上方放置一个表单,但表单不断跳入引导 div。

这是 html 尝试 编辑: 我还希望表单中的行具有与面包屑相同的背景颜色,但它没有显示

<div style="padding:1px; background-color: #F2F2F2;">
    <form class="rightiest" method="post" action="/logout">
            <input class="btn btn-link" type="submit" value="Leave Group"/>
    </form>
</div>
 <div class="breadcrumb">
            <div class="wrap">
                <div class="container" style="text-align: center;font-size: 80%;">
                <strong> Please hold we will soon attend to you shortly</strong>



                </div>
            </div> 
</div>

这是控制表单的css

 form.rightiest {float:right; margin-top:0px; margin-bottom:7px;}

通过上述方式,表单不断重叠到 div 中。请问如何将表单放在 div 的正上方。

【问题讨论】:

    标签: html css css-position positioning


    【解决方案1】:

    你需要清除你的花车。

    .breadcrumb {
       clear: both;
    }
    

    【讨论】:

    • 是的,您需要更改表单的下边距,可能还需要更改表单上的填充。如果您的面包屑上的顶部填充或顶部边距也可能需要更改。
    【解决方案2】:

    清除浮动。

         form.rightiest {float:right;
           margin-top:0px;
           margin-bottom:7px;}
        
        .breadcrumb {
           clear: both;
        }
    <form class="rightiest" method="post" action="/logout">
                <input class="btn btn-link" type="submit" value="Leave Chat"/>
        </form>
         <div class="breadcrumb">
                    <div class="wrap">
                        <div class="container" style="text-align: center;font-size: 80%;">
                        <strong> Please hold we will soon attend to you shortly</strong>
        
        
        
                        </div>
                    </div> 
        </div>

    【讨论】:

    • 我正在应用背景颜色,但没有显示
    • 跨度>
    • 您能否编辑您的问题以显示 BG 颜色请@user6731422
    猜你喜欢
    • 1970-01-01
    • 2012-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多