- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi, how do you center a dynamic div? If you know that the cotent inside it may grow in future , you cannot give it a fixed width and do margin:0 auto; . Sometime text-align: Center; works but not always. Like here is a situation, how do I center my pagination at the bottom? This is the LINK to my website.
Please help.
Thanks
You can center it by giving it a max-width and the margin:auto
Thanks Paulie, can you explain a little more please. I didn’t get it , Like in my case what max-width shall I give to center the pagination when I know that the pagitation may go full wide?
Margin:auto only works with a fixed width or a max-width.
I don’t know the full CSS or HTML structure of your page or any sub elements of the div (or components of the pagination) but try experimenting.
However, what you are actually trying to do is have the span and `a` center inside the div (which would be also be centered)
What you might try is using `inline-block` on the span and anchors and setting text-align center on the div.
Sort of like this…http://codepen.io/Paulie-D/pen/liuep
That’s exactly I just did, thanks Paulie
I think it always do the job.