Is it possible to selectively apply CSS depending on the browser used?

I have a white single on a blue background. I didn’t use any add-ons in the field set, but it seems like 5px add-on has been added for all other browsers: Except Internet Explorer . If I use 5px then IE looks fine, but there are too many add-ons for other browsers. They seem to add up.

This is the most obvious problem, but there are still a few less noticeable problems when only Internet Explorer behaves differently from other browsers. So, is there a way to apply CSS selectively? For example, if (IE then applies the 5px add-on) .

thanks for the help

+3
source share
8 answers
<!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <body class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <body class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <body class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->

The above tasks point to specific instances of IE, since the error may be version specific.

When creating a rule for IE6 and IE7, for example, use

body.ie6 wrapper{background-color:#0000ff;}
body.ie7 wrapper{background-color:#00ff00;}
+2
source

write the body tag as follows:

<!--[if IE]> <body class="ie"> <![endif]-->
<!--[if !IE]><!--><body><!--<![endif]-->

then write your specific rule ie with

.ie fieldset { ... }

(no additional requests for IE to handle specific fixes, no hacking stars or other tricks that make your css invalid)

+2
source

, , - "" CSS. . .

- . , , , , , .

+1

...

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

: IE

+1

CSS (, ) , IE. IE IE .

+1

CSS . IE, , .

, , , doctype (, , doctype).

, doctype HTML. -.

, HTML XHTML, - , HTML5:

<!DOCTYPE html>

( , HTML5).

, .

+1

, , IE-, "" ...

. . , , CSS.

A property called box-sizing. Read about it and see if your problem fixes. http://www.quirksmode.org/css/box.html

+1
source

Source: https://habr.com/ru/post/1772117/


All Articles