I have been searching for days and I give up. Please, help. I have two elements--logo and a div navigation. They are aligned on top of each other and centered to each other. So not flushed left, but center to center.
Currently, I have them in a single wrapper div to attempt to keep them together, but I don't need them to be that way. The navigation must start below the logo but end at the bottom of the page, regardless of the browser height, content on the page, etc. The nav must touch the bottom.
If I have the navigation as position:absolute, it reaches the bottom, but doesn't center to the logo above. I have margin: 0 auto; on the navigation, but it ignores it when on absolute.
If I set the navigation to relative, it doesn't reach the bottom of the page, despite having html, body, and the wrapper div set to height 100%. The problem is the navigation seems to stop at the height the browser thinks the wrapper div's height rather than the actual wrapper height that I can see if I add a border.
I'm not sure if that makes sense, but here's my simplified code. There's probably a simpler way to do this and I'm now over-thinking the whole thing.
I'm confused about what you want. Can you post a screenshot of what you're getting now, and what you want? I'll be happy to help once I understand what you're asking!
if you set position:absolute of the wrapper then everything inside will follow. So logo doesn't need to have a position set, you could make it text-align:center, but since the #logo width is 100% I don't see how you'll be able to tell it is centered or not (technically it is centered if it is 100% width of the parent with no position adjustment).
You don't always have to specify widths and heights for absolute positioned elements. Setting top and bottom or left and right 'fixes' their width (or height) in relation to their container, if you experiment a little you'll see how it works... Also, if you want to set a margin:auto; for an absolute positioned element, all you need to do is to set a width and left and right the same works for top and bottom... At last, I suppose you want something like this?
Currently, I have them in a single wrapper div to attempt to keep them together, but I don't need them to be that way. The navigation must start below the logo but end at the bottom of the page, regardless of the browser height, content on the page, etc. The nav must touch the bottom.
If I have the navigation as position:absolute, it reaches the bottom, but doesn't center to the logo above. I have margin: 0 auto; on the navigation, but it ignores it when on absolute.
If I set the navigation to relative, it doesn't reach the bottom of the page, despite having html, body, and the wrapper div set to height 100%. The problem is the navigation seems to stop at the height the browser thinks the wrapper div's height rather than the actual wrapper height that I can see if I add a border.
I'm not sure if that makes sense, but here's my simplified code. There's probably a simpler way to do this and I'm now over-thinking the whole thing.
Oh, and it all needs to be responsive.
CSS:
HTML:
Am I missing something?
Also, if you want to set a margin:auto; for an absolute positioned element, all you need to do is to set a width and left and right the same works for top and bottom...
At last, I suppose you want something like this?