![]() |
Floating Divs and Positioning
I built a website for some friends www.crossfitsumter.com, go to the about page to see the div's in question. and It seems to work well, but not on mobile devices and lower resolution monitors. in low res situations, the right hand sidebar ends up underneath the center content. I know i'm supposed to wrap all the floating div's inside a main content wrapping div but I cannot get it to work right and still have the content positioned in the center of the screen the dive 'white' is the main content wrapper and the three div's that need to fit on the screen are transboxleft, center, ad right. Any help or advice would be greatly appreciated. Here is my CSS:
Code:
* { margin:0; padding:0; } |
for responsive layouts... the ones that are used for mobile and handheld, you can't set any of the widths, left and right margins or left and right paddings using pixels. If you are using pixels for widths (even with a wrapper using %) your elements will have issues with their layout.
Change every pixel to % on the left and right sides. Heights are never a concern for these kinds of layouts, just the horizontal stuff. Be aware though.. setting a div to 80% makes it 80% of the parent element... so in the case of a div inside your wrapper, it would be 80% of the wrappers 90% and not 80% of the screen. Divide your widths, margins, etc by the pixeled variation of your width (90% of 1280 pixels = 1134 pixels for your wrapper... 300 pixel for your div / 1134 = 26.45502645502646 % width for that div. 20 pixel margin on the right would be 1.7636684303351%... etc. |
By the way... to properly center your entire wrapper (.white) delete your margins on it and put margin: 30px auto; The 30px will give it a margin on top and bottom of 30px (if that's what you wanted) and the auto will center the content on the page. Also, if you have floating elements inside a parent element, you should try overflow:hidden; so that the parent takes up the space and doesn't collapse.
|
| All times are GMT +1. The time now is 04:26 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.