2011-02-04 174 views
0

我似乎无法理解什么是怎么回事:CSS - 垂直居中

我要垂直居中的iframe &另一个div这两个水平将坐在一起彼此。

我所做的是我已经将上述两个(iframe和div)放在另一个名为“iframe_r_container”的div内,并将其定位为绝对& display set as table。

HTML:

<body id="container"> 

    <div id="menu_bars"> 
     <div id="main_bar"> 
      <ul> 
       <li class="maintabs"><a href="#">a</a></li><li class="maintabs"><a href="#">b</a></li><li class="maintabs"><a href="#">c</a> 
       </li><li class="maintabs"><a href="#">d</a></li> 
      </ul>   
     </div> 

     <div id="filemenu"> 
      <ul> 
       <li class="filetabs"><a href="#">File</a></li><li class="filetabs"><a href="#">Edit</a></li><li class="filetabs"><a href="#">Settings</a></li> 
      </ul> 
     </div> 
    </div> 

    <div id="iframe_r_container"> 
     <iframe id="iframing" src="mannequin.html" frameborder="0" ></iframe> 

     <div id="right_container"> 
      <div id="user_credit"> 
       <h1><a href="#">Username</a></h1><br /> 
       has <span id="credits">000</span> credits. 
      </div> 

      <div> <button id="template_button"><img src="images/Coutallure-WebApp/template_button.png" /><span>Templates</span></button> </div> 

    <!-- contains the jquery widget for displaying the features, i.e. buttons, zips etc --> 
      <div id="features_container"> 

      </div> 
     </div> 
    </div> </body></html> 

这里是CSS:

/* RESETS */ 
html, body, div, span, 
object, iframe, h1, h2, h3, h4, h5, 
h6, p, blockquote, pre, a, abbr, 
address, cite, code, del, dfn, em, 
img, ins, kbd, q, samp, small, strong, 
sub, sup, var, b, i, dl, dt, dd, ol, 
ul, li, fieldset, form, label, legend, 
table, caption, tbody, tfoot, thead, 
tr, th, td, article, aside, canvas, 
details, figure, figcaption, hgroup, 
menu, footer, header, nav, section, 
summary, time, mark, audio, video { 
    margin: 0; 
    padding: 0; 
    border: 0; 
    font-family: Helvetica, 'Myriad Pro', Arial, sans-serif; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-weight: bold; 
    font-size: 10px; 
    color: rgba(34,34,34,1); 
} 
a img {border: 0;} /* END OF RESET */ 

#container { 
    width: 960px; 
    height: 100%; 
    background: rgba(255,255,255,0.8); 
    margin: 0 auto; 
    position: relative; 
} 

#menu_bars { 
    position: relative; 
    width: 960px; 
    margin: 0 auto; 
} 

/* START OF MAIN BAR */ 
#main_bar ul { 
    float: left; 
    width: 630px; 
    height: 48px; 
} 

..........它的推移和及以下问题区域,我认为

/* START OF IFRAME_R_CONTAINER */ 
#iframe_r_container { 
    display: table; 
    position: relative; 
    top: 48px; 
    bottom: 38px; 
    width: 960px; 
} 

/* START OF IFRAME */ 
#iframing { 
    display: table-column; 
    width: 640px; 
    height: 480px; 
    margin: 10px auto; 
} 
/* END OF IFRAME */ 


/* START OF RIGHT CONTAINER */ 
#right_container { 
display: table-column; 
    width: 113px; 
    margin: 20px; 
} 

#user_credit { 
    font-size: 10px; 
    text-transform: lowercase; 
    line-height: 8px; 
    margin-bottom: 20px; 
} 

#user_credit h1 a { 
    font-size: 14px; 
    font-weight: bold; 
    text-decoration: none; 
} 

#template_button { 
    width: 130px; 
    height: 28px; 
    background: rgba(238,238,238,0.8); 
    border: 1px solid rgba(0,0,0,0.2); 
    -webkit-border-radius: 5px; 
    -moz-border-radius: 5px; 
    border-radius: 5px; 
    margin-left: -10px; 
} 

#template_button img { 
    margin: 3px 6px 4px 0px; 
} 

#template_button span { 
    vertical-align: 11px; 
} 

#feature_container { 
    width: 300px; 
    height: auto; 
    display: inline-block; 
} 

/* END OF RIGHT CONTAINER */ 
/*END OF IFRAME_R_CONTAINER */ 
+0

你能给出它的样子的截图吗? – corroded 2011-02-04 06:47:28

回答