This is a discussion on "[CSS] Customize your form with CSS" within the Starting Out section. This forum, and the thread "[CSS] Customize your form with CSS are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
[CSS] Customize your form with CSS
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[CSS] Customize your form with CSS
Forms can be boring at times with their default styling, I agree. CSS comes to the rescue once again by spicing it up a bit.
A regular form So ... lets start with coding our form
form-1.jpg CSS to the rescue! If you've been playing around with CSS a bit you'll notice that you can do ALOT of nifty things with backgrounds and changing fonts (all the while using common fonts) and colors. Don't think that these changes stops at simple text withing div, span or p elements. Oh no my friend! You can style input elements with CSS just like anything else. So ... here we go! input We'll start by adding a border and a light background to the input elements in our form using CSS CSS:
Here's what this simple change do form-2.jpg You'll notice that the radio buttons didn't change at all even though they are "input" elements. Please see Ryan's article on Customize Checkboxes & Radio Buttons select and textarea To get the same look with the select and textarea element, we could do this in our css CSS:
CSS:
form-3.jpg Last edited by karinne; Apr 17th, 2007 at 14:01. Reason: Changed [html] tags to [code] |
|
|
|
#2
|
|||
|
|||
|
Re: [CSS] Customize your form with CSS
label
Those labels are kind of boring with the regulat text. Let's bold them up and change the font. CSS:
That silly looking button Now ... you may notice that the input button looks like those input boxes. Well... it should because it is an input element but ... it's not very distinguishable is it!? We'll fix that by changing the border, font and background color with CSS by creating a class for our button and applying it to our input. CSS:
HTML:
We're done I hope this was helpfull to some. If you have any question about this tutorial feel free to PM me or reply here. This was intended as a 2 parter so, hopefully I will have time to make part II which would talk about display, fieldsets and customizing that sumbit button with an image created in Photoshop. Here is the complete HTML sources of the form
Last edited by karinne; Apr 17th, 2007 at 14:01. Reason: Changed [html] tags to [code] |
|
#3
|
|||
|
|||
|
Re: [CSS] Customize your form with CSS
Thanks, Karinne! I use styled forms all the time, but the css is usually really complicated. This really helps as I can now detect a lot of redundancy in my code...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
|
#4
|
||||
|
||||
|
Re: [CSS] Customize your form with CSS
+ rep. Why isn't this a sticky? Don't want to get lost amongst the other threads!
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#5
|
|||
|
|||
|
Re: [CSS] Customize your form with CSS
It's fine in the Beginners' Resources threads ... that's what it is
|
|
#6
|
||||
|
||||
|
Re: [CSS] Customize your form with CSS
Nice one Karinne! I have seen a lot of these type of problems lately!
__________________
Marc Staff Manager - Webforumz.com Want to be a moderator? PM me. |
![]() |
| Tags |
| form, css |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Let a user customize my layout.. | jahphill | Web Page Design | 1 | Jun 6th, 2008 07:40 |
| Hiding / Showing form fields based on previous form input | John Alexander Hopper | PHP Forum | 1 | Mar 10th, 2008 11:30 |
| Try my new JavaScript: Customize Dropdown Menu | temp | JavaScript Forum | 1 | Aug 8th, 2007 11:47 |
| How to customize content depending on URL? | matthewpage | Classic ASP | 1 | Nov 13th, 2006 04:50 |