tags:

views:

77

answers:

4

If CSS is only factor then What thing in css should be in our habit to make site compatible in All A grader browser.

Firefox, Safari, IE 6, IE 7, IE 8

Can we avoid the need of Conditional CSS for IE?

A: 

I'm not sure what "thing" you want in terms of CSS to achieve cross-browser compatibility, but it is certainly possible to achieve it without IE conditional tags. If I have to use those, I can't help feeling that I have failed.

Program.X
I'm asking some best practices to write prfect css in one file compatible for all browser
metal-gear-solid
A: 

I would say that this totaly depends on the complexity of the site, but in most cases it can be done without comments - you just need to structure it well - however CSS 3.0 should make achieving this much more simple.

easwee
How can IE6 be catered for without conditional-comments?
codeinthehole
A: 

Yes, it depends on the complexity.

If you want a helping hand you could use a CSS Reset... This makes it alot more easy avoiding Conditional CSS.

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; }
body { line-height: 1; }
ol, ul { list-style: none; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }
:focus { outline: 0; }
ins { text-decoration: none; }
del { text-decoration: line-through; }
table { border-collapse: collapse; border-spacing: 0; }
Allan Kimmer Jensen
+1  A: 

There are going to be cases where some browsers don't behave according to W3C standards. In the case of IE, conditional comments allows for the neat encapsulation of CSS intended only for these browsers.

I don't think it would be desirable to avoid using conditional-comments, because the alternative involves using hacks to target a specific browser. Hacks (such as the 'star hack') could be non-functional in the future, and can't be relied upon.

A CSS reset script is very useful, because it creates a default starting point for your custom CSS.

Even though use of a resets script is likely to help iron out a lot of inconsistencies between browsers, it won't remove the need for specific CSS intended solely for IE6 or IE7.

codeinthehole