Jump to content

CSS for Forms


K_Drive

Recommended Posts

I was wondering if anyone knows of any links/references for using CSS styles for forms.I have found one website that just advised against doing it.I ran into this problem when starting the page listed below.The background color is working in IE7, but not in Firefox.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head>  <title>Log In Page</title>   <style> body { font-family: verdana, arial; font-size: 10pt; font-style: normal; background-color: #FFFFFF; color: #000000; margin: 90px;  }    .TextInput  {  .background-color: #F0F8FF;   }   </style>  </head><body><h3>User Name</h3><input class="TextInput" type="text" name="LogInUserName" value=""><h3>Password</h3><input class="TextInput" type="password" name="LogInPW" value=""><br/><br/><br/><img src="Images/LogIn.png"  alt="" border="0" align="" /></body></html>

Thanks, K_Drive

Link to comment
Share on other sites

It's because you added an extra dot (.) don't you :)

 .TextInput  {  .background-color: #F0F8FF;   }

Just before background-color

Link to comment
Share on other sites

Hello,Tables should be used when they are to be used, that is when there is tabular data... a form is usually tabular data.There are too many people that have a misconception about the use of tables, I call them "DIV lovers", because as any "X lover" they are 'mad' about something without knowing why.Getting back to the subject, I don't see any reason why you shouldn't use a simple table to layout your form. Now, the table is SOLELY for 'layout-ing' the form elements, so when it comes to styling and positioning, even of the table itself, you should do that via CSS of course.Here's a good tutorial on forms and how they should be made with Accessibility in mind: http://www.sitepoint.com/article/fancy-form-design-cssHope this helps.

Link to comment
Share on other sites

Excuse me Ricardo Zea, but the OP's code does'nt shows table, or i'm not seeing it :)Form and tables are rather different. I see no point of comparison.

Link to comment
Share on other sites

Hello,Tables should be used when they are to be used, that is when there is tabular data... a form is usually tabular data.There are too many people that have a misconception about the use of tables, I call them "DIV lovers", because as any "X lover" they are 'mad' about something without knowing why.Getting back to the subject, I don't see any reason why you shouldn't use a simple table to layout your form. Now, the table is SOLELY for 'layout-ing' the form elements, so when it comes to styling and positioning, even of the table itself, you should do that via CSS of course.Here's a good tutorial on forms and how they should be made with Accessibility in mind: http://www.sitepoint.com/article/fancy-form-design-cssHope this helps.
Ricardo:Thanks for the link. I will look at it because I am always interested in learning about CSS.No. I am not a DIV lover or a Table lover. My opinion is that they are both web page tools to be used when they work best.I learned HTML in the 80s. Since then, I have learned to work with CSS. I REALLY like it compared with having to try to fiddle with little quirky things to try to get your pages to display the way you want them. (OK - With the different browsers out there, you still have to fiddle. But, it is a lot better now.)I am currently working on a web app that have tons of Tables for page layouts. That is how the programmers originally made them. I have been given the task of trying to make the pages, which were originally created with IE only, to display correctly in FireFox. So, I know about working with Tables and DIVs. Tables are not poison and DIVs are not poison. But, neither of them the best/only solution, either. They are tools to be used when making a web page.And, in regards to my page: I think I did mention that I just started it. I was experimenting with a few different layouts, which is why I was using the DIVs. But, I am not wearing a t-shirt with "I love DIVs" on it.K_Drive
Link to comment
Share on other sites

Hello,Tables should be used when they are to be used, that is when there is tabular data... a form is usually tabular data.There are too many people that have a misconception about the use of tables, I call them "DIV lovers", because as any "X lover" they are 'mad' about something without knowing why.Getting back to the subject, I don't see any reason why you shouldn't use a simple table to layout your form. Now, the table is SOLELY for 'layout-ing' the form elements, so when it comes to styling and positioning, even of the table itself, you should do that via CSS of course.Here's a good tutorial on forms and how they should be made with Accessibility in mind: http://www.sitepoint.com/article/fancy-form-design-cssHope this helps.
thanks for that CSS form link. a good learning experience
Link to comment
Share on other sites

Tables are not poison and DIVs are not poison. But, neither of them the best/only solution, either. They are tools to be used when making a web page.
110% agree.If you need any assistance just let me know through the forum, I'll be glad to give you a hand.rangana I have no idea what you said :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...