简体   繁体   English

div中的垂直对齐元素

[英]Vertical-align element in div

I have a div with css : 我有一个div与CSS:

.row
{
width: 100%;
margin-bottom: 3px;
padding: 5px;
border-radius: 7px;
background-color: #F3F3F3;
text-align: right;
min-height: 20px;
}

and use a style for span : 并为span使用样式:

  .rowtitle
{
display: inline-block;
border-radius: 5px;
background-color: white;
padding: 3px;
margin-left: 5px;
width: 55px;
}

In html, i use it. 在html中,我使用它。

   <div class="row" style="vertical-align:top">
    <span class="rowtitle" style="width:85px">جنسیت  </span>
       <asp:RadioButtonList ID="jensiatRadioButtonList" runat="server" RepeatDirection="Horizontal" >
         <asp:ListItem Selected="True" Value="1">مرد</asp:ListItem>
         <asp:ListItem Value="0">زن</asp:ListItem>
       </asp:RadioButtonList>
   </div>

but when my control width is big span set to bottom of div. 但是当我的控件宽度很大时,将其设置为div的底部。

and when i use a radiobutton, it set botton of div. 当我使用单选按钮时,它会设置div的botton。

I want set element to top of div. 我想将元素设置为div的顶部。

在此处输入图片说明

在.rowtitle中添加float:right;clear:both

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

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