Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Alignment not working for unordered list item  RSS feed

 
raman kadam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Could you please suggest why center alignment of the below div element does not work and it always appears on the left side if I don't mention display:inline-block for ul.pagination ?

Navigation.PNG
[Thumbnail for Navigation.PNG]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66204
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why did you float left?
 
raman kadam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

Thanks for the reply.

There is nothing like float:center as per the developer tool.
If I do write float:center or float:middle or remove it altogether, it works somehow but then some gap appears between two blocks even after keeping margin to 0;
Navigation2.PNG
[Thumbnail for Navigation2.PNG]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66204
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't say anything about a float center. Why use float at all?
 
raman kadam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I don't use float , it creates gap between blocks though it appears at the center.
Navigation3.PNG
[Thumbnail for Navigation3.PNG]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66204
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So find out what's causing those gaps and deal with that. As you can see, adding float is a sledgehammer that causes more problems than it causes.

In some cases, I've found that you may need to put all of the <li> elements on the same line of HTML so that there is no whitespace between them.
 
raman kadam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear, that worked !
I tried changing font-size to 0 but didn't work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!