div center and min width ie6
Posted: 08 July 2009 02:06 AM   [ Ignore ]
Newbie
Rank
Total Posts:  1
Joined  2009-07-08

hi to all

How to center my float div inside the parent div, and why in ie6 min width works but sometime different behavior. If I was trying to resize the window it was broken (second table move to bottom) and the horizontal scroll bar doesn’t appear.

thanks in advance

jhun

here is the code

<!-- IE in quirks mode -->
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Untitled Document</title>
<
link rel="stylesheet" href="css/css.css" type="text/css">
<
style type="text/css">
 
body{
  margin
:0;
  
padding:100px 0 0 150px;
 
}
 div
#header{
  
position:absolute;
  
top:0;
  
left:0;
  
width:500%;
  
height:100px;
  
background:lime none repeat scroll 0 0;  
 
}
 div
#left-sidebar{
  
position:absolute;
  
top:100px;
  
left:0;
  
width:150px;
  
height:100%;
  
background:yellow none repeat scroll 0 0;  
 
}
 
@media screen{
  body
>div#header{
   
position:fixed;
  
}
  body
>div#left-sidebar{
   
position:fixed;
  
}
 }
 
html body{
  overflow
:hidden;
 

 
html div#content{
  
height:100%;
  
width100%;
  
overflow:auto;
 
}
#wrapper{
min-width:1000px;
width:[removed]document.body.clientWidth 1002"1000px""auto" );
}  
</style>

</
head>

<
body>
<
div id="header"header </div>
<
div id="left-sidebar"left-sidebar </div>
<
div id="content">
    <
div id="formdiv">
        <
div id="wrapper" style="border: 1px solid #00CCCC" align="center">
           <
div style="width:46%;float:left">
              <
div style="margin:auto">                           
                  <
div class="top"><div class="bottom"><div class="left"><div class="right"><div class="bl"><div class="br"><div class="tl"><div class="tr">
                    <
div style="padding:20px">
                        <
table width="100%" border="1" cellspacing="0" cellpadding="0">
                          <
tr>
                            <
th scope="col"><label>
                              <
select name="select" id="select">
                              </
select>
                            </
label></th>
                            <
th scope="col">&nbsp;</th>
                            <
th scope="col">&nbsp;</th>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                        </
table>
                    </
div>
                  </
div></div></div></div></div></div></div></div>
              </
div>
           </
div>
           <
div style="width:46%;float:left">
              <
div style="margin:auto">                           
                  <
div class="top"><div class="bottom"><div class="left"><div class="right"><div class="bl"><div class="br"><div class="tl"><div class="tr">
                    <
div style="padding:20px">
                        <
table width="100%" border="1" cellspacing="0" cellpadding="0">
                          <
tr>
                            <
th scope="col">&nbsp;</th>
                            <
th scope="col">&nbsp;</th>
                            <
th scope="col">&nbsp;</th>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                          <
tr>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                            <
td>&nbsp;</td>
                          </
tr>
                        </
table>
        
                    </
div>
                  </
div></div></div></div></div></div></div></div>
              </
div>
           </
div>
           <
div style="clear:both"></div>
        </
div>
    </
div>
</
div>
</
body>
</
html
Profile
 
 
Posted: 13 July 2009 07:16 AM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  6
Joined  2009-07-13

I could be wrong but I doubt you will be able to “centre” you float div, you have it floated, so it will be position as far left as allowed, you would need to manipulate its margins or parents padding to give the impression of being in the centre. Also ie 6 and possible later have issues with margins left right being auto if you do not set an absolute width eg(pixels), % widths seem to be ignored.

For min-width in early ie you would probably be best creating and using an image 1px by total width & using that. Form your code it would appear that you are not chasing a completely lightweight css only solution so you can use any weapon in your armoury to achieve your goal.

Profile
 
 
Posted: 11 August 2009 06:19 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  19
Joined  2009-07-27

Maybe one thing at a time. The folks at Limpid wouldn’t write bad code (that’s Anne’s company isn’t it?). You’re mixing bad code with good code, and no I’m not talking about the CSS expression there. You’ve got inline styles, some of them like margin: 0 auto but then others like “center”... get rid of that. In fact, just make your HTML barebones to start. You can always add junk later. Drop the quirksmode— I know that used to be what everyone had to use back in the day to get IE6 to work with the fixed-elements stuff, but people have since found ways to do it in Standards Mode now too, so you’re going to stick with that.


Search engine optimization

Profile
 
 
Posted: 15 February 2011 09:32 AM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  2
Joined  2011-02-15

Also ie 6 and possible later have issues with margins left right being auto if you do not set an absolute width eg(pixels), % widths seem to be ignored.
______________________________________
WP-ID

Profile