如何在另一个dIV内垂直对齐DIV

时间:2014-08-25 19:52:44

标签: html css asp.net

<div class="dispLoginSearch">
    <div class="theLoginBox">
        <span class="loginTitle">
            Log in to <span style="font-family: 'blackjarregular'; font-size: 14pt; color: #FE7816;">My</span> <span style="font-family: 'trajanpro'; font-size: 12pt; color: #00529B;">WD</span> | Sign Up
        </span>
    </div>
</div>

CSS:

.dispLoginSearch
{
    width: 47%;
    height: 100%;
    float: right;
    text-align: right;
    padding-right: 2%;
}
.theLoginBox
{
    border: 2px solid #D5D5D5;
    border-radius: 10px;
    width: 440px;
    height: 125px;
    float: right;
    padding: 10px;
    vertical-align: top;
}
.loginTitle
{
    font-weight: bold;
    text-align: left;
    background: #808080;
}

显示:

enter image description here

我要做的是以下内容:

enter image description here

我如何修改我的代码以实现上面Log in...左上角后面的表格?

1 个答案:

答案 0 :(得分:1)

    .divToBeCentered{
         margin-left:auto;
         margin-right:auto;
         position:relative
     }
对不起......我要改写这个

这里是jsfiddle link