[英]Align a checkbox input and a <p> tag in the same line
我已經看到了使用標簽解決此問題的大多數其他解決方案。 不幸的是,我不能在這種特殊情況下使用標簽,因為那樣會使事情搞砸。 我有以下內容:
<div className="terms-checkbox">
<input type="checkbox" required />
<p>I accept the Terms and Conditions</p>
</div>
而且我將顯示設置為terms-checkbox
內聯塊,如下所示:
.terms-checkbox {
display: inline-block;
}
但是,這不會使項目水平/在同一行中對齊。 在不使用label
包裝input
label
,如何使復選框和p
標簽水平對齊?
這是小提琴鏈接: https : //jsfiddle.net/eu5rso2a/1/
編輯:固定縮進。
<p><input type="checkbox" required/>I accept the Terms and Conditions</p>
您必須將terms-checkbox
類設置為input或p標簽。 不是他們的父母。 意味着您的input
和p
標簽必須是inline-block
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.