No replies
sudhakararaog
Offline
Regular
Last seen: 11 years 33 weeks ago
Timezone: GMT+12
Joined: 2007-12-12
Posts: 20
Points: 23

my question is about ie6 and ie7 creating unwanted vertical gap of 3px

in my page i have an outer div which is holding 4 inner divs following is the code

#outer{
float: left;
width: 900px;
height: auto;
}

#outer .inner1{
float: left;
width: 200px;
height: auto;
}
#outer .inner2{
float: left;
width: 200px;
height: auto;
}
#outer .inner3{
float: left;
width: 200px;
height: auto;
}
#outer .inner4{
float: left;
width: 300px;
height: auto;
}

after this a new div starts with width 900px with the remaining page content, in order to clear the floats before the new div starts i have used

.break{
clear: both;
}

due to this the next div top edge starts exactly below the bottom edge of the outer div which is holding the inner divs, only in ie6 and ie7 there is a small vertical gap which i want to remove, as of now i have used
*margin: -3px 0 0 0; and _margin: -3px 0 0 0; for ie6 and ie7 for the next div and it looks similar to all other browsers

instead of using the -3px top margin is a way i can avoid the 3px vertical gap that ie is creating.
can i change .break to
.break{
clear: both;
height: 1px;
}

i am not very sure of this. sometimes this code also works

.clear{clear: both;} as an alternative to

also i have tried using the following code to fix ie6 and 7

* html .divname{
margin: -3px 0 0 0;
}
*+html .divname{
margin: -3px 0 0 0;
}

the advantage of using * html does not give any warnings when i validate the code from w3.org website however using _ and * gives a warning message for using _ and *

please advice if there is a way to avoid the 3px gap in ie6 and 7 without the above code or if there is no other alternative other than to use any of the 2 techniques

thanks.