简体   繁体   English

使用位置:绝对值在容器和jQuery中

[英]Using position: absolute in a container and jQuery

All, I'm trying to get my positioning set up and I'm having some issues with it. 所有人,我都试图建立自己的定位,但遇到一些问题。 You can view the code here: 您可以在此处查看代码:

http://jsfiddle.net/treeleaf20/2cwQp/ http://jsfiddle.net/treeleaf20/2cwQp/

I'm trying to get the reviews to always be in the center of the reviews_container. 我试图使评论始终位于reviews_container的中心。 You can click on the arrows and it will actually change the text. 您可以单击箭头,它实际上会更改文本。 I'd like to make it so that the reviews that come up are display vertically in the middle with the arrows on the side of them in the middle. 我希望这样做,以便将出现的评论垂直显示在中间,而箭头则位于中间。 Any help you could provide would be greatly appreciated! 您能提供的任何帮助将不胜感激! I found the only way I can rotate the reviews and have them look good is through absolute positioning but them my other elements don't look right. 我发现可以轮换评论并使它们看起来不错的唯一方法是通过绝对定位,但是我的其他元素看起来不正确。

Thanks! 谢谢!

You can try setting the position of the outer container to relative , but you might have better luck using a CSS table-based layout: 您可以尝试将外部容器的位置设置为relative ,但是使用基于CSS表格的布局可能会更好:

<style type="text/css">   
#container {    
    display:table;    
    border-collapse:collapse;    
}         
#layout {    
    display:table-row;    
}           
#content {    
    text-align:center; 
    display:table-cell;    
}           
</style>        
<div id="container">    
    <div id="layout">    
        <div id="content"> 
            <!-- content here --> 
        </div>  
    </div>   
</div> 

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

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