CSS Grid layout for a form - css

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>

Related

Size centered box to content (including form fields)

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.

How to center ui-float-label

I'm having the following template:
<div class="smallCard">
<p-card class="centered">
<p-header>
<img width="200" height="100" src="assets/images/vendor.svg" />
</p-header>
<p-messages></p-messages>
<span class="ui-float-label">
<input id="username" type="text" pInputText [(ngModel)]="username" required>
<label for="username">{{'Username' | translate}}</label>
</span>
<br>
<span class="ui-float-label">
<input id="password" type="password" pPassword [feedback]="false" [(ngModel)]="password" required />
<label for="password">{{'Password' | translate}}</label>
</span>
<br>
<p-checkbox name="permanent" value="true" label="{{'Remember me' | translate}}" [(ngModel)]="isPermanent">
</p-checkbox>
<p-footer>
<p-button label="Login" (onClick)="login()"></p-button>
</p-footer>
</p-card>
</div>
Where as the important css classes are:
.centered
{
text-align: center;
}
.smallCard
{
margin-top: 20%;
margin-left: 40%;
margin-right: 40%;
}
Which results in:
Obviously the labels aren't centered / aligned with the inputs. But how do I achieve this with primeng's float labels?
The label should have an absolute position;
For example:
var element = document.getElementById("label");
function handleFocus() {
element.classList.add("active");
}
function handleBlur() {
var myInput = document.getElementById("input");
if (!myInput.value) {
element.classList.remove("active");
}
}
.wrapper {
position: relative;
}
label {
position: absolute;
display: flex;
align-items: center;
height: 50px;
left: 10px;
}
.active {
height: 20px;
}
input {
padding: 5px;
widt: 100px;
height: 40px;
border: 2px solid purple;
border-radius: 4px;
}
<div class='wrapper'>
<label id='label'>blabla</label>
<input id='input'
onFocus="handleFocus();"
onBlur="handleBlur();"
/>
</div>

how to fix a problem with radio input costumized with css?

I am doing an input radio customized with everything I learned about it step by step.
When I click on the older/standard radio inputs (without hiding them yet) everything is fine, I click on the old radio buttons and the new customized respective is checked.
But when I click on the newly customized radio buttons, they don't work as supposed to be.
The problem is that when I click the 2nd and 3rd customized radio it checks the 1rst automatically.
I really need your help because I don't know where I am failing. I already look from examples codes on the internet and it was exactly what I did so I don't really understand where is the problem that I should correct.
.content {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.items {
display: flex;
}
label {
display: flex;
align-items: center;
margin-left: 1rem;
}
.radio__span {
width: 1.2rem;
height: 1.2rem;
border-radius: 50%;
border: 3px solid #049372;
margin-right: .5rem;
display: flex;
align-items: center;
justify-content: center;
}
.radio:checked+.radio__span::before {
content: "";
display: block;
width: .8rem;
height: .8rem;
border-radius: 50%;
background-color: #049372;
}
/* .radio{
width:0;
height:0;
opacity:0;
visibility:hidden;
} */
<div class="content">
<div class="items">
<label for="chk">
<input type="radio" name="dev" class="radio" id="chk">
<span class="radio__span"></span>
<p>Frontend</p>
</label>
<label for="chk">
<input type="radio" name="dev" class="radio" id="chk">
<span class="radio__span"></span>
<p> Backend</p>
</label>
<label for="chk">
<input type="radio" name="dev" class="radio" id="chk">
<span class="radio__span"></span>
<p>Fullstack</p>
</label>
</div>
</div>
I expect to click on the new radio buttons and be checked.
IDs must be unique. Once fixed, you need to then update your label elements to point to the new IDs. Fix that and it works fine.
.content {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.items {
display: flex;
}
label {
display: flex;
align-items: center;
margin-left: 1rem;
}
.radio__span {
width: 1.2rem;
height: 1.2rem;
border-radius: 50%;
border: 3px solid #049372;
margin-right: .5rem;
display: flex;
align-items: center;
justify-content: center;
}
.radio:checked+.radio__span::before {
content: "";
display: block;
width: .8rem;
height: .8rem;
border-radius: 50%;
background-color: #049372;
}
/* .radio{
width:0;
height:0;
opacity:0;
visibility:hidden;
} */
<div class="content">
<div class="items">
<label for="chk1">
<input type="radio" name="dev" class="radio" id="chk1">
<span class="radio__span"></span>
<p>Frontend</p>
</label>
<label for="chk2">
<input type="radio" name="dev" class="radio" id="chk2">
<span class="radio__span"></span>
<p> Backend</p>
</label>
<label for="chk3">
<input type="radio" name="dev" class="radio" id="chk3">
<span class="radio__span"></span>
<p>Fullstack</p>
</label>
</div>
</div>
That is happening because of your for attribute which is looking for an input with an Id named chk, as you have got all three checkboxes with the same ID, it is checking the first...
The following would work:
.content {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.items {
display: flex;
}
label {
display: flex;
align-items: center;
margin-left: 1rem;
}
.radio__span {
width: 1.2rem;
height: 1.2rem;
border-radius: 50%;
border: 3px solid #049372;
margin-right: .5rem;
display: flex;
align-items: center;
justify-content: center;
}
.radio:checked+.radio__span::before {
content: "";
display: block;
width: .8rem;
height: .8rem;
border-radius: 50%;
background-color: #049372;
}
<div class="content">
<div class="items">
<label for="chk">
<input type="radio" name="dev" class="radio" id="chk">
<span class="radio__span"></span>
<p>Frontend</p>
</label>
<label for="chk1">
<input type="radio" name="dev" class="radio" id="chk1">
<span class="radio__span"></span>
<p> Backend</p>
</label>
<label for="chk2">
<input type="radio" name="dev" class="radio" id="chk2">
<span class="radio__span"></span>
<p>Fullstack</p>
</label>
</div>
</div>

(CSS only) Display section when wrapped input is checked

my overall goal is to have different inputs inline which when clicked show a section. I try to rely solely on CSS in this case. Until now it worked quite good; however since the input is wrapped into several other divs the section remains not displayed even when input is checked.
I tried different approaches in CSS to overcome the wrappers around the input... none were successful.
main {
min-width: 320px;
max-width: 100%;
height: auto;
padding: 20px;
margin: 0 auto;
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #f3f3f3;
}
#tab1,
#tab2,
#tab3,
#tab4 {
display: none;
}
.profile_overview {
margin-top: 2%;
width: 100%;
height: 40vh;
display: flex;
justify-content: space-between;
}
.profile_one,
.profile_two,
.profile_three,
.profile_four {
width: 22.5%;
height: 100%;
border-radius: 8px;
background-color: white;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
}
.labeltab {
padding: 15px 25px;
font-weight: 600;
text-align: center;
color: #bbb;
border: 1px solid transparent;
}
.labeltab:before {
font-weight: lighter;
margin-right: 10px;
}
.labeltab:hover {
color: white;
cursor: pointer;
}
input:checked + .labeltab {
color: white;
border: 1px solid #f3f3f3;
}
#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4 {
display: block;
}
<main>
<div class="profile_overview">
<div class="profile_one">
<input id="tab1" type="radio" name="tabs" value="a" />
<label class="labeltab" for="tab1">A</label>
</div>
<div class="profile_two">
<input id="tab2" type="radio" name="tabs" value="b" />
<label class="labeltab" for="tab2">B</label>
</div>
<div class="profile_three">
<input id="tab3" type="radio" name="tabs" value="c" />
<label class="labeltab" for="tab3">C</label>
</div>
<div class="profile_four">
<input id="tab4" type="radio" name="tabs" value="d" />
<label class="labeltab" for="tab4">D</label>
</div>
</div>
<section id="content1">
<p>1</p>
</section>
<section id="content2">
<p>2</p>
</section>
<section id="content3">
<p>3</p>
</section>
<section id="content4">
<p>4</p>
</section>
</main>
Since there is no parent's selector in CSS, your inputs have to be ahead in the code and sibblings for the closest position.
you have well linked your labels and inputs via the id and for attributes, you need to place your input as first children inside the parent container or just ahead where your content boxes are.
Your CSS selectors will then work fine.
main {
min-width: 320px;
max-width: 100%;
height: auto;
padding: 20px;
margin: 0 auto;
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #f3f3f3;
}
#tab1,
#tab2,
#tab3,
#tab4 {
display: none;
}
.profile_overview {
margin-top: 2%;
width: 100%;
height: 40vh;
display: flex;
justify-content: space-between;
}
.profile_one,
.profile_two,
.profile_three,
.profile_four {
width: 22.5%;
height: 100%;
border-radius: 8px;
background-color: white;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
}
.labeltab {
padding: 15px 25px;
font-weight: 600;
text-align: center;
color: #bbb;
border: 1px solid transparent;
}
.labeltab:before {
font-weight: lighter;
margin-right: 10px;
}
.labeltab:hover {
color: white;
cursor: pointer;
}
input:checked+.labeltab {
color: white;
border: 1px solid #f3f3f3;
}
#tab1:checked~#content1,
#tab2:checked~#content2,
#tab3:checked~#content3,
#tab4:checked~#content4 {
display: block;
}
<main>
<!-- here is the HTML update structure to use the ::checked state to toggle display on next sibblings -->
<input id="tab1" type="radio" name="tabs" value="a" />
<input id="tab2" type="radio" name="tabs" value="b" />
<input id="tab3" type="radio" name="tabs" value="c" />
<input id="tab4" type="radio" name="tabs" value="d" />
<!-- end update -->
<div class="profile_overview">
<div class="profile_one">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab1">A</label>
</div>
<div class="profile_two">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab2">B</label>
</div>
<div class="profile_three">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab3">C</label>
</div>
<div class="profile_four">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab4">D</label>
</div>
</div>
<section id="content1">
<p>1</p>
</section>
<section id="content2">
<p>2</p>
</section>
<section id="content3">
<p>3</p>
</section>
<section id="content4">
<p>4</p>
</section>
</main>

CSS overflow : How to fix css overflow scroll bug

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 */
}

Resources