How can I align a label and a range input field on the same line?
I have tried using display: inline-block
, but it does not seem to work.
There doesn't appear to be any conflicting styles, and all sources indicate that this approach should be effective.
HTML
<form id="msform" method="post" action="quoteresult.php">
<!-- progressbar -->
<ul id="progressbar">
<li class="active">Debts</li>
<li>Assets</li>
<li>Contact</li>
</ul>
<!-- fieldsets -->
<fieldset>
<h2 class="fs-title" style="margin-bottom: 0px;">What You Owe</h2>
<h3 class="fs-subtitle">Your company's financial position</h3>
<label style="display:inline-block;" for="overdraft">Overdraft:</label><input type="range" name="overdraft" id="overdraft" value=0 min=0 max=1000000 step="500" />
<output for="overdraft">1</output>
<label for="vat">VAT:</label>
<input type="range" name="vat" id="vat" value=0 min=0 max=1000000 step="500" />
<output for="vat">1</output>
<label for="paye">PAYE:</label>
<input type="range" name="paye" value=0 min=0 max=1000000 step="500"/>
<output for="paye">1</output>
<label for="corporationtax">Corporation Tax:</label>
<input type="range" name="corporationtax" value=0 min=0 max=1000000 step="500" />
<output for="corporationtax">1</output>
<label for="tradecreditors">Trade Creditors:</label>
<input type="range" name="tradecreditors" value=0 min=0 max=1000000 step="500" />
<output for="tradecreditors">1</output>
<label for="rent">Rent:</label>
<input type="range" name="rent" value=0 min=0 max=1000000 step="500" />
<output for="rent">1</output>
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
<fieldset>
<h2 class="fs-title" style="margin-bottom: 0px;">Asset Values</h2>
<h3 class="fs-subtitle">What are your assets worth?</h3>
<label for="debtors">Debtors:</label>
<input type="range" name="debtors" value=0 min=0 max=1000000 step="500" />
<output for="debtors">1</output>
<label for="fixtures">Fixtures:</label>
<input type="range" name="fixtures" value=0 min=0 max=1000000 step="500"/>
<output for="fixtures">1</output>
<label for="stock">Stock:</label>
<input type="range" name="stock" value=0 min=0 max=1000000 step="500" />
<output for="stock">1</output>
<label for="vehicles">Vehicles:</label>
<input type="range" name="vehicles" value=0 min=0 max=1000000 step="500" />
<output for="vehicles">1</output>
<label for="cash">Cash:</label>
<input type="range" name="cash" value=0 min=0 max=1000000 step="500" />
<output for="cash">1</output>
<label for="plant">Plant/Machinery:</label>
<input type="range" name="plant" value=0 min=0 max=1000000 step="500"/>
<output for="plant">1</output>
<label for="property">Property:</label>
<input type="range" name="property" value=0 min=0 max=1000000 step="500" />
<output for="property">1</output>
<label for="other">Other:</label>
<input type="range" name="other" value=0 min=0 max=1000000 step="500" />
<output for="other">1</output>
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input type="button" name="next" class="next action-button" value="Next" />
</fieldset>
<fieldset>
<h2 class="fs-title" style="margin-bottom: 0px;">Personal Details</h2>
<h3 class="fs-subtitle">We will never sell it</h3>
<input type="text" name="fname" placeholder="First Name" />
<input type="text" name="lname" placeholder="Last Name" />
<input type="text" name="company" placeholder="Company Name" />
<input type="text" name="phone" placeholder="Phone" />
<input type="text" name="email" placeholder="Email" />
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input type="submit" name="submit" class="submit action-button" value="Submit" />
</fieldset>
</form>
CSS
/*custom font*/
@import url(http://fonts.googleapis.com/css?family=Montserrat);
/*basic reset*/
* {margin: 0; padding: 0;}
html {
height: 100%;
/*Image only BG fallback*/
background: url('http://thecodeplayer.com/uploads/media/gs.png');
/*background = gradient + image pattern combo*/
background:
linear-gradient(rgba(196, 102, 0, 0.2), rgba(155, 89, 182, 0.2)),
url('http://thecodeplayer.com/uploads/media/gs.png');
}
body {
font-family: montserrat, arial, verdana;
}
/*form styles*/
#msform {
width: 95%px;
margin: 0px auto;
text-align: center;
position: relative;
}
#msform fieldset {
background: white;
border: 0 none;
border-radius: 3px;
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
padding: 10px 15px;
box-sizing: border-box;
width: 80%;
margin: 0 10%;
/*stacking fieldsets above each other*/
position: absolute;
}
/*Hide all except first fieldset*/
#msform fieldset:not(:first-of-type) {
display: none;
}
/*inputs*/
#msform input, #msform textarea {
padding: 15px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 10px;
width: 100%;
box-sizing: border-box;
font-family: montserrat;
color: #2C3E50;
font-size: 13px;
display:inline-block;}
#msform label {
display:inline-block;
}
/*buttons*/
#msform .action-button {
width: 100px;
background: #27AE60;
font-weight: bold;
color: white;
border: 0 none;
border-radius: 1px;
cursor: pointer;
padding: 10px 5px;
margin: 10px 5px;
}
#msform .action-button:hover, #msform .action-button:focus {
box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60;
}
/*headings*/
.fs-title {
font-size: 15px;
text-transform: uppercase;
color: #2C3E50;
margin-bottom: 10px;
}
.fs-subtitle {
font-weight: normal;
font-size: 13px;
color: #666;
margin-bottom: 20px;
}
/*progressbar*/
#progressbar {
margin-bottom: 30px;
overflow: hidden;
counter-reset: step;
}
#progressbar li {
list-style-type: none;
color: white;
text-transform: uppercase;
font-size: 9px;
width: 33.33%;
float: left;
position: relative;
}
#progressbar li:before {
content: counter(step);
counter-increment: step;
width: 20px;
line-height: 20px;
display: block;
font-size: 10px;
color: #333;
background: white;
border-radius: 3px;
margin: 0 auto 5px auto;
}
#progressbar li:after {
content: '';
width: 100%;
height: 2px;
background: white;
position: absolute;
left: -50%;
top: 9px;
z-index: -1;
}
#progressbar li:first-child:after {
content: none;
}
#progressbar li.active:before, #progressbar li.active:after{
background: #27AE60;
color: white;
}
.msform label, .myfields input {
}
.msform label {
width:200px;
}