CSS Validator issues

This is a discussion on "CSS Validator issues" within the Web Page Design section. This forum, and the thread "CSS Validator issues are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 4th, 2007, 11:03
Junior Member
Join Date: Aug 2007
Location: UK
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Question CSS Validator issues

Hey, im trying to get my css and html validated, however I get 1 error.

I have a script that detects the browser, then either puts in a firefox/ie6/ie7 etc.. css file after the core css file. This then allows the site to look good in most browsers and works a treat.

However when passing the URL thru the CSS validator online, it obviously doesnt detect a browser type, meaning I get only 1 css error because it can not access the missing browser css file.

Does this make any sense?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 4th, 2007, 12:40
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

By script you mean JS?

Use conditional comments instead

Code: Select all
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 4th, 2007, 13:17
Junior Member
Join Date: Aug 2007
Location: UK
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Nope - the site is written in php, it detects the browser then "includes" the .css dependant on the browser.

However, when you run the page thru a validator, the validator is not actually using a browser so it then cant include the file - meaning I get 1 error message for not including the file.

Would this still class as a css validation error which would need to be fixed to give me the green light?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 4th, 2007, 13:26
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Well ... JS or PHP ... whatever ... you should be using conditional comment anyways.

And quite frankly, the amount of CSS that's different from browser to browser should NOT be alot.

If done well, only 1 stylesheet should suffice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Sep 4th, 2007, 13:51
Junior Member
Join Date: Aug 2007
Location: UK
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Many thanks for your reply.

So would the following work in just the one core.css file:

Code: Select all
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]--> 
<!--[if IE 7]>
Special instructions for IE 7 here
<![endif]--> 
<!--[if Firefox]>
Special instructions for Firefox here
<![endif]-->
etc...

Where can I find more information of this?

Thanks again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Sep 4th, 2007, 13:53
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

See the link I posted above.

And ... you should need a if Firefox ... it's IE that's the problem ... not firefox

Code your site properly and it will work in FF.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Sep 4th, 2007, 14:02
Junior Member
Join Date: Aug 2007
Location: UK
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

I always develop in firefox anyways, so ill just add the conditional comments to alter the IE parts.

Many thanks for your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Sep 4th, 2007, 14:03
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Yep ... no problem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Sep 4th, 2007, 14:18
Junior Member
Join Date: Aug 2007
Location: UK
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Sorry - another quick question.

Is there of any way of putting this type of thing within a .css file. For example; I need to enter width:100%; if its IE but I dont need this at all if its firefox (hence the reason me picking up different css files using php)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Sep 4th, 2007, 14:19
Junior Member
Join Date: Aug 2007
Location: UK
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Sorry - scrap that - its sorted now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Sep 4th, 2007, 14:22
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Your HTML document should look something like this

Code: Select all
<!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" lang="en-CA" xml:lang="EN-CA">

<head>
    <title>Some title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <link rel="stylesheet" type="text/css" media="screen" href="main-styles.css" />
    
    <!--[if IE]>
    <link rel="stylesheet" type="text/css" media="screen" href="IE-styles.css" />
    <![endif]-->    


</head>

<body>

</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Sep 6th, 2007, 12:48
Most Reputable Member
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Validator issues

Note that conditional comments are a proprietary feature of IE (and a great one too!).

You cannot use conditional comments to target other browsers. Only IE.

So this code is pointless:

Code: Select all
 <!--[if Firefox]>
Special instructions for Firefox here
<![endif]-->
The good news is that, if you make standards compliant code and don't try anything too cutting edge (CSS 3, say), then every browser except IE should render it fine. Then you can fix IE with conditional comments.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
css

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing tags in the validator geyids Web Page Design 11 Jan 14th, 2008 07:00
Validator jtyoungs Web Page Design 8 Nov 8th, 2007 15:56
W3 validator has a distinct dislike to my doctype rubyfruit Starting Out 5 Jul 4th, 2007 17:30
Web2.0 Validator spinal007 Webforumz Cafe 8 May 29th, 2007 17:38
W3C Validator Maverick25r Web Page Design 14 Oct 23rd, 2006 00:45


All times are GMT. The time now is 18:09.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42