Reply
XHTML Page with Form - CSS not applying
Old 05-19-2008, 05:30 PM XHTML Page with Form - CSS not applying
Junior Talker

Posts: 2
Name: Andy Cain
Trades: 0
Hello everyone,

New here so hi! Having a bit of an issue. Just spent a week writing a fairly complex form handler script (complex considering I started learning PHP 1 week ago!) and rather embarassingly I can't manage something as simple as styling a form using CSS.

I just don't know what's going on. I have an external style sheet in which I've specified all my styles and then I've applied them to the form. It shows correctly in Dreamweaver's design view, however when I upload the files all I get is a default styled form.

It's driving me mad. I'm pretty sure it's something to do with the form area itself because I've placed some test text outside which I styled using the stylesheet and it worked fine.

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadet Emailer</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>

<form id="form" method="post" action="">
<p> Message </p> <textarea name="textarea" cols="50" rows="8"></textarea>
<p>&nbsp;</p>
<p>&nbsp;</p>
<input type="submit" name="button" id="submitbutton" value="Submit" />
</form>


</body>
</html>
I'm sure it's somethign really simple but this problem has really got me.

URL of the page: www.83sqn.co.uk/emailform.html

Stylesheet: www.83sqn.co.uk/style.css

andycain is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 05-19-2008, 07:10 PM Re: XHTML Page with Form - CSS not applying
bakerc's Avatar
Penguin linguini....Mmmm

Posts: 2,069
Name: carl
Location: UK
Trades: 0
Hi

The css file, does the a.button refer to anything else or is that for the submit button?

There are a few errors in the CSS file such as

max-width::100%; should be max-width:100%;
(can you not just use width:100%; as I believe max-width isn't fully supported)

border:none;` should be border:none;

It looks like there are a few more errors in their but I didn't go through everyline, if you let us know how you want the form to look we may be able to help more.

Last edited by bakerc; 05-19-2008 at 07:34 PM..
bakerc is offline
Reply With Quote
View Public Profile Visit bakerc's homepage!
 
Old 05-19-2008, 08:19 PM Re: XHTML Page with Form - CSS not applying
LadynRed's Avatar
Super Moderator

Posts: 9,036
Location: Tennessee
Trades: 0
Unfortunately, legend is one of those pform elements that is almost impossible to style. The other problem may be that you have the styles applied to #form, yet everything is wrapped inside <fieldset>.

You might want to read thru these articles: http://www.sitepoint.com/article/style-web-forms-css
http://www.456bereastreet.com/archiv...form_controls/
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-20-2008, 12:48 PM Re: XHTML Page with Form - CSS not applying
Junior Talker

Posts: 2
Name: Andy Cain
Trades: 0
I've correct those CSS errors now. Thanks for pointing them out. Despite that however I don't think that would be causing a problem. The only part of the stylesheet that is styling the form are the three bottom CSS id's after the /*Cadet Emailer Form */ Comment.

I'm at a total loss. All I want the form to look like is all the elements centralised, with the field labels aligned and the form elemetns aligned. The strange thing is that everything works fine if I use inline style within the HTML of the form.

I don't want to do it like this though. Defeats the whole point of an external stylesheet. The a.button is for my navigation buttons on the main part of the site.

Appreciate your input.

To really see what I mean...open D/W and create a very simple style sheet with 1 ID in it to style the form. You should find it'll work in the dreamweaver design view but when uploaded it just goes back to default styling.

************************************************** *************************************************

EDIT: SOLVED THE PROBLEM!!! Forgot to close one of my classes with a curly brace. Doh! You lot still helped me by highlighting my CSS errors. Cheers.

Last edited by andycain; 05-20-2008 at 01:23 PM..
andycain is offline
Reply With Quote
View Public Profile
 
Old 05-20-2008, 02:12 PM Re: XHTML Page with Form - CSS not applying
wayfarer07's Avatar
I like pie

Posts: 3,369
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
For future reference, I don't recommend that you use Dreamweaver for display purposes. It only causes confusion. The best way to test your code is to hit the F12 button to port it straight into a browser. Dreamweaver has plenty of good features, but one of them is not correct display of documents.
__________________
Wayfarer | jQuery Tooltip | Mapbox: the jQuery Map
Latest Project: Houston Movers
If Google is the Coca-Cola of Web search, Bing is RC Cola
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to XHTML Page with Form - CSS not applying
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11459 seconds with 13 queries