2013-04-29 68 views
0

我想让这个布局有点流畅。我希望#logo位于#infobot的右下方,其大小由我想要通过浏览器窗口缩放的图片确定。 #white应该掩盖#logo左侧的内容。如何让#white和#logo排列成彼此相邻并仍然保持流体大小? HTML:流体div,一个与图像排队?

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"/> 
     <meta name="description" content=""/> 
     <meta name="keywords"content=""/> 
     <title></title> 
     <link href="css/testmain.css" rel="stylesheet" type="text/css"/> 
     <link href='http://fonts.googleapis.com/css?family=EB+Garamond' rel='stylesheet' type='text/css'> 
     <link href='http://fonts.googleapis.com/css?family=Volkhov' rel='stylesheet' type='text/css'> 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
    </head> 


    <body> 

     <header> 
     <div id="nav"> 
      <p><a href="#">+</a></p> 
     </div> 
     </header> 
     <div id="container"> 
      <div id="infowrap"> 
        <div style="background-color: white" id="infotop"></div> 
        <div style="background-color: yellow" class="infobox"></div> 
        <div style="background-color: blue" class="infobox"></div> 
        <div style="background-color: green" class="infobox"></div> 
        <div style="background-color: red" class="infobox"></div> 
        <div id="infobot"> 
         <div id="white"></div> 
         <div id="logo"><img style="height: 100%" src="img/logo3.png"></div> 
        </div> 
      </div>  
     </div> 




     <script> 
     $('#video, #nav').on('click', function(){ 
      $('#nav').toggleClass('rotate'); 
     }); 
     </script> 




     <script> 
     $(document).ready(function(){ 
      $("#video, #nav").click(function(){ 
      $("#infowrap").fadeToggle(250); 
      }); 
     }); 
     </script> 




     <video id="video" src="vid/147000037.mp4" autoplay loop> 
    </body> 

</html> 

CSS:

* { 
    margin: 0; 
    padding: 0; 
} 

body { 
    width: 100%; 
    height: 100%; 
    background-color: purple; 
} 

header { 
    position: relative; 
    display: block; 
    height: auto; 
    width: 100%; 
    z-index: 999; 
    min-width: 520px; 
} 

#nav { 
    -webkit-transition: all 0.5s; 
    position: absolute; 
    float: right; 
    display: block; 
    top: 5px; 
    right: 15px; 
    color: #000000; 
} 

#nav a { 
    font-family: "HelveticaNeue-UltraLight","HelveticaNeue-Light","Helvetica Neue",Helvetica,Arial,sans-serif; 
    text-decoration: none; 
    font-size: 2.5em; 
    color: #000000; 
} 

.rotate { 
    -webkit-transform: rotate(45deg); 
    -webkit-backface-visibility: hidden; 
} 

#video { 
    position: fixed; 
    top:0px;left:0px;right:0px;bottom:0px; 
} 

#container { 
    position: absolute; 
    width: 100%; 
    height: 100%; 
    min-width: 520px; 
    min-height: 620px; 
} 

#infowrap { 
    z-index: 900; 
    display: none; 
    position: absolute; 
    top:10px;left:10px;right:10px;bottom:10px; 
    background-color: ; 
    min-width: 500px; 
} 

#infotop { 
    width: 100%; 
    height: 6%; 
    min-width: 500px; 
    float: left; 
    clear: both; 
    display: block; 
} 

.infobox { 
    width: 50%; 
    height: 44%; 
    min-width: 250px; 
    min-height: 250px; 
    float: left; 
    display: block; 
} 

#infobot { 
    width: 100%; 
    height: 6%; 
    min-width: 500px; 
    float: left; 
    clear: both; 
    display: block; 
} 

#white { 
    height: 100%; 
    width:; 
    float: left; 
    display: block; 
    background-color: white; 
} 

#logo { 

    float: left; 
    display: block; 

} 

回答

0

DEMO

CSS:

#infobot { 
    width: 100%; 
    height: 6%; 
    min-width: 500px; 
    float: left; 
    clear: both; 
    display: block; 
    background:#cf5; /* some bg color? */ 
} 

#white { 
    height: 100%; 
    width:50%;  /* !!! */ 
    float: left; 
    display: block; 
    background-color: #fff; 
} 

而且BTW使用:

$(function(){ 
    $("#video, #nav").click(function(){ 
     $("#infowrap").fadeToggle(250); 
     $('#nav').toggleClass('rotate'); 
    }); 
}); 
+0

感谢您的快速回复Roxon。这不是我所需要的。我希望#logo中的图像可以决定其宽度,“剩余”宽度由#white填充。同时保持元素流畅。 – user2273444 2013-04-29 13:15:00

+0

顺便说一句,感谢您的脚本:) – user2273444 2013-04-29 13:17:18

+0

@ user2273444我不明白你想要什么,所以图像走了,图像宽度怎么样?你希望它是固定的还是流动的?为什么你需要#white呢? – 2013-04-29 15:53:49