0
我只想问一问,我该如何让它并排?我知道这已经在这里多次提出质疑,但我已经尝试过他们说过的解决方案。例如添加<div>
或在<div>
或使用box-sizing
放置课程包装但它们都不起作用。带有图例并排的CSS/HTML字段集
有什么建议吗?
编辑: 这里是我的代码:
CSS:
html, body, h1, form, legend, ol, li {
margin: 0;
padding: 0;
}
body {
background: dimgray;
color: #dimgray;
font-family: "Gill Sans MT", sans-serif;
padding: 15px;
}
/*size of the gray box inside legend*/
form#payment {
background: #696969;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
width: 400px;
}
/*title in the legend/legend itself*/
form#payment legend {
color: #ffffff;
font-size: 16px;
}
/*legend inside the Card details (choosing of card type)*/
form#payment fieldset fieldset legend {
color: #111111;
font-size: 13px;
font-weight: normal;
padding-bottom: 0;
}
/*gray box inside legend*/
form#payment ol li {
background: rgba(255,255,255,.3);
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
line-height: 30px;
list-style: none;
padding: 5px 10px;
margin-bottom: 2px;
}
form#payment ol ol li {
background: none;
border: none;
float: left;
}
/*input details/label*/
form#payment label {
float: left;
font-size: 13px;
width: 110px;
}
/*arrangement/organization of card type legend*/
form#payment fieldset fieldset label {
background:none no-repeat left 50%;
line-height: 20px;
padding: 0 0 0 30px;
width: auto;
}
form#payment input:not([type=radio]),
form#payment textarea {
background: #ffffff;
border: none;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
font: "Gill Sans MT", sans-serif;
outline: none;
padding: 5px;
width: 200px;
}
/*radio button position*/
form#payment input[type=radio] {
float: left;
margin-right: 5px;
}
form#payment button {
background: #191970;
border: none;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
border-radius: 20px;
color: #ffffff;
font: 18px "Gill Sans MT", sans-serif;
letter-spacing: 1px;
padding: 7px 25px;
text-transform: uppercase;
}
HTML:
<form id="payment">
<fieldset>
<legend>Delivery address</legend>
<ol>
<li>
<label>Address</label>
<textarea name="address" rows="5" required></textarea>
</li>
<li>
<label>Post code</label>
<input name="postcode" type="text" required>
</li>
<li>
<label>Country</label>
<input name="country" type="text" required>
</li>
</ol>
</fieldset>
<fieldset>
<legend>Card details</legend>
<ol>
<li>
<fieldset>
<legend>Card type</legend>
<ol>
<li>
<input name="cardtype" type="radio">
<label for="visa">VISA</label>
</li>
<li>
<input name="cardtype" type="radio">
<label for="mastercard">Mastercard</label>
</li>
</ol>
</fieldset>
</li>
<li>
<label>Card number</label>
<input name="cardnumber" type="number" required>
</li>
<li>
<label>Security code</label>
<input name="secure" type="number" required>
</li>
<li>
<label>Name on card</label>
<input name="namecard" type="text" placeholder="Exact name as on the card" required>
</li>
</ol>
</fieldset>
<br>
<button type="submit">Buy it!</button>
</form>
代码,我可以”不是真的使用引导或基础我真的只是一个初学者。但是这里是代码https://jsfiddle.net/aLfh78sn/ – bruh
使用像Bootstrap这样的框架是真正为初学者制作的。 我会建议使用Bootstrap并从那里开始。 – Bertjuhh
好的,所以我为你做了一个非常快速和肮脏的解决方案。使用Bootstrap网格(硬编码)到CSS中。界面有点混乱,导致你的CSS。但至少你有你想要/需要的结果。 https://jsfiddle.net/aLfh78sn/7/ – Bertjuhh