我想在不使用flex的情況下使專案水平對齊。在下面的例子中,我希望標簽、輸入和跨度都能水平對齊。目前display:flex作業正常,但我想不使用flex
。< div class="input-group"/span> style="display: flex; align-items: center;">
<label style="width: 7rem; display: inline-block;"/span>>
<span class="control-label" style="color: rgb(64, 64, 64); font-family: Arial; font-size: 50px!important;font-size: 15px; line-height: 1.5;">電子郵件:</span>
<span class="compulsory"> *</span>
<small class="smallExplain"/span>> </small>>
</label>/span>
< input class="form-control"/span> type="email" name="emailId" placeholder="Email" required=" style="color: rgb(100, 96, 96); font-family: Arial; margin-bottom: 0px; width: 100%; padding: 0.375rem 0.75rem; line-height: 1.5; background-color: rgb(255, 255, 255); border: 3px solid rgb(0,0,0); border-radius:0.7rem !important; border-radius: 0.25rem;"/span>>
</div>/span>
uj5u.com熱心網友回復:
你可以手動添加margin-right: auto和margin-left: auto css在你的輸入和標簽上。
例如:
style.css
label {
margin-right: auto;
margin-left: auto;
}
input {
margin-right: auto;
margin-left: auto;
}
讓我知道它是否有效。
uj5u.com熱心網友回復:
.input-group{ margin: "auto"; }
添加margin - auto可以在不使用flexbox的情況下使div居中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/326106.html
標籤:
