PDA

View Full Version : Light "browser sniffing" css style script



catzzzvb
05-20-2007, 07:37 PM
HI!, I am VERY obsessive when it comes to accessibility, and I need a js script (light as possible) to detect the user's browser and pull up the correct style sheet. I need this for Opera, Firefox, Netscape, IE, and if possible, Safari.

Eg: a person is using netscape and comes to my site, so the js pulls up the style that makes the site look the way it was intended.

If you could help me in any way, it would be great!

PS here is my site: http://fatcatwebhosting.com, and there is a js script there already that kind of works.... it seems to work for all browsers (opera, netscape, and firefox) that I need, other then IE....:(

Edit: I do not know how appropriate this may be, but for anyone who could create this script for me, I would love to supply you with free web hosting.

Bob90
05-20-2007, 08:43 PM
Don't code individually for each browser. Make one css that covers them all. If you make it to standards, you will only need to add a few extra lines to make it work with IE.

As for your site:

Optimise the image. its like 175kb! --- no-one will host with you if your site isn't optimised.
Try reducing the page width of your browser and your title bar doesn't adjust, but the rest of the page does.

:)

p.s. when I visited with firefox I got 4 style sheets! 2 IE, 1 Opera and 1 Safari! None were right. lol

catzzzvb
05-20-2007, 08:48 PM
Don't code individually for each browser. Make one css that covers them all. If you make it to standards, you will only need to add a few extra lines to make it work with IE.

As for your site:

Optimise the image. its like 175kb! --- no-one will host with you if your site isn't optimised.
Try reducing the page width of your browser and your title bar doesn't adjust, but the rest of the page does.

:)

Thanks for the tips, but how do I optimize a image? Also, can you explain the while width thing? I didn't get it... And also, the site works in all those browsers, but there are simple little things like the title is a few px off, or the navagation tabs are a few px too low...I can't find a way to cover all that... That is why I chose to use multiple style sheets.

Edit: -.-....I feel so ....stupid right now... I can't beleive that I could remember a .JPG has better optimization then .PNG....Sorry..

Bob90
05-20-2007, 08:53 PM
I know you're a new coder, but you might want to try stripping/resetting all of the style from the page. Then applying your own. You should be able to find CSS to reset ot strip all styles then just add your own. Fresh slate!

As for the width thing, how are you setting it? from a database or asp? :confused:

catzzzvb
05-20-2007, 08:55 PM
I know you're a new coder, but you might want to try stripping/resetting all of the style from the page. Then applying your own. You should be able to find CSS to reset ot strip all styles then just add your own. Fresh slate!

As for the width thing, how are you setting it? from a database or asp? :confused:

Umm what? I am so lost... I did all the css work.... =) And the width... that's just set with the width: ; in the Css... I don't even know what asp is!! LOL

Edit...Also, I have been coding for years now... I am not that good though..Also, I just started CSS a few weeks ago.

boxxertrumps
05-20-2007, 08:55 PM
Also, these comments are messing up your page in FF.
<!-----------------------------
PRIMARY NAVAGATION STARTS HERE
------------------------------->
Keep it down to two dashes that should fix it. <!-- commented text -->
Also, dont use comment tags in your styles, xhtml wont use those styles.
your sending the content type as text/html when your using xhtml markup.
Put the rest of your styles and scripts into their own files, and then validate your pages.

Bob90
05-20-2007, 08:56 PM
just save this image

http://www.robertgarford.com/cat.jpg //removed now (catzzvb, if you want it again contact me.)

:)

catzzzvb
05-20-2007, 08:59 PM
Also, these comments are messing up your page in FF.
<!-----------------------------
PRIMARY NAVAGATION STARTS HERE
------------------------------->
Keep it down to two dashes that should fix it. <!-- commented text -->
Also, dont use comment tags in your styles, xhtml wont use those styles.
your sending the content type as text/html when your using xhtml markup.
Put the rest of your styles and scripts into their own files, and then validate your pages.

Alright...The only page that is up to date (as best as I had them) is the home (index.html) page.

Thanks for the tips.

Thanks for all the help, can you guys sick around for a little while? I can't update anything right now because I am uploading a VERY VERY large file. Thanks