本文介绍了我怎样才能中心我的UL列表在CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下html代码:

 < section class =video> 
< div class =container>
< div class =row>
< div class =col-md-12 text-center>

< ul class =footer-nav>
< li>< a href =#>联络人< / a>< / li>
< li>< a href =#>按< / a>< / li>
< li>< a href =#>招聘< / a>< / li>
< li>< a href =#>商业< / a>< / li>
< li>< a href =#>招聘< / a>< / li>
< li>< a href =#>商业< / a>< / li>
< / ul>

< / div>
< / div>
< / div>
< / section>

以及包括我的CSS(在



只需添加

  ul {
text-align:center;
}

li {
display:inline-block;
}

祝您好运! ;)

I have the following html code:

<section class="video">
            <div class="container">
                <div class="row">
                    <div class="col-md-12 text-center">

                        <ul class="footer-nav">
                            <li><a href="#">Contact</a></li>
                            <li><a href="#">Press</a></li>
                            <li><a href="#">Careers</a></li>
                            <li><a href="#">Business</a></li>
                            <li><a href="#">Careers</a></li>
                            <li><a href="#">Business</a></li>
                        </ul>

                    </div>
                </div>
            </div>
        </section>

and with my CSS included (in the jsfiddle) I get the result that the text is aligned to the left... How can I center everything, so the result says:

                  Contact  Press  Careers  Business  Careers  Bussiness

?Thanks.

解决方案

http://jsfiddle.net/tfLz08vd/2/

just add

ul {
text-align: center;
}

li {
display: inline-block;
}

Good luck! ;)

这篇关于我怎样才能中心我的UL列表在CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 19:43
查看更多