为什么赢得这个聊天室中心?

时间:2015-05-06 16:39:03

标签: html css

function rotate(arr) { return move(arr, 1, 0, 999); }

这是我在我的网站上放置的聊天聊天框的代码。由于某种原因,它集中,但中心是关闭。我该怎么做才能纠正这个问题?

3 个答案:

答案 0 :(得分:2)

将最外面的div的width设置为100%,然后设置table margin: 0 auto。这是最终的代码:

<div class="container chat" style="width: 100%">
    <div class="chat-bar" style="text-align:center"><h1 style="color:white">Wolf Valley Chat</h1></div>
    <div class="chat-content">
        <table style="margin: 0 auto">
            <tbody>
                <script id="cid0020000091912718480" data-cfasync="false" async src="//st.chatango.com/js/gz/emb.js" style="width: 800px;height: 350px;">{"handle":"wolfvalleychat","arch":"js","styles":{"a":"202020","b":91,"c":"FFFFFF","d":"FFFFFF","f":91,"i":91,"k":"202020","l":"202020","m":"202020","n":"FFFFFF","o":91,"p":"10","q":"202020","r":91,"t":0,"surl":0,"allowpm":0,"cnrs":"0.35","fwtickm":1}}</script>
            </tbody>
        </table>
    </div>
 </div>

答案 1 :(得分:1)

如果您想使用margin:0 auto进行居中,必须定义 div的宽度才能居中。你可以修正班级container chat的宽度。离。

<div style="width: 800px; margin: 0px auto;" class="container chat">

答案 2 :(得分:0)

问题出现在你的iframe的宽度上,当它应该是100%的时候你有800px

<div class="container chat" style="width: 50%; margin: 0px auto;">
<div class="chat-bar"><h1>Wolf Valley Chat</h1></div>
<div class="chat-content">
    <table style="width: 100%;">
        <tbody>
            <script id="cid0020000091912718480" data-cfasync="false" 
async src="//st.chatango.com/js/gz/emb.js" 
style="width: 100%;height: 350px;">
{"handle":"wolfvalleychat","arch":"js","styles":{"a":"202020","b":91,"c":"FFFFFF","d":"FFFFFF","f":91,"i":91,"k":"202020","l":"202020","m":"202020","n":"FFFFFF","o":91,"p":"10","q":"202020","r":91,"t":0,"surl":0,"allowpm":0,"cnrs":"0.35","fwtickm":1}}</script>
        </tbody>
    </table>
</div>