CSS Problems

  Stuart Leyland 21:07 01 Jan 2004

Hi all.

I'm back again! :o( This time with a new project (last one of building a message board was too much I decided) so I've started on something smaller, polls!

Everything is more or less done now, just need to sort out access to the admin area by using sessions (requires some reading of a tutorial when I can find one) and a register script.

The problem I'm having at the minute is with CSS however. In Opera, all the CSS works no problem but in Internet Explorer, it doesn't affect the output at all, even though it's in the source code (shown when going to View, Source Code).

Also, I am unable to get the CSS to affect one aspect of one page even though the same CSS works for another aspect of the page.

All the pages can be found here click here (no index page at present) and the page that I am having the second problem with is vote.php. If anyone wishes for me to send them this, or any other page, then I will do so.

I would be extremely grateful for any help on this because I've spent the last half an hour staring at the screen and I can see nothing wrong with it!

Thanks a lot

  Taran 21:50 01 Jan 2004

Send me copies Stuart.

At first glance, these are the faults with your CSS:

1. You underspecified the font family in the body section of your CSS. The font family should have Verdana, Geneva, Arial, Helvetica, sans-serif listed, otherwise some browsers may throw up an error.

2. You left off a # from the colour specified in the body background-color

body {font-family: Verdana,Arial; background-color: FFFFFF}

If you send me a zipped copy of your poll web folder I'll take a look over the next day or two.

In the meantime, change your CSS body to this:

html, body {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color: #FFFFFF}

And get rid of the <!-- and empty lines at the top of the CSS document and the --> at the bottom.

If you want to comment out a CSS file you do it like this:


your comments


  Talented Monkey 21:50 01 Jan 2004

For starters in vote.php and other .php files you have the output source code above your <html><head> <link> etc.. this is wrong

Your formatting should be

your out put text etc


Also you should not use any capitol letters what so ever in your css. Also you will need to add ; (semi-colon ) at the end of each line such as

.test {
color : #000000;
background: #ffffff;

When you are writing in php you will want a better structure, at the moment you are writing your link info in each page, with php you will only need to write one template file, and one database info file and a layout file or two, which you then INCLUDE in each individual file

So all you will need for vote.php will be

include “start_tags.php”;
include “layout_start.php”;

echo”sorry you have not voted “;

include “layout_end.php”;
include “end_tags”;


This is just off top of my head code but you get the idea, this way you only need to put the unique output to each file in between the layout_start and end includes. If you need a totally new layout or change your css files you ill now only need to change 1 file.

Hope this helps

  Taran 21:53 01 Jan 2004

Two people typing at the same time...


  Stuart Leyland 23:04 01 Jan 2004

Hi again.

I've taken into account what you, and also what a friend of mine whom I have spoken to in the meantime, have said and made the corrections as follows:

I now have a header.php file which contains all the information that was repeated in each seperate PHP file such as determining whether to use the default stylesheet or get values from the database. This means that the style comes before any PHP output and so my problem has been solved.

The CSS is now corrected with the font-family extended, the hash added and also a semi colon added to the end of each class. The only correction I have not made is to remove any capital letters in my CSS classes as I ran the CSS file through the CSS validator (click here) and it produced no errors.

The problem with IE was that I had began my style tags as follows:

<style type="css/text"> when it should have been <style type="text/css">.

What a shock to the system that was! IE not getting something right that Opera did ;o)


Do you still wish for me to email you my code or not? If so, could you send me an email through the forum with an email address as I no longer have yours.

Thanks for the help :o)

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 Hack Latest News: How Secure is your Wi-Fi?

Photoshop CC 2018 released with new Curvature Pen and better brush tools

Best kids apps for iPhone & iPad

Comment utiliser Twitter ?