Caption Posted June 14, 2011 Report Share Posted June 14, 2011 Добрый день, не совсем пойму как сделать 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> Quote Link to comment Share on other sites More sharing options...
0 Gaspode Posted June 14, 2011 Report Share Posted June 14, 2011 Вам нужно центрировать список, элементы списка или текст внутри элементов списка о_О? Quote Link to comment Share on other sites More sharing options...
0 Caption Posted June 14, 2011 Author Report Share Posted June 14, 2011 Мне нужно чтобы список был по середине, НО элементы списка в линию, т.е. LI - float:left;Код выше, он работает без float:left;, список по середине.как только добавляю float:left; список становится в линию, но сдигается в лево. Quote Link to comment Share on other sites More sharing options...
0 Gaspode Posted June 14, 2011 Report Share Posted June 14, 2011 Код выше, он работает без float:left;, список по середине.Не посередине он, а всю ширину занимает. text-align, который выше, тут вообще не влияет никак и влиять не может. Чтоб работало, надо списку задать ширину и margin: 0 auto; Quote Link to comment Share on other sites More sharing options...
0 Caption Posted June 14, 2011 Author Report Share Posted June 14, 2011 А как быть если я за ранее не знаю ширину списка ? Quote Link to comment Share on other sites More sharing options...
0 Gaspode Posted June 14, 2011 Report Share Posted June 14, 2011 Тогда надо поставить для ul и li display: inline-block (float убрать, text-align вверху оставить). Но ie 6-7 сдохнут на этом. Как под них подогнать, навскидку не скажу. Quote Link to comment Share on other sites More sharing options...
0 Softlink Posted June 14, 2011 Report Share Posted June 14, 2011 Вот здесь подобная проблема обсуждалась http://forum.htmlbook.ru/index.php?showtopic=27128 Quote Link to comment Share on other sites More sharing options...
Question
Caption
Добрый день, не совсем пойму как сделать UL список по центру внутри div.
text-align помогает, но когда я делаю элемент LI - float:left; весь список сдвигается.
т.е:
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
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.