如何扩展div来填充中间列中任何大小的宽度?

时间:2012-07-05 17:10:26

标签: html css css3 position

Demo jsFiddle 我有div颜色azure我想填充中间列的宽度区域没有米将是什么尺寸。 有没有css3 / css没有jQuery的解决方案?

我需要它像这张照片: enter image description here

像这样的ststus电流:

很多Thx。

enter image description here  Demo jsFiddle

代码html:

<div id="frame">
  <div id="inside_window">
    <div id="Yellow"></div>
    <div id="Green"></div>
        <div id="Blue"></div>
    <div id="Red"></div>
    <div id="ver"></div>
    <div id="hor"></div>
    <div id="ver2"></div>
  </div>
 </div>

代码css:

  html, body{
  height:100%;
   background-color: azure;
            } 
    #frame
{
position: relative;
background-color: black;
height: 100%;
width: 100%;
margin: auto;
padding:0;
border: 1px solid black;
}

#Yellow
{
position: absolute;
height: 100%;
width: 150px;
-webkit-border-radius: 0px;    
margin: 0 ;

    background-color: Yellow;
    z-index:10;
    display:table;

left:0px;
top:0; 
}

#Green
{
position: absolute;
height: 100%;
width: 150px;
-webkit-border-radius: 0px;    
margin: 0 ;

    background-color: green;
    z-index:10;



right:0px;
top:0; 
}

#Blue
{
position: relative;
height:100%;
min-width:65.8%;
-webkit-border-radius: 0px;    
margin: 0 auto;

    background-color: #62A9FF;
    z-index:10;
    display:table;
    font-size:220%;


left:0px;
top:0px; 
}

#Red
{
position: absolute;
height: 150px;
width: 100%;
-webkit-border-radius: 0px;    
margin: 0 ;

    background-color: red;
    z-index:10;
    border: 1px solid black;

left:0px;
bottom:0px; 
}

#inside_window
{

width:100%;
height:100%;
margin:0 auto;    
position: relative;
border: 1px solid black;

background-color: brown;
-webkit-transform: rotate(0deg); 
-webkit-transform-origin:50% 50%; 
}
#ver
{
position: absolute;
    height: 100%;
    width: 5px;
    margin: 0;
    background-color: white;
    left:150px;
    top:0px;   
    z-index:1;
}
#hor
{
position: absolute;
    height: 5px;
    width: 100%;
    margin: 0;
    background-color: white;
    left:0px;
    bottom:150px;
        z-index:20;
}
#ver2
{
position: absolute;
    height: 100%;
    width: 5px;
    margin: 0;
    background-color: white;
    right:150px;
    top:0px;   
    z-index:1;
}
​

2 个答案:

答案 0 :(得分:1)

尝试从蓝色代码中删除以下CSS:

position: relative;
display:table;

答案 1 :(得分:1)

有很多方法可以实现这样的布局。假设您可以更改内容的顺序,您可以随时尝试"Holy Grail" layout method