如何把由js生成的內容水平居中?


一.問題來源

  如右側的微博關注組件,直接用div的align居中沒效果,我就開始百度了。即在<div> <script>.....</script>  </div>  中,如何使<script>.....</script>中的內容在div 標簽中處於水平居中?

<!-- 微博關注組件 -->
<div align="center">
<html xmlns:wb="http://open.weibo.com/wb">
<script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js" type="text/javascript" charset="utf-8"></script>
<wb:follow-button uid="1625125434" type="red_3" width="100%" height="24" ></wb:follow-button>
</div>

 

二.解決方案

1  <div>
2 <table border="0" cellpadding="0" cellspacing="0" style="margin-left:auto; margin-right:auto;">
3  <tr>
4   <td>..........</td>
5  </tr>
6 </table> 
7 </div>

  style="margin-left:auto; margin-right:auto;"是為了讓table橫向居中,td默認是垂直居中的,果然有效。

  參考文獻:http://zhidao.baidu.com/link?url=110cA7m26328x4m_ACl1KW7SWyegVOEQFj3QdmPYJrqnaaq7Uk9rrYa_8LDcF3TTWdb-_7OWgbtwzVbILaHdza

三.龍源湖放風箏

  本來想把右側的圖片更新成今天的,試了試發現完全看不清楚,換回來吧。

  留住青春。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM