<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>
<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>
这是我放在我网站上的 chatango 聊天框的代码。出于某种原因,它居中,但居中关闭。我应该怎么做才能纠正这个问题?
最佳答案
设置最外层的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>
关于html - 为什么这个聊天框不居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30082664/