开发者

single css for different browsers [closed]

开发者 https://www.devze.com 2022-12-11 04:29 出处:网络
开发者_开发百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form
开发者_开发百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I want to use a single css file for different types of browsers.. can anyone give me a guide line on how to develop it ?? Am new to programming....Pls help...


CSS contents and browser compatibility may be of use to you. Also see http://www.w3schools.com/css/


The CSS that you can use in a cross browser compatible style sheet is a subset of the standard, where you avoid styles that some browsers have problems with. (Where "some browsers" often is Internet Explorer.)

For example, the text-align style is not properly handled by Internet Explorer. It applies the style to block elements also while it should only be applied to inline elements. Therefore you should only use the text-align style on elements that doesn't contain any block elements.

Develop the page using a standards compliant browsers, like Firefox, as the first testing ground. When it works in Firefox it will almost always look the same in all other browsers except Internet Explorer. Eventhough IE is the most used browser, it's the odd one out when it comes to web standards, and you often has to tweak the HTML and CSS to avoid rendering errors in IE.

Sometimes IE needs a specific size on elements that are sized automatically in other browsers. Another example is adding display:inline; to a floating element. All floating elements are block elements so the display:inline; style is ignored, but in IE it has a side effect of setting a HasLayout flag for the element, which fixes some other problems that IE has with floating elements.

You need a proper doctype on your page so that it renders in standards compliant mode. Otherwise you will have a very hard time getting a consistent look across browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消