简体   繁体   English

如何在中心并排对齐两个div?

[英]How to align two divs side by side in center?

Look: http://jsfiddle.net/Ak334/ 外观: http//jsfiddle.net/Ak334/

I'm trying to put the divs div_vagas_disponiveis and div_percentual_vagas side by side, and alining in center of the div fieldset . 我试图把div的div_vagas_disponiveisdiv_percentual_vagas并排,并在div的中心alining fieldset What am i missing? 我想念什么?

try this: 尝试这个:

#div_vagas_disponiveis {
   display: inline-block;
}
#div_percentual_vagas {
   display: inline-block;
}

here is working: http://jsfiddle.net/Ak334/3/ 在这里工作: http : //jsfiddle.net/Ak334/3/

good luck! 祝好运!

EDIT: 编辑:

now check this: http://jsfiddle.net/Ak334/9/ 现在检查此: http : //jsfiddle.net/Ak334/9/

if found this hacks on google: 如果在Google上发现此黑客:

display: inline-block; /* FF2*/
vertical-align: top; /* BASELINE CORRECCIÓN*/
zoom: 1; /* IE7 (hasLayout)*/
*display: inline; /* IE */
_height: 20px; /* IE6 */

and I check it on chrome, IE7 and IE8 我在chrome,IE7和IE8上进行了检查

this is the link where I found it (in spanish): 这是我找到它的链接(西班牙语):

http://ferticidio.com/display-inline-block-para-ie-y-los-demas-navegadores http://ferticidio.com/display-inline-block-para-ie-y-los-demas-navegadores

try this : 尝试这个 :

http://jsfiddle.net/Ak334/2/ http://jsfiddle.net/Ak334/2/

  <div style="width:270px;margin:0px auto;">

Use following CSS 使用以下CSS

#fieldset div   // you should think about changing id "fieldset is a HTML tag"
{
   display:inline-block;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM