簡體   English   中英

如何水平對齊單選按鈕

[英]How to align radio button horizontally

我有帶標簽的單選按鈕輸入,但是我不能水平對齊它們,它只是一個接一個地垂直出現,我怎么能讓它一個接一個地水平對齊。

<div class="cc-selector-2" align="right">
       {{range $index,$url := .Avatars}}                                            
         <label for="pic1">                                                                  
         <input type="radio" name="avatar" id={{$url}} value={{$url}} />               
         <img src={{$url}} alt="" height="40" width="40"/>                                                                                                   
         </label>
         {{end}}
 </div>

 <style>      
.cc-selector-2 input{
    position:absolute;
    z-index:999;
}

    label {
        display: block;
        text-align: center;
        margin-bottom:0px;
        font-size: .85em;
        background-color:buttonface;
    }

 </style>

只需使用display:inline-block;)

 cc-selector-2{ text-align: center; } label { display: inline-block; margin:auto; font-size: .85em; background-color:buttonface; } input { margin: 0; } 
 <div class="cc-selector-2" align="right"> <label for="pic1"> <input type="radio" name="avatar" id={{$url}} value={{$url}} /> <img src={{$url}} alt="" height="40" width="40"/> </label> <label for="pic1"> <input type="radio" name="avatar" id={{$url}} value={{$url}} /> <img src={{$url}} alt="" height="40" width="40"/> </label> </div> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM