2010-10-05 23 views
2

继承人的链接的网页有问题的限制.... http://team2648.com/OTIS2/DivTest.html浮动DIV箱魔法

所以,如果你看一下该网页,如果你的浏览器是足够小,你看,下面用的盒子红色背景,有一点空间,为什么下面的框不能浮起来?

This is what I want.

的HTML代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <title>OTIS v1.5</title> 

     <!-- Javascript - Fix the flash of unstyled content --> 
     <script type="text/javascript"></script> 

     <!-- Stylesheets --> 
     <link href="css/reset.css" rel="stylesheet" type="text/css" media="all" /> 
     <link href="css/default.css" rel="stylesheet" type="text/css" media="screen" /> 
     <link href="css/styling.css" rel="stylesheet" type="text/css" media="screen" /> 

     <!--Validation--> 

     <script src="js/jquery.js" type="text/javascript"></script> 
     <script src="js/jquery.validationEngine-en.js" type="text/javascript"></script> 
     <script src="js/jquery.validationEngine.js" type="text/javascript"></script> 
     <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" charset="utf-8" /> 


     <script src="js/common.js" type="text/javascript"></script> 


     <!-- Meta Information --> 
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
     <meta name="author" content="Techplex Engineer" /> 
     <meta name="keywords" content="" /> 
     <meta name="description" content="" /> 

     <script type="text/javascript"> 

      var _gaq = _gaq || []; 
      _gaq.push(['_setAccount', 'UA-10899272-10']); 
      _gaq.push(['_trackPageview']); 

      (function() { 
       var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
       ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
      })(); 

     </script> 
    </head> 
    <body> 
     <div id="container"> 
      <div id="header"> 
       <div id="header-in"> 
        <h2>Online Team Information System</h2> 
        <h6>A Web Database Application for Team Profile Management</h6> 
       </div> <!-- end #header-in --> 
      </div> <!-- end #header --> 
      <div id="content-wrap" class="clear lcol"> <!-- Navigation Column--> 
       <div class="column"> 
        <div class="column-in"> 
         <ul> 
          <li> My </li> 
          <ul> 
           <li><a href="./"> Dashboard </a></li> 
           <li><a href="?page=manage.profile"> Profile</a></li> 
           <li><a href="?page=manage.info"> Information</a></li> 
           <li><a href="?page=manage.econtact"> Emergency Contact</a></li> 
          </ul> 
          <li> Management </li> 
          <ul> 
           <li><a href="?page=manage.users"> Users </a></li> 
           <li><a href="?page=email"> Email </a></li><li><a href="?page=blog"> Blog </a></li> 
          </ul> 
          <li><a href="?page=bugs.php&referrer=/OTIS2/"> Report a Bug </a></li> 
          <li><a href="logout.php"> Logout </a></li> 


         </ul> 
         <br /> 
         Logged in as: 
         <br /> 
         <a href="?page=manage.profile">Blake </a> 
        </div> 
       </div> 
       <div class="content"> 
        <div class="content-in"> 

         <h5>Welcome to your personal dashboard Blake </h5><hr id="hr1"/> 
         <div id="bio" style="display: none;"> 
          Your current Bio: <br/><textarea rows="10" cols="50"> </textarea> 
         </div> 

         <div id="profilestats" class="widget"> 
          <strong>IMPORTANT</strong><br/> 
          <ul style="padding-left: 10px;"> 
           <li>Your Public Profile is pending moderation.</li> 
          </ul> 
         </div> 

         <div id="cal" class="widget"> 
          <!-- <iframe src="https://www.google.com/calendar/hosted/team2648.com/embed?showTitle=0&amp;showNav=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;mode=AGENDA&amp;height=200&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=team2648.com_a1ur39fpp2cn076ak2q06o8hhc%40group.calendar.google.com&amp;color=%235229A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="400" height="200" frameborder="0" scrolling="no"></iframe>--> 
          <iframe src="https://www.google.com/calendar/hosted/team2648.com/embed?showNav=0&amp;showDate=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;showTz=0&amp;mode=AGENDA&amp;height=200&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=team2648.com_a1ur39fpp2cn076ak2q06o8hhc%40group.calendar.google.com&amp;color=%235229A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="400" height="200" frameborder="0" scrolling="no"></iframe> 
         </div> 
         <div id="stats" class="widget"><!-- and finally output the information formated for the widget--> 
          <strong>You have:</strong><br/> 
          <ul style="padding-left: 10px;"> 
           <li>  <strong>42</strong> of 30 fundraising hours<br/></li> 
           <li>fundraised $<strong>160</strong> of $300<br/></li> 
           <li>  <strong>3</strong> of 5 community service hours<br/></li> 
           <li>  <strong>0</strong> of 40 build hours <br/></li> 
          </ul> 
         </div> 
         <div id="logins" class="widget"> 
          <form name="controlsForm"> 
           <input id="cblogin" type="checkbox" name="loginbox" onClick=""/> Disable Login<br /> 
           <input id="cbreg" type="checkbox" name="regbox" onClick=""/> Disable Registration<br /> 
          </form> 
         </div> 

         <div class="clear"></div> 
        </div><!-- end .content-in --> 
       </div> <!-- end .content --> 
      </div> <!-- end #content-wrap --> 
      <div id="footer"> 
       <div id="footer-in"> 
        This system was designed, built and is maintained by Blake for Infinite Loop Robotics <br>OTIS(Online Team Information System) &copy; 2010 Techplex Labs  </div> <!-- end #footer-in --> 
      </div> <!-- end #footer --> 
     </div> <!-- end div#container --> 
    </body> 
</html> 

您可以查看这里的CSS: http://team2648.com/OTIS2/css/styling.css

但相关的部分是:

div.widget{ 
width: 200px; 
float: left; 

/* text-align: center;*/ 
border: 1px solid black; 
padding: 8px; 
margin: 8px; 

/* margin-left:8px; 
font-weight:400;*/ 
-moz-border-radius:11px; 
-khtml-border-radius:11px; 
-webkit-border-radius:11px; 
border-radius:5px; 
background:#fff; 
border:2px solid #e5e5e5; 
-moz-box-shadow:rgba(200,200,200,1) 0 4px 18px; 
-webkit-box-shadow:rgba(200,200,200,1) 0 4px 18px; 
-khtml-box-shadow:rgba(200,200,200,1) 0 4px 18px; 
box-shadow:rgba(200,200,200,1) 0 4px 18px; 
/* padding:16px 16px 40px;*/ 
} 
div#disclaimer 
{ 
margin-top: 10px; 
border: 1px dotted black; 
font-size:10px; 
background-color: #D7D7D7; 
} 
div.clear 
{ 
clear: both; 
} 
div#profilestats 
{ 
border:2px solid #FF9999; 
} 
div#cal 
{ 
width: 400px; 
padding-bottom: 0px; 
} 
+0

我想你正在寻找的magicoverflow.com – 2010-10-05 16:21:55

+0

它可能是我失明,但我看到“框与红色背景”在链接页面上。 – 2010-10-05 16:27:13

+0

这似乎不是一个有效的URL。 – TechplexEngineer 2010-10-05 16:28:46

回答

1

我不知道你是否喜欢这个,但是有了评论,我发现当你把整个窗口做得更小时,带有日历的盒子(cal)会移动到红色的重要盒子下面(profilestats )。

如果你希望它更接近(缩小它们之间的距离),那么造成空间的原因是styling.css中的DIV.widget,margin:8px;除此之外,在这一点上我没有看到任何改变 - 我在IE8中测试了这一点,并且删除了CSS元素设置的确将它们直接推到了一起,没有间隔。

现在,如果您的意思是将“统计信息”直接移到“profilestats”下面,那么这是另一个可以通过几种不同方式解决的问题。

  1. 放“profilestats”,并在一个div一起“统计”(与“CAL”和 “登录”另一个DIV在一起,漂浮都“容器”的div留下
  2. 使用浮动:左和float:右左侧和右侧 元素,但是,这将介绍如果宽度是 扩展(浏览器的宽度),除非通过另外的CSS寻址之间的空间

在这种情况下,我会选择#。 1,因为css更易于控制。

注意:谨慎使用浮动左元素时IE6的边距可能不一致。

1

之所以这种情况是因为profilestats div和cal div都是float:left。在cal div上尝试一个float:right;,这样左边浮动的下一个div(stats)可以占用profilestats以下的可用空间。