简体   繁体   English

右对齐div

[英]Right aligning a div

I am trying to align a div to the right but its only showing towards the bottom. 我正在尝试将div对齐到右侧,但仅向底部显示。

Issue 问题

CSS: CSS:

.homeWrapper{
    padding: 12px;
    width:auto;
}
.content_inner{
    height: auto;
    background-color: #6c93b8;
    margin:12px;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;
    border-radius:5px;
    clear:both;
}
.leftCol{
    display: inline-block;
    width:448px;
    background-color: red;
}
.rightCol{
    display: inline-block;
    width:430px;
    background-color: green;
    clear:both;
}

HTML: HTML:

    <div class="homeWrapper">
            <div class="content_inner">
                <h1><span class="color_red">Contact</span> Agrilife</h1>
                    <div class="leftCol">
                        {{ template:body }}
                    </div>
                    <div class="rightCol">
                        text
                        text
                        text

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

Try using float 尝试使用浮动

.leftCol{
    float:left;
    width:448px;
    background-color: red;
}
.rightCol{
    float:right;
    width:430px;
    background-color: green;
    clear:both;
}

Use float:right; 使用float:right; with .rightCol .rightCol

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM