Jump to content
  • 0

Подскажите в центрировании UL


Caption
 Share

Question

Добрый день, не совсем пойму как сделать UL список по центру внутри div.

text-align помогает, но когда я делаю элемент LI - float:left; весь список сдвигается.

т.е:


.c_circle {
margin: 0 auto;
overflow: hidden;
text-align:center;

}
.tab_circle ul{
list-style-type: none;
}
.tab_circle ul li{
float:left;
height:17px;
width:17px;
background:url(circle.gif) 0 0 no-repeat;
}


<div class="c_circle" >
<div class="tab_circle" >
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
</div>

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Мне нужно чтобы список был по середине, НО элементы списка в линию, т.е. LI - float:left;

Код выше, он работает без float:left;, список по середине.

как только добавляю float:left; список становится в линию, но сдигается в лево.

Link to comment
Share on other sites

  • 0
Код выше, он работает без float:left;, список по середине.

Не посередине он, а всю ширину занимает. text-align, который выше, тут вообще не влияет никак и влиять не может. Чтоб работало, надо списку задать ширину и margin: 0 auto;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy