How can I have a box that's automatically sized to its content (including form fields) and centered without using role="presentation" tables for layout? (I'm trying to modernize, and to reduce markup clutter.)
As you can see, I've got most of it (I think), but the form fields stick out of their container, which I suspect is down to fundamental errors in my CSS.
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
.app {
height: 100%;
padding-top: 20px;
}
.welcome {
text-align: center;
}
/* Center the box horizontally */
.center-wrapper {
display: flex;
justify-content: center;
}
/* The box I'm trying to center and size to content */
.login {
display: inline-block;
border: 1px solid black;
padding: 8px;
line-height: 1.8rem;
}
.login .fields {
margin-top: 8px;
display: grid;
grid-template-columns: 40% auto;
}
<div class="app">
<div class="center-wrapper">
<div class="login">
<div class="welcome"><strong>Welcome!</strong></div>
<div class="welcome">Please sign in</div>
<div class="fields">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">Password:</label>
<input id="user-email" type="password" size="25">
</div>
</div>
</div>
</div>
The form fields escape their container:
I don't want to assign fixed sizes to the elements and just make sure they fit, I want the box sized to its content and want it to handle the user zooming, different device sizes, etc.
The below gives the effect I'm looking for (very basically), but it uses a presentation table:
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
.app {
height: 100%;
padding-top: 20px;
}
.welcome {
text-align: center;
}
/* Center the box horizontally */
.center-wrapper {
display: flex;
justify-content: center;
}
/* The box I'm trying to center and size to content */
.login {
display: inline-block;
border: 1px solid black;
padding: 8px;
line-height: 1.8rem;
}
.login th {
font-weight: normal;
}
<div class="app">
<div class="center-wrapper">
<table class="login" role="presentation">
<tbody>
<tr>
<th colspan="2"><strong>Welcome!</strong></th>
</tr>
<tr>
<th colspan="2">Please sign in</th>
</tr>
<tr>
<td>
<label for="user-email">Email address:</label>
</td>
<td>
<input id="user-email" type="email" size="25" autofocus>
</td>
</tr>
<tr>
<td>
<label for="user-pass">Password:</label>
</td>
<td>
<input id="user-email" type="password" size="25">
</td>
</tbody>
</table>
</div>
</div>
Aside from not being great semantically (it's not really a table), I don't like the markup burden.
Either use 1fr auto so that the input will take the needed space and then the label will span the free space (you can consider some gap too)
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
.app {
height: 100%;
padding-top: 20px;
}
.welcome {
text-align: center;
}
/* Center the box horizontally */
.center-wrapper {
display: flex;
justify-content: center;
}
/* The box I'm trying to center and size to content */
.login {
/*display: inline-block; you don't need this */
border: 1px solid black;
padding: 8px;
line-height: 1.8rem;
}
.login .fields {
margin-top: 8px;
display: grid;
grid-template-columns: 1fr auto;
column-gap:10px;
}
<div class="app">
<div class="center-wrapper">
<div class="login">
<div class="welcome"><strong>Welcome!</strong></div>
<div class="welcome">Please sign in</div>
<div class="fields">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">Password:</label>
<input id="user-email" type="password" size="25">
</div>
</div>
</div>
</div>
Or consider 40% minmax(0,1fr) which will force the input to shrink to the remaining space
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
.app {
height: 100%;
padding-top: 20px;
}
.welcome {
text-align: center;
}
/* Center the box horizontally */
.center-wrapper {
display: flex;
justify-content: center;
}
/* The box I'm trying to center and size to content */
.login {
/*display: inline-block; you don't need this */
border: 1px solid black;
padding: 8px;
line-height: 1.8rem;
}
.login .fields {
margin-top: 8px;
display: grid;
grid-template-columns: 40% minmax(0,1fr);
}
<div class="app">
<div class="center-wrapper">
<div class="login">
<div class="welcome"><strong>Welcome!</strong></div>
<div class="welcome">Please sign in</div>
<div class="fields">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">Password:</label>
<input id="user-email" type="password" size="25">
</div>
</div>
</div>
</div>
Related: Why does minmax(0, 1fr) work for long elements while 1fr doesn't?
The first one will not shrink the inputs while the second one will do due to the use of percetange that is based on the initial width of the input and label.
Here is a before/after to see the percentage effect
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
.app {
height: 100%;
padding-top: 20px;
}
.welcome {
text-align: center;
}
/* Center the box horizontally */
.center-wrapper {
display: flex;
justify-content: center;
}
/* The box I'm trying to center and size to content */
.login {
/*display: inline-block; you don't need this */
border: 1px solid black;
padding: 8px;
line-height: 1.8rem;
}
.login .fields {
margin-top: 8px;
display: grid;
}
<div class="app">
<div class="center-wrapper">
<div class="login">
<div class="welcome"><strong>Welcome!</strong></div>
<div class="welcome">Please sign in</div>
<div class="fields" style="grid-template-columns:auto auto">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">Password:</label>
<input id="user-email" type="password" size="25">
</div>
<div class="fields" style="grid-template-columns:40% auto">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">Password:</label>
<input id="user-email" type="password" size="25">
</div>
<div class="fields" style="grid-template-columns:40% minmax(0,1fr)">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">Password:</label>
<input id="user-email" type="password" size="25">
</div>
</div>
</div>
</div>
The 40% was based on the width of the text and the input considering that both are set to auto which will logically create an overflow since (in your case) the 40% is bigger that the initial width of the label.
A longer text will produce a different result:
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
.app {
height: 100%;
padding-top: 20px;
}
.welcome {
text-align: center;
}
/* Center the box horizontally */
.center-wrapper {
display: flex;
justify-content: center;
}
/* The box I'm trying to center and size to content */
.login {
/*display: inline-block; you don't need this */
border: 1px solid black;
padding: 8px;
line-height: 1.8rem;
}
.login .fields {
margin-top: 8px;
display: grid;
}
<div class="app">
<div class="center-wrapper">
<div class="login">
<div class="welcome"><strong>Welcome!</strong></div>
<div class="welcome">Please sign in</div>
<div class="fields" style="grid-template-columns:auto auto">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">very very long label here</label>
<input id="user-email" type="password" size="25">
</div>
<div class="fields" style="grid-template-columns:40% auto">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">very very long label here</label>
<input id="user-email" type="password" size="25">
</div>
<div class="fields" style="grid-template-columns:40% minmax(0,1fr)">
<label for="user-email">Email address:</label>
<input id="user-email" type="email" size="25" autofocus>
<label for="user-pass">very very long label here</label>
<input id="user-email" type="password" size="25">
</div>
</div>
</div>
</div>
In the above, the label will shrink because 40% is smaller than the initial width of the label and the input will get bigger.
Concerning the first case, using 1fr auto is also the same as using auto auto because in your case the grid is a shrink to fit element (a flex item) so the content will define its width. The remaining space after setting the input to auto will simply be the initial width of the label.
Related
<div class="input-fields">
<div class="new">
<div class="first-container">
<form id="new-form" method="POST">
<div class="label">
<span class="fas fa-envelope icon"></span>
<input type="email" name="email-address" class="form-input" placeholder=" ">
</div>
<div class="label">
<span class="far fa-id-card icon"></span>
<input type="email" name="email-address" class="form-input" placeholder=" ">
</div>
<div class="label">
<span class="fas fa-user-tag icon"></span>
<input type="email" name="email-address" class="form-input" placeholder=" ">
</div>
<div>
</div>
</div>
</div>
<div>
<span class="divide">or</span>
</div>
<div class="login-field">
<div class="second-container">
<div class="label">
<span class="far fa-id-card icon"></span>
<input type="email" name="email-address" class="form-input" placeholder=" ">
</div>
<div class="label">
<span class="fas fa-key icon"></span>
<input type="email" name="email-address" class="form-input" placeholder=" ">
</div>
<div>
</div>
</div>
.fa-arrows-alt-h {
font-size: 30px;
color: #bbb;
}
.input-fields {
display: flex;
background: #F7F9F6;
}
.new {
width: 50%;
float: right;
border-right: 1px dashed #e9e9e9;
}
.form-input {
padding-left: 3.575rem;
height: calc(2.25rem + 2px);
font-size: 1.5rem;
}
.first-container {
display: inline-block;
float: right;
padding-right: 30px;
}
.second-container {
display: inline-block;
padding-left: 30px;
}
.divide {
position: absolute;
left: 0;
right: 0;
margin-left:auto;
margin-right:auto;
top: 20%;
}
I would like to align text, "or" in the middle of the vertical line.
I used left: 50% or 49%, however, it's broken when I shrink the window size for response test.
I couldn't use 'left:0; right: 0; because I did not know the width of text("or")
How can I align the word "or" in the middle of the vertical line?
Can anyone help, please?
Many thanks! :)
To your absolutely positioned span add these styles:
.divide{
left: 50%;
transform: translate(-50%);
}
It works see the codepen here: https://codepen.io/arnavozil/pen/mdVyWGr
The problem you had is that u're using flexbox and at the same time you're giving the containers specific width , instead you can use justify-content : center
.fa-arrows-alt-h {
font-size: 30px;
color: #bbb;
}
.input-fields {
justify-content: center;
display: flex;
display: flex;
background: #F7F9F6;
}
.new {
/* width: 50%; */
/* float: right; */
border-right: 1px dashed #e9e9e9;
}
.form-input {
padding-left: 3.575rem;
height: calc(2.25rem + 2px);
font-size: 1.5rem;
}
.first-container {
/* display: inline-block; */
/* float: right; */
padding-right: 30px;
}
.second-container {
/* display: inline-block; */
padding-left: 30px;
}
.divide {
/* position: absolute; */
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
/* top: 20%; */
} ```
I have a div named main-filter and within the div, I have two div. Now, I want to create a form with button, labels and input and I want to put two div inside the form and it should look like the below down screenshot. I have the HTML and CSS code but it is not working and couldn't figure out how to do it with CSS grid. I need to make it responsive as well!. I am totally new at CSS grid and any help would much be appreciated. Thank you.
.main-filter {
display: flex;
margin: 0px;
padding: 20px;
height: 90px;
background-color: #eff0f2;
color: #287993;
margin-bottom: 3rem;
}
.main-header__left {
display: grid;
grid-template-columns: auto 1fr;
grid-gap: 0.3em 0.6em;
grid-auto-flow: dense;
align-items: center;
float: left;
margin-left: 250px;
margin-right: 200px;
}
.main-header__right {
display: grid;
grid-template-columns: auto 1fr;
grid-gap: 0.3em 0.6em;
grid-auto-flow: dense;
align-items: center;
float: right;
}
.filter-button1 {
background: #38acd2;
color: #FFFFFF;
max-width: 380px;
min-width: 370px;
min-height: 35px;
font-weight: bold;
}
input,
button {
grid-column: 2 / 4;
width: auto;
margin: 0;
}
input {
width: 370px;
height: 30px;
border: 1px solid #38acd2;
}
<div className="main-filter">
<form onSubmit={this.addItem}>
<div className="main-header__left">
<label className="start-timestamp">Start Timestamp: </label>
<input type="text" ref={(input4)=> this.input4 = input4} className="input-item" id="addInput3" placeholder="Ex. 2019-1-12" />
<label className="source-ip-address">Source IP Address: </label>
<input type="text" name="source" ref={(input1)=> this.input1 = input1} className="input-item" id="addInput3" placeholder="127.0.0.1 " />
<label className="service">Service Name: </label>
<input type="text" name="service" ref={(input3)=> this.input3 = input3} className="input-item" id="addInput3" placeholder="Ex. Facebook or Whatsapp *" required />
</div>
<div className="main-header__right">
<label className="end-timestamp">End Timestamp: </label>
<input type="text" ref={(input5)=> this.input5 = input5} className="input-item" id="addInput3" placeholder="Ex. 2019-1-12" />
<label className="destinatin-ip-ddress">Destination IP Address:
</label>
<input type="text" name="destination" ref={(input2)=> this.input2 = input2} className="input-item" id="addInput3" placeholder="127.0.0.1 " />
<button type="submit" className="filter-button1">Apply
Filters</button>
</div>
</form>
</div>
css grid form Image screenshot,
Try using below code, I have modified HTML and CSS code, I hope this might help you to achieve expected result.
.main-filter {
/* margin: 0px; */
/* padding: 20px; */
height: 90px;
background-color: #eff0f2;
color: #287993;
}
form {
display: grid;
grid-template-columns: auto auto;
grid-gap: 15px;
}
.main-header__left>div,
.main-header__right>div {
display: flex;
}
.main-header__left>div>label,
.main-header__right>div>label {
width: 40%;
}
#media only screen and (max-width: 500px) {
/* .main-header__left {
grid-area: 2 / span 1;
grid-gap: 0;
} */
.main-header__right {
grid-area: 2 / span 1;
grid-gap: 0;
}
}
.filter-button1 {
background: #38acd2;
color: #FFFFFF;
min-height: 35px;
font-weight: bold;
border: none;
margin-top: 18px;
width: 100%;
}
input {
width: 100%;
height: 30px;
border: 1px solid #38acd2;
}
<div className="main-filter">
<form onSubmit={this.addItem}>
<div class="main-header__left">
<div>
<label class="start-timestamp">Start Timestamp: </label>
<input type="text" />
</div>
<div>
<label className="source-ip-address">Source IP Address: </label>
<input type="text" name="source" />
</div>
<div>
<label className="service">Service Name: </label>
<input type="text" name="service" />
</div>
</div>
<div class="main-header__right">
<div>
<label className="end-timestamp">End Timestamp: </label>
<input type="text" />
</div>
<div>
<label className="destinatin-ip-ddress">Destination IP Address:</label>
<input type="text" name="destination" />
</div>
<div>
<label></label>
<button type="submit" class="filter-button1">Apply Filters</button>
</div>
</div>
</form>
</div>
I am making my own portfolio and want to add a contact form on it. But the div which contains the form is overlapping the footer in small screens. You can see the problem by running the code snippet. Could anyone please help me to solve this? It will be a great help. Thank you so much.
#contactus {
height: 105vh;
margin: 0 auto -80px;
position: relative;
z-index: 1;
}
#formContainer{ width: 85%; margin: 0 auto; background-color: aqua; }
.contactHead{ text-align: center}
.footer{
height:250px;
background-color:#1e1e1e;
text-align:center;
display:flex;
align-items:center;
justify-content:center;
}
.footer h2{
color: #fff;
}
<div id="contactus">
<div id="formContainer">
<h1 class="contactHead">Get In Touch!</h1>
<h4 class="contactHead">I will be with you within 24 hours</h4>
<form id="contactForm">
<input type="text" id="nameContainer" placeholder="Name">
<br>
<br>
<input type="email" id="emailContainer" placeholder="Email Address">
<br>
<br>
<input type="text" id="messageContainer" placeholder="Message">
<br>
<br>
<input type="submit" value="Send Message">
</form>
</div>
</div>
<div class="footer">
<h2>Footer</h2>
</div>
The negative margin and height is messing things up. What is the reason for having that height and the negative margin?
#contactus {
margin: 0 auto;
position: relative;
z-index: 1;
}
#formContainer {
width: 85%;
margin: 0 auto;
background-color: aqua;
}
.contactHead {
text-align: center
}
.footer {
height: 250px;
background-color: #1e1e1e;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.footer h2 {
color: #fff;
}
<div id="contactus">
<div id="formContainer">
<h1 class="contactHead">Get In Touch!</h1>
<h4 class="contactHead">I will be with you within 24 hours</h4>
<form id="contactForm">
<input type="text" id="nameContainer" placeholder="Name">
<br>
<br>
<input type="email" id="emailContainer" placeholder="Email Address">
<br>
<br>
<input type="text" id="messageContainer" placeholder="Message">
<br>
<br>
<input type="submit" value="Send Message">
</form>
</div>
</div>
<div class="footer">
<h2>Footer</h2>
</div>
I am trying to align the button to the bottom of this div (so the bottom is flush with the bottom of textarea).
Codepen
I was able to do this by adding the following class to button:
.btn-bottom {
position: absolute;
top: 130px;
}
Unfortunately, doing so made the button disappear entirely on mobile:
How can I make the button align with the bottom of the textarea on desktop and with the left edge of the textarea on mobile?
<div class="padding">
<div class="container">
<div class="row">
<h3 class="text-center">Contact Us</h3>
<h5 class="text-center title-lighter">Our team will respond within 48 hours.</h5>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="col-md-4">
<label for="inputname">Name</label>
<input type="text" class="form-control" id="inputname">
</div>
<div class="col-md-4">
<label for="email">E-mail</label>
<input type="text" class="form-control" id="email">
</div>
<div class="col-md-4">
<label for="organization">Organization</label>
<input type="text" class="form-control" id="organization">
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="col-md-8">
<label for="message">Message</label>
<textarea class="form-control input-lg" style="min-width: 100%;" rows="5" id="message"></textarea>
</div>
<div class="col-md-4">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
<hr />
</div>
You could set the columns of the elements containing the textarea and the button to be display: inline-block (you would have to set float: none for this to work) and then use vertical-align: bottom to align the elements to the bottom of the line that they're siting on.
I also added a class of .row--mod to the row of the element containing the textarea and the button to help target the elements.
.row--mod .col-md-8.col-md-offset-2 > * {
float: none;
display: inline-block;
vertical-align: bottom;
}
.row--mod .col-md-8.col-md-offset-2> :first-child {
margin-right: -4px;
width: 66.6667%;
}
Using inline-block creates extra spacing which you can get rid using a number of methods (I've opted for a negative margin).
See below for a demo:
body {
font-size: 12px !important;
font-family: 'Roboto Condensed', sans-serif !important;
font-weight: 400 !important;
}
.title-lighter {
font-family: 'Roboto', Arial, Helvetica, sans-serif;
color: #737373;
}
.centering {
float: none;
margin: 0 auto;
}
.btn-centering {
width: 90% !important;
margin-left: 5% !important;
margin-bottom: 5px !important;
}
.padding {
padding: 80px 0;
}
.contact-form {
background: #fff;
margin-top: 10%;
margin-bottom: 5%;
width: 70%;
}
.contact-form .form-control {
border-radius: 1rem;
}
.contact-form form {
padding: 14%;
}
.contact-form form .row {
margin-bottom: -7%;
}
.contact-form h3 {
margin-bottom: 8%;
margin-top: -10%;
text-align: center;
color: #0062cc;
}
.contact-form .btnContact {
width: 50%;
border: none;
border-radius: 1rem;
padding: 1.5%;
background: #dc3545;
font-weight: 600;
color: #fff;
cursor: pointer;
}
.btnContactSubmit {
width: 50%;
border-radius: 1rem;
padding: 1.5%;
color: #fff;
background-color: #0062cc;
border: none;
cursor: pointer;
}
.centered-row {
text-align: center;
}
.btn-bottom {
display: table-cell;
vertical-align: bottom;
}
.box {
display: table !important;
width: 100%;
height: 100%;
}
#media (min-width: 992px)
{
.row--mod .col-md-8.col-md-offset-2 > * {
float: none;
display: inline-block;
vertical-align: bottom;
}
.row--mod .col-md-8.col-md-offset-2> :first-child {
margin-right: -4px;
width: 66.6667%;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="padding">
<div class="container">
<div class="row">
<h3 class="text-center">Contact Us</h3>
<h5 class="text-center title-lighter">Our team will respond within 48 hours.</h5>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="col-md-4">
<label for="inputname">Name</label>
<input type="text" class="form-control" id="inputname">
</div>
<div class="col-md-4">
<label for="email">E-mail</label>
<input type="text" class="form-control" id="email">
</div>
<div class="col-md-4">
<label for="organization">Organization</label>
<input type="text" class="form-control" id="organization">
</div>
</div>
</div>
<div class="row row--mod">
<div class="col-md-8 col-md-offset-2">
<div class="col-md-8">
<label for="message">Message</label>
<textarea class="form-control input-lg" style="min-width: 100%;" rows="5" id="message"></textarea>
</div>
<div class="col-md-4">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
<hr />
</div>
I am working on creating a page which has a fixed links on the top and fixed submit buttons at the bottom. The content in between is scrollable using overflow:auto;
I am noticing, when I reduce the browser window size the scroller slowly disappears.
How can I fix this? Are there any hacks?
I am working Firefox 19.0 and chrome version 26.0.1410.12 and IE9
Here is my code in its entirety:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>overflow based Layout</title>
<style type="text/css">
<!--
/* Pretty Stuff
================================== */
/* Zero down margin and paddin on all elements */
* {
margin: 0;
padding: 0;
}
body {
font: 92.5%/1.6"Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", Verdana, sans-serif;
}
h1 {
font-size: 2.4em;
font-weight: normal;
}
h2 {
font-size: 2.0em;
font-weight: normal;
}
p, li {
font-size: 1.4em;
}
h1, h2, p {
margin: 1em 0;
}
#branding h1 {
margin: 0;
}
#wrapper {
background-color: #fff;
}
#branding {
height: 50px;
background-color:#b0b0b0;
padding: 20px;
}
#form-b {
height: 500px;
overflow: auto;
position: fixed;
top: 164px;
width: 98%;
}
#mainNav {
list-style: none;
background-color:#eee;
}
#footer {
background-color:#b0b0b0;
padding: 1px 20px;
}
/* The Core Technique
================================= */
body {
text-align: center;
min-width: 1260px;
}
#wrapper {
width: 100%;
margin: 0 auto;
text-align: left;
}
#content {
width: 100%;
float: right;
}
#mainNav li {
/* width: 180px;
float: left; */
display:inline;
}
#submit-b {
border: 0px solid red;
bottom: 77px;
position: fixed;
text-align: cemter;
width: 100%;
}
#footer {
clear: both;
}
/* Add some padding
================================== */
#mainNav {
padding-top: 20px;
padding-bottom: 20px;
position: fixed;
width: 100%;
}
#mainNav * {
padding-left: 20px;
padding-right: 20px;
}
#mainNav * * {
padding-left: 0;
padding-right: 0;
}
#content * {
padding-right: 20px;
}
#content * * {
padding-right: 0;
}
-->
/* fieldset styling */
fieldset {
margin: 1em 0;
/* space out the fieldsets a little*/
padding: 1em;
border : 1px solid #ccc;
background-color:#F5F5F5
}
/* legend styling */
legend {
font-weight: bold;
}
form p {
position: relative;
width: 100%;
}
/* style for labels */
label {
float: left;
width: 10em;
}
#remember-me label {
width: 4em;
}
/* style for required labels */
label .required {
font-size: 0.83em;
color:#760000;
}
/* style error messages */
label .feedback {
position: absolute;
margin-left: 11em;
left: 200px;
right: 0;
font-weight: bold;
color:#760000;
padding-left: 18px;
background: url(images/error.png) no-repeat left top;
}
/* :KLUDGE: Explicitly set the width for IE6- */
* html .feedback {
width: 10em;
}
input {
width: 200px;
}
input[type="text"], textarea {
border-top: 2px solid #999;
border-left: 2px solid #999;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc;
}
input.radio, input.checkbox, input.submit {
width: auto;
}
/* style form elements on focus */
input:focus, textarea:focus {
background: #ffc;
}
input.radio {
float: left;
margin-right: 1em;
}
textarea {
width: 300px;
height: 100px;
}
/* Date of Birth form styling */
#monthOfBirthLabel, #yearOfBirthLabel {
text-indent: -1000em;
width: 0;
}
#dateOfBirth {
width: 3em;
margin-right: 0.5em;
}
#monthOfBirth {
width: 10em;
margin-right: 0.5em;
}
#yearOfBirth {
width: 5em;
}
/* Color form styling */
#favoriteColor {
margin: 0;
padding: 0;
border: none;
background: transparent;
}
#favoriteColor h2 {
width: 10em;
float: left;
font-size: 1em;
font-weight: normal;
}
#favoriteColor div {
width: 8em;
float: left;
}
#favoriteColor label {
/*width: 3em;*/
float: none;
display: inline;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="branding">
<h1>Branding</h1>
</div>
<div id="content">
<ul id="mainNav">
<li class="first">
Home
</li>
<li>
About
</li>
<li>
News
</li>
<li>
Products
</li>
<li>
Services
</li>
<li>
Clients
</li>
<li>
Case Studies
</li>
</ul>
<div id="form-b">
<form id="comments_form" action="#" method="post">
<fieldset>
<legend>Your Contact Details</legend>
<p>
<label for="author">Name: <span class="required">(Required)</span>
</label>
<input name="author" id="author" type="text" />
</p>
<p>
<label for="email">Email Address: <span class="feedback">Incorrect email address. Please try again.</span>
</label>
<input name="email" id="email" type="text" />
</p>
<p>
<label for="url">Web Address:</label>
<input name="url" id="url" type="text" />
</p>
</fieldset>
<fieldset>
<legend>Your Contact Details</legend>
<p>
<label for="author">Name: <span class="required">(Required)</span>
</label>
<input name="author" id="author" type="text" />
</p>
<p>
<label for="email">Email Address: <span class="feedback">Incorrect email address. Please try again.</span>
</label>
<input name="email" id="email" type="text" />
</p>
<p>
<label for="url">Web Address:</label>
<input name="url" id="url" type="text" />
</p>
</fieldset>
<fieldset>
<legend>Your Contact Details</legend>
<p>
<label for="author">Name: <span class="required">(Required)</span>
</label>
<input name="author" id="author" type="text" />
</p>
<p>
<label for="email">Email Address: <span class="feedback">Incorrect email address. Please try again.</span>
</label>
<input name="email" id="email" type="text" />
</p>
<p>
<label for="url">Web Address:</label>
<input name="url" id="url" type="text" />
</p>
</fieldset>
<fieldset>
<legend>Your Contact Details</legend>
<p>
<label for="author">Name: <span class="required">(Required)</span>
</label>
<input name="author" id="author" type="text" />
</p>
<p>
<label for="email">Email Address: <span class="feedback">Incorrect email address. Please try again.</span>
</label>
<input name="email" id="email" type="text" />
</p>
<p>
<label for="url">Web Address:</label>
<input name="url" id="url" type="text" />
</p>
</fieldset>
<fieldset id="submit-b">
<legend></legend>
<p>
<input id="submit" class="submit" name="submit" type="submit" />
</p>
</fieldset>
</form>
</div>
</div>
<div id="footer">
<p>Footer</p>
</div>
</div>
</body>
</html>
Reduce the padding to 10px:
#content * {
padding-right: 10px; /* Line 106 */
}