Ich habe derzeit ein Formular mit 1 Schaltfläche, und wenn ich versuche, einen weiteren Button hinzuzufügen, wird die ganze CSS geschraubt.2 Tasten in einem Formular
Dies ist, wie ich es haben wollen wie folgt aussehen: http://prntscr.com/gfuvi8
Aber wenn Sie diese Zeile unter dem Button Dies ist <a href="?do=fetch" class="button"><i class="fa fa-refresh"></i> Fetch Exchange</a>
einreichen hinzufügen, was ich bekommen: http://prntscr.com/gfuwka
.tablesection {
\t padding: 20px;
\t border-left: 1px solid #e4e4e4;
\t border-right: 1px solid #e4e4e4;
\t border-bottom: 1px solid #e4e4e4;
\t background: #ffffff;
}
.tablesection label {
\t width: calc(50% - 10px);
\t float: left;
\t margin: 0px 0px 10px 0px;
}
.tablesection label:nth-child(odd) {
\t margin: 0px 20px 10px 0px;
}
.tablesection input, .tablesection select, .tablesection textarea {
\t width: calc(50% - 10px);
\t margin: 0px 0px 20px 0px;
\t padding: 10px;
\t display: block;
\t float: left;
\t border: 1px solid #cecece;
\t -webkit-border-radius: 0;
\t border-radius: 0;
}
.tablesection textarea {
\t resize: vertical;
}
.tablesection input:nth-child(odd), .tablesection select:nth-child(odd) {
\t margin: 0px 20px 20px 0px;
}
.tablesection input {
\t padding: 11px 10px;
\t width: calc(50% - 10px);
}
.tablesection input.submit {
\t width: auto;
\t border: 0px;
\t margin: 0px 0px 0px 0px;
\t background: #54809b;
\t color: #ffffff;
\t text-decoration: none;
\t display: block;
\t float: none;
\t font-size: 11px;
\t padding: 12px 20px;
\t -webkit-transition: background 0.5s linear;
\t -moz-transition: background 0.5s linear;
\t -ms-transition: background 0.5s linear;
\t -o-transition: background 0.5s linear;
\t transition: background 0.5s linear;
\t clear: both;
}
.tablesection input.submit:hover {
\t background: #4d758d;
}
.tablesection input.submit::before {
\t display: block;
\t content: ' ';
\t clear: both;
}
<div class="tablesection">
\t <form action="" method="post">
\t
\t \t <label for="usd">USD</label>
\t \t <label for="cad">CAD</label>
\t \t <input id="usd" type="text" name="usd" value="<?php echo $siteUsd; ?>" maxlength="10" required="required" />
\t \t <input id="cad" type="text" name="cad" value="<?php echo $siteCad; ?>" maxlength="10" required="required" />
\t
\t \t <label for="gbp">GBP</label>
\t \t <label for="eur">EUR</label>
\t \t <input id="gbp" type="text" name="gbp" value="<?php echo $siteGbp; ?>" maxlength="10" required="required" />
\t \t <input id="eur" type="text" name="eur" value="<?php echo $siteEur; ?>" maxlength="10" required="required" />
\t \t
\t \t <label for="aud">AUD</label>
\t \t <label for=""></label>
\t \t <input id="aud" type="text" name="aud" value="<?php echo $siteAud; ?>" maxlength="10" required="required" />
\t <div class="clear">
\t </div>
\t <input type="submit" class="submit" value="Update Exchange Rates" />
\t <a href="?do=fetch" class="button"><i class="fa fa-refresh"></i> Fetch Exchange</a>
\t </form>
</div>
.content a.button:first-of-type {
margin: 20px 0px 0px 0px;
}
.content a.button {
background: #54809b;
color: #ffffff;
text-decoration: none;
display: block;
float: left;
margin: 20px 0px 0px 16px;
font-size: 11px;
padding: 12px 20px;
-webkit-transition: background 0.5s linear;
-moz-transition: background 0.5s linear;
-ms-transition: background 0.5s linear;
-o-transition: background 0.5s linear;
transition: background 0.5s linear;
}
.content a.button:hover {
background: #4d758d;
}
.content a.button i {
margin: 0px 4px 0px 0px;
font-size: 10px;
}
, wenn es nur zwei Tasten wie diese sind:
<a href="?do=search" class="button"><i class="fa fa-search"></i> Search Coupons</a>
<a href="?do=add" class="button"><i class="fa fa-plus"></i> Add Coupon</a>
dann seine feine und sie sind in der Nähe von einander das Problem ist in Form
dies passiert, wenn ich die minimale Version versuche http://prntscr.com/gfw69i – empire
Ah, Float-Elemente werden nicht berücksichtigt bei der Berechnung der Höhe. Sie können ein Dummy-Element hinzufügen, um den von ihnen abgedeckten Bereich zu füllen, oder Sie können sie in 'display: inline-block' ändern und nicht mit Floats umgehen. Aktualisierung meiner Antwort – Armando