Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Why margin:2.5px does not work? at one situation in my code i want to give margin:2.5px in IE6 conditional CSS to solve IE double margin and my default css has margin:5px but in IE6 css margin:2.5px and margin:2px creating same margin. then how to get same margin on both browser?

This is code of default screen CSS

    #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 css code in conditional i'm writing #newsHeadline LI {margin: 2.5px 0px}

Edit: 15 feb

if margin:2.5px does not work then how to get same margin in both browser IE and FF? Is there any other way?

like image 932
Jitendra Vyas Avatar asked Dec 13 '22 00:12

Jitendra Vyas


2 Answers

While plenty of people have suggested that the pixel is indivisible, and therefore a fractional pixel value makes no sense, the CSS standard does not actually rule out fractional values. Indeed, it suggests that when a high-resolution device is used, a CSS pixel unit should be mapped to a larger number of device-specific elements. My reading is therefore that 2.5px should not be explicitly wrong, just that you might not be able to rely on it to do something useful, especially, I might say, in Internet Explorer.

like image 90
Tim Avatar answered Dec 22 '22 05:12

Tim


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

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

like image 44
Adam Kiss Avatar answered Dec 22 '22 03:12

Adam Kiss