html代码怎么居中显示

<!--[if lt IE 8]><style type="text/css">.topbar{margin-top:80px;}
#warning{ width:100%; height:80px; line-height:80px; background:#ffd; position:fixed; _position:absolute; top:0; z-index:99999; overflow:hidden;}
#warning a{color:#36538f!important;}
#warning .inner h5{ font-size:18px; color:#f00;}
#close{ font-size:14px; position:absolute; top:0; right:30px;}</style> <script type="text/javascript">//CloseFootbar
jQuery(document).ready(function($) {
$("#close").click(function() {
$("#warning").hide("fast").css( "display", "none" );
$(".topbar").css( "margin-top", "0" );
});
});</script> <div id="warning"><div class="inner"><h5><strong>提示</strong>:您的IE浏览器版本过低,推荐您<strong>升级浏览器</strong>获得更好的用户检验: <a href="http://windows.microsoft.com/zh-cn/internet-explorer/download-ie" target="_blank">IE浏览器</a> <a href="http://www.firefox.com.cn/" target="_blank">Firefox 火狐浏览器</a> <a href="http://chrome.360.cn//" target="_blank">360极速浏览器</a></h5></div> <a id="close" href="javascript:void(0);">x 关闭</a></div> <![endif]--> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
这代码放到网站靠右边显示了 不能完整显示出来 怎么让他居中完整显示出来?
本人菜鸟 麻烦把完整代码写上来

#warning{ width: 987px; margin: 0 auto; height:80px; line-height:80px; background:#ffd; position:fixed; _position:absolute; top:0; z-index:99999; overflow:hidden;}
要居中的话宽度不能用百分比 只能是具体数值

温馨提示:内容为网友见解,仅供参考
第1个回答  2018-05-17
使用浮动、相对定位,绝对顶问杨改都可以实现,如果是标签中的文字的话可以使用text-align:center;
相似回答