Why margin: 2.5px does not work? How to solve this problem

Why margin:2.5px does not work? in one situation in my code I want to give margin:2.5px in IE6 conditional CSS to solve IE double field, and my css defaults to margin:5px , but in IE6 css margin:2.5px and margin:2px creates the same marker. then how to get the same margin in both browsers?

This is the default CSS screen code.

  #newsHeadline LI {font-weight: bold; list-style-position: inside; font-size: 13px; margin: 5px 0px; width: 320px; line-height: normal; list-style-type: disc; position: relative} 

this is the css code in the conditional letter #newsHeadline LI {margin: 2.5px 0px}

Edit: 15 feb

if margin: 2.5px does not work, then how to get the same margin in IE browser and FF? Is there another way?

+4
source share
7 answers

Because px is the smallest unit. U really can't share one display point , can you?

Edit: AS for your problem, if there is no interference in the background (i.e. a different color), you can try setting padding instead of a field for IE6 .

+2
source

While many people have suggested that a pixel is indivisible, and therefore the value of a fractional pixel does not make sense, the CSS standard does not really exclude fractional values. In fact, this suggests that when using a high-resolution device, the CSS pixel block must be mapped to a large number of elements related to the device. So my reading is that 2.5px should not be clearly wrong, just so that you cannot rely on it to do something useful, especially, I would say, in Internet Explorer.

+9
source

You can always set the display: inline field, but that is not always what you want. A double marker affects block level elements.

Since @Andrew Moore indicates whether you use this in your main stylesheet, this will not be proof of the future and should be included in the IE6 stylesheet . Thanks.

In addition, in some cases, you can use padding instead of a margin, since padding is not doubled. However, adding affects the various properties of your layout and box model.

+2
source

On the inseparability of the pixel: with the zoom function in modern browsers comes the concept of โ€œlogical pixelโ€. A smart scaling implementation can and should use fractional pixels ...

+2
source

you probably just need to fix the fish

 <ul ><li>content 1</li ><li>content 2</li ></ul> 

do not remember the space between each ul / ol or li

0
source

A pixel is the smallest unit of display on your screen. Since nothing less can be displayed, so there is no way to place an element on the screen at the position of a fractional pixel.

-1
source

Why margin: 2.5px does not work?

As others have already noted, a pixel is, by definition, the smallest unit, and therefore, by definition, cannot be divided.

Then, how to get the same margin in both browsers?

The usual solution is to set display: inline; for the item in question. In fact, some suggest that you simply apply the built-in fix to all floats if you want, making sure that the fix applies only to IE5 and IE6 (for example, using conditional comments), since there are no known side effects in these browsers.

-1
source

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


All Articles