navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Class and ID

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Class and ID
Page: [1]
 
BeTheBall

 

Posts: 6336
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
Class and ID - 3/13/2007 12:03:26   
I have a form with an ID of ws. My stylesheet contains the following:

#ws label, #ws input, #ws select {
display: block;
margin-bottom: 10px;
}

#ws label {
text-align: right;
width: 350px;
margin-right: 20px;
float: left;
}

#ws br {
clear: left;
}

I need to insert a couple of checkboxes into my form and need to override some of the above attributes. I placed the checkboxes inside a div and gave it a class name of cbGroup. However, I am finding it very difficult to override the above settings. For example, I want the text of the checkbox labels within the div to be left aligned, not right aligned. So, I added the following:

label.cbGroup {text-align:left;}

That seems to be completely ignored. Any thoughts on how to go about this?

One other major annoyance is something in the above is causing a line break between the checkbox and its label.


_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
Tailslide

 

Posts: 5915
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Class and ID - 3/13/2007 13:48:42   
Sorry - haven't got the time to work through it at the moment Duane, instead I'll just say that styling forms can be a real pain in the arse.

My approach tends to be to keep it as simple as possible.

I put labels round the label and the input (explicit labelling) and I add a br after the text label rather than floating the text next to the input. I do this just because it's easier for me to be honest - although I don't think it looks too bad.

I give the inputs classes (text, radio, checkboxes, textareas etc) and deal with them separately.

Apart from that - here's some useful links:

http://veerle.duoh.com/index.php/blog/comments/styling_forms_in_css/
http://www.themaninblue.com/experiment/InForm/horizontal.htm
http://www.456bereastreet.com/archive/200410/styling_even_more_form_controls/
http://www.websemantics.co.uk/tutorials/accessible_forms/

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to BeTheBall)
BeTheBall

 

Posts: 6336
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Class and ID - 3/13/2007 14:53:11   
Thanks Helena. I was able to track down the problems. First, it seems that a style assigned to an ID will generally override one that is part of a class. So, I modified my stylesheet to replace the style I had assigned to an id with a class style.

Getting the label to not fall below the checkbox was giving me fits until I realized I was placing the float:left on the wrong element. I was putting it on the label when I needed it on the checkbox. Once I moved it where it needed to be, everything fell into place.

I try to not get too fancy with my forms, but one thing I hate is when a long checkbox label wraps below the checkbox. It just looks bad to me. So, that is what all the fuss was about.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to Tailslide)
coreybryant

 

Posts: 2422
Joined: 3/17/2002
From: Castle Rock CO USA
Status: offline

 
RE: Class and ID - 3/17/2007 18:05:19   
Just in case, this one really helped me out actually last week Form Layout Example

_____________________________

Corey R. Bryant
Merchant Accounts | Toll Free Numbers | My Blog | Expression Web Blog

(in reply to BeTheBall)
Tailslide

 

Posts: 5915
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Class and ID - 3/18/2007 2:58:38   
Ah thanks for finding Gary's form example Corey! I lost all my bookmarks a while back and haven't found a quarter of what I lost.

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to coreybryant)
coreybryant

 

Posts: 2422
Joined: 3/17/2002
From: Castle Rock CO USA
Status: offline

 
RE: Class and ID - 3/18/2007 9:45:20   
Glad to have helped.. I just had the same problem a few weeks ago and it surely helped me. It kept it very simple

_____________________________

Corey R. Bryant
Merchant Accounts | Toll Free Numbers | My Blog | Expression Web Blog

(in reply to Tailslide)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Class and ID
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts