I am trying to center a div in my first responsive layout
You can see a test page here:
I would like to center my content, but I guess the position:absolute doesn’t work when the div doesn’t have a fixed width…
Hope you can help
The width of div is determined by the column number.
If you change this to twelvecol rather than ninecol it gets centered but wider.
I just thought of a solution.
I would like to have a slimmer centered column. So why not add an empty column on the side?
seems to work
That you can do but it’s a failing of this grid system (as far as I can see) that you have to add empty divs to center a column.
Also, since this is a 12 column grid system, I would suggest making the middle div either 8 or 10 cols wide with 2 or 1 on either side…it’s ugly coding but it will work.
Whether you could tweak the margins of the ninecol to center it might also be a better thought.
I agree that it is not totally clean to use an empty div
I hope that I will figure out a better solution, but for now it works
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".