Go Back   Webmaster Forums UK SEO SEM Webmaster Community Forum - UKWW > General > General Webmaster Talk
Register FAQ Members List Downloads Calendar Today's Posts Webmaster Resources Webmaster Blogs
 
 

General Webmaster Talk General webmaster discussion forums - In this forum and its sub forums you can discuss general webmaster related issues or even issues that does not related to Webmastering.
Sub Forums: Running a forum :: Blogs and Blogging :: Word Press Forums :: Digital Photography

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-05-2007, 11:00 AM
Junior Member
0 posts this year. needs some grease!
New user, who has not interacted much yet.
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Default Styling forms with CSS

Ok I am new here so apologies if this has been covered before.
I noticed a thread going over ways to style specific form elements and thought the following may be of interest.

When creating web forms I usually style the layout through css manipulation, say we have a simple form like
HTML Code:
<form action="#">

	<fieldset>
		<legend>Some Details</legend>

		<div class="row">
			<label for="name">Your Name</label>
			<span class="formw">
				<input type="text" name="name" id="name"  size="25" />
			</span>
		</div>
			
		<div class="row">
			<label for="email">Your Email</label>
			<span class="formw">
				<input type="text" name="email" id="email"  size="25" />
			</span>
		</div>
		
		<div class="row">
			<label for="password">Your password</label>
			<span class="formw">
				<input type="password" name="password"  id="password" size="25" />
			</span>
		</div>
		<br />
	</fieldset>

	<span class="formw"><input type="submit" value="Send Message" /></span>
	<br />
</form>
You will note that along with the standard form elements I have used the <fieldset> tag which basically draws a rectangle around an area, the <label> tag which specifies lbel text for a specific form element and I have intorduced a custom div class named "row" and a custom span class called "formw".

All of these are reworked in my css file to create a nicely formatted form.

css

Code:
form
{
	width:400px;
	font-size:.75em;
	padding: 20px 15px 15px 20px;
	border: 3px #999 solid;
	-moz-border-radius:15px;
}
input, textarea, select
{
	font-size:inherit;
	font-family:Verdana, Arial, Helvetica, sans-serif; 
}
fieldset
{
	padding: 10px 15px 20px 30px;
	background: #E1E1E1;
	border: 1px #999 solid;
	margin-bottom:15px;
	-moz-border-radius:15px;
}
legend
{
	background: #fff;
	padding: 2px 6px;
	border: 1px #999 solid;
	-moz-border-radius:15px;
}
.row
{
  clear: both;
  padding-top: 5px;
}

label
{
  float: left;
  width: 100px;
  text-align: right;
}

.formw
{
  float: right;
  width: 235px;
  text-align: left;
}
Back on the html form you will see that after the final </div> I have added a single line break <br /> this too is altered via css to

Code:
br {	clear: both;	}
Since the divs and spans are floating we need to use clear so the containing element expands to house them.

Also the css control for the form, fieldset and legend elements contains
Code:
-moz-border-radius:15px;
which draws rounded corners, this will fail validation at present but according to mozilla it
Quote:
was one of the proposals leading to the proposed CSS 3 border-radius property, which has not yet reached Candidate Recommendation
Some screen grabs from a few browsers available at -> duncanbeattie.com/images/browserForm.jpg , I haven't had a chance to get any from my pc yet so ie will probably need a bit of tweaking *sigh*

Hope this is of some help
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Webmaster Resources
UK WW SEO Tools
Find UK Hosts
 
The Forum Rules
Forum Rules - MUST READ
 
Site Of the Month
BizzFace
Nominate site of the month
 
Tag Cloud
0bones ad agency backlinks beauty bid directory brand handbag brand new cash christian dior purse clothes content for sale contest directories directory dooney and bourke purse exchange faric handbag fendi purse free free directories gambling giveaway go kart graphic desingning guaranteed listing handbags high replica internet directories jewelry juicy couture purse link link development link leaders link popularity links link sales louis vuitton purse marc jacobs purse mortgage page rank pet picture of the day poker post request seobowl social sunglasses themes today in history versace purse wallets web desinging web hosting web space wordpress wordpress themes writer

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What are acceptable forms of link baiting? agent General Search Engine Discussions 8 08-19-2007 03:02 AM
PHP and Forms using Dreamweaver thatnamestaken General Webmaster Talk 0 06-04-2007 08:18 AM
flash email forms xeno General Webmaster Talk 0 07-31-2005 02:56 PM
Styling an input type="file" ovi General Webmaster Talk 0 06-23-2005 12:33 PM


All times are GMT. The time now is 10:06 PM.

UK Webmaster World Forums - Internet marketing, web development, domain names, SEO contest and discussuons.
Subscribe to our feeds   Subscribe to our feeds

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0