/    Sign up×
Community /Pin to ProfileBookmark

Multiple Style Sheet Selection??

i am writing separate style sheets for explorer and safari and eventually for other popular browsers. how can i make the user’s browser choose the proper style sheet? i am pretty sure this can be done with javascript but there is no forum for that on here so . . .

to post a comment
CSS

20 Comments(s)

Copy linkTweet thisAlerts:
@sftrprodAug 02.2005 — You really shouldn't do that. There should be a way to fix your CSS so it works with all.

But if you need to do a browser check, then your best to use PHP. Ask in the PHP forum. ?
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 02.2005 — You really shouldn't do that. There should be a way to fix your CSS so it works with all.

But if you need to do a browser check, then your best to use PHP. Ask in the PHP forum. ?[/QUOTE]


all of the stuff i have read about css told me that i would need "work-arounds" for some browsers. i would love to just write the css once. is this really possible? if so, how, whenever i change something to make it work in explorer, it messes up the appearance in safari and vice versa.
Copy linkTweet thisAlerts:
@KravvitzAug 02.2005 — http://css-discuss.incutio.com/?page=CssHack

http://www.thesitewizard.com/css/excludecss.shtml

Don't bother making your pages pixel-perfect across multiple browsers.
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 02.2005 — http://css-discuss.incutio.com/?page=CssHack

http://www.thesitewizard.com/css/excludecss.shtml

Don't bother making your pages pixel-perfect across multiple browsers.[/QUOTE]


well, they need to be presentable though . . .
Copy linkTweet thisAlerts:
@sftrprodAug 02.2005 — Can we see your site? Then maybe we can help you fix your CSS to work in all browsers.
Copy linkTweet thisAlerts:
@KravvitzAug 02.2005 — Of course they need to be presentable. You don't want any gaps that obviously shouldn't be there.

The good thing is that it is fairly easy to give IE/Win, IE/Mac, and other browsers different rules. Giving different rules to KHTML browsers (like Safari), Mozilla Gecko browsers (like Firefox and Netscape 6+), and Opera 7+ can be tricky.
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 03.2005 — here is the site (best viewed with ie6/win) it is my first css so be gentle ? it is very basic because my cousin wanted something quickly but learning this is taking longer than i expected.

www.champpestcontrol.com

and the css is attached below. any help would be greatly appreciated.

[upl-file uuid=8d0a41dc-2126-43fb-a2d9-d4899da51180 size=49kB]css.doc[/upl-file]
Copy linkTweet thisAlerts:
@KravvitzAug 03.2005 — Ugh. Please use .txt instead of .doc in the future.

It is better to design in Firefox and then go back and fix things in IE.

[url=http://validator.w3.org/check?verbose=1&uri=http%3A//www.champpestcontrol.com/]Please validate your HTML.[/url]

[url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp]Difference between box models, doctype switching, etc.[/url]

[url=http://www.communitymx.com/content/article.cfm?cid=E0989953B6F20B41]The Box Model Problem[/url]

http://www.hut.fi/u/hsivonen/doctype

http://www.alistapart.com/articles/doctype/

http://www.juicystudio.com/choosing-doctype/

http://www.w3.org/QA/2002/04/valid-dtd-list.html
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 03.2005 — please calrify for me the useage of !DOCTYPE. i am under the impression that i can choose which !DOCTYPE to comply with and then write the html/css to fit. is this the case? also, this is the first i've heard of the validating thing. i see what the results are and psuedo-understand them. the strange thing is that it gives me results about lines that are not in the html (at least none that i can find) and it says they are at the bottom of the document. what is that all about?
Copy linkTweet thisAlerts:
@KravvitzAug 03.2005 — Yes, you can choose which doctype to use and write your markup to fit it, however you should make an informed choice. HTML 4.01 Strict is a good choice if you don't want to use <iframe>s and other deprecated elements and attributes.

Your server is adding this to the bottom of your page.
&lt;!-- text below generated by server. PLEASE REMOVE --&gt;&lt;!-- Counter/Statistics data collection code --&gt;&lt;script language="JavaScript" src="http://hostingprod.com/js_source/geov2.js"&gt;&lt;/script&gt;&lt;script language="javascript"&gt;geovisit();&lt;/script&gt;&lt;noscript&gt;&lt;img src="http://visit.webhosting.yahoo.com/visit.gif?us1123101814" alt="setstats" border="0" width="1" height="1"&gt;&lt;/noscript&gt;
&lt;IMG SRC="http://geo.yahoo.com/serv?s=76001405&amp;t=1123101814" ALT=1 WIDTH=1 HEIGHT=1&gt;
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 04.2005 — HTML 4.01 Strict is a good choice if you don't want to use <iframe>s and other deprecated elements and attributes.

Your server is adding this to the bottom of your page.
[/QUOTE]


ok thanks. so does that mean that most browsers will read it properly or do i still have to fix certain things? if so, is there a resource that will list specific probs or do i just have to find them and figure them out? one last question, how did youfind that code that the server is adding? normally i edit with GoLive which won't ever tell me that it's there but i even logged into my webhost server and looked at the page with the built-in editor and i still couldn't see it.

thanks for all of your help kravvitz (and others)
Copy linkTweet thisAlerts:
@KravvitzAug 04.2005 — You're welcome ?

Lose the WYSIWYG editors.

I viewed the page's source and that was at the very bottom.

Unfortunately browsers have so many wierd bugs that valid X/HTML and CSS aren't enough. You will need to test in as many browsers as you can to assure that your page doesn't look like abstract art.
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 05.2005 — You're welcome ?

Lose the WYSIWYG editors.

I viewed the page's source and that was at the very bottom.

Unfortunately browsers have so many wierd bugs that valid X/HTML and CSS aren't enough. You will need to test in as many browsers as you can to assure that your page doesn't look like abstract art.[/QUOTE]


so, what should i use to edit? just a simple text editor? GoLive seems to be pretty inoccuos since you can code as you like with it and it also allows me a very simple ftp upload function. is there a reason why you say not to use them? and finally, i am brought back to my initial problem. which is, how do i make my page look nice in as many browsers as possible? right now it looks fine in ie/win but not in safari. i figure i should at least cover the machine standard browsers.
Copy linkTweet thisAlerts:
@KravvitzAug 05.2005 — WYSIWYG editors tend to produce low quality code.

[url=http://css-discuss.incutio.com/?page=CssEditors]I recommend the editors in the first section of this page (not the "graphical web page generators" (WYSIWYG) ones listed near the end of the page)[/url] and my current editor of choice, [url=http://syn.sourceforge.net/]Syn Text Editor[/url].

Before worrying about Safari, make sure that Firefox and Opera display your page the way you intend it to look. Making complicated cross-browser tableless layouts takes experience.
Copy linkTweet thisAlerts:
@Ness_du_FratAug 06.2005 — I would say, design for Firefox, then improve in Opera. After that, it should work in Safari, and if you're lucky, in Netscape too.

Then, you'll have to do workarounds for IE, and IE for mac. But don't worry, these are easy to do.

Don't hesitate to post here, we'll help you.
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 08.2005 — most of the people in my "audience" are using "stock" browsers. so i figured if i cover ie and safari i would be fine. please tell me if i am wrong but i am pretty sure that the general public is not buying alternate web browsers.
Copy linkTweet thisAlerts:
@Ness_du_FratAug 08.2005 — Why do you want to buy them ???

I have Opera, Maxthon, Netscape and FF, and I didn't buy them !!!
Copy linkTweet thisAlerts:
@jerseydubsauthorAug 08.2005 — for some reason i thought they were not free. anyhow, does ff/mac work the same as ff/win (same question for opera)? in otherwords, if i verify them on my mac and they look fine in ff will they look the same on a pc in ff?
Copy linkTweet thisAlerts:
@KravvitzAug 08.2005 — Almost always the different OS versions of Firefox and Opera will render the same. They don't use different engines like IE/Win and IE/Mac do.

The free version of Opera is Adware, but it's well worth being able to use a browser that is better than IE for free, though I prefer Firefox myself and only use Opera for testing.

Safari has some wierd bugs, so it's good to make sure that it's not an IE vs. W3C specs issue by checking in Firefox and Opera.
Copy linkTweet thisAlerts:
@Ness_du_FratAug 09.2005 — I would say the worst of all is IE for mac.

Even if your site works in every existing browser, it will never work on IE for mac...
×

Success!

Help @jerseydubs spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...