- This topic is empty.
January 16, 2014 at 4:49 am #160508sjoerdthParticipant
I’m trying to get a fixed to top header and a fixed to bottom footer, now that in itself isn’t really the problem, but because of the fixed position the content in .wrapper–main (in my example) goes under the header and the footer.
I have thought of 2 solutions, but I don’t really like them:
a) This can be solved by adding top and bottom padding to .wrapper–main in the css (commented in the example), but that’s an ugly solution and would mean the footer and header need a fixed height.
b) Another solution would be to get the height of the footer and the header with JS and give the .wrapper–main a top padding equal to the header height and a bottom padding equal to the footer height. This option is slightly better than a because it’s more flexible, but it requires JS to set the padding and also when you would resize the browser and the height of the footer or header would change.
So what I’m looking for is a nice flexible css only solution, it’s probably out there somewhere, but I just can’t find it, hope you guys can help me :)January 16, 2014 at 4:56 am #160509Paulie_DMember
Flexbox….but it has poor/limited browser support at the moment.
Sometimes we just have to work with what we have.January 16, 2014 at 5:02 am #160510sjoerdthParticipant
Yeah, flexbox seems so sexy, but also a few years away to use reliably cross browser :-(
But I think it’s indeed a dead end, there’s only so many google queries one can try before encountering the same purple links over and over :)
Still, if anyone has a bright idea, let me know.January 16, 2014 at 3:03 pm #160569MikesBarto2002Participant
Why is flexbox not an option? The only places that flexbox isn’t really working well is in IE9 and below and on Opera Mini. Can’t you use flexbox and then use a tool like Modernizr to check for the browsers that don’t support it? You just need to add -webkit and -ms prefixes at the moment, and you can use a tool like Autoprefixer to even avoid that.
And is it really that bad if IE9 and below doesn’t have the padding when those are browsers that are being faded out of play?
- The forum ‘CSS’ is closed to new topics and replies.