Method of unifying font size among browsers

web front end eight thousand five hundred and forty-eight 14 years ago (2011-03-18)
I find that if absolute px is used to specify typeface In case of size, in non ie browser It can only scale the text, but it may damage the layout. The function of scaling the entire page is relatively simple. But, in IE6 Below, there is no overall scaling function. If you still use px to define the size, the function of text resizing will fail. In other words, you can't change the font size with px and ie6. If we use the percent sign instead of px to define the size. The default font size in ie6 is larger than ff, so you can't define the percent sign directly in the body. So I thought of hack. I open a separate css file called ie6.css. All the hacks related to ie6 are stored here, which is easy to manage. [CODE_LITE] body {font size: 70%! Important;} [/CODE_LITE] Someone said ie6 is not unsupported! Important? In fact, IE6 is supported, but there is a bug. You can hack using this bug. We don't use this bug here. Then write in the normal css file: [CODE_LITE]body { color: black; font-family: Tahoma, Helvetica, Arial,"\5fae\8f6f\96c5\9ed1" ,"\5b8b\4f53",sans-serif; font-size:85%; } [/CODE_LITE] You can see that font size is different. So how to make ie6 load ie6.css? We do it with conditional notes. [CODE_LITE] [/CODE_LITE] This is OK. In the font size definition of the body sub element, em is used instead of px. This allows the entire page to be synchronized. In addition, using em as line height: padding, margin or border can also achieve synchronization, which is very good!