Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMarty Hitchcock
13,108 PointsCSS Positioning
Hi,
I have been trying to create a website while learning CSS. Problems arise all the time but I always seem to find a way to solve them either via re-watching the videos here or pure persistence. However there is something I don't quite understand and could really use some help on.
Here is a picture of what I am talking about: http://www.choiceas.com/positioning.jpg
It is using a 12 column grid with a fixed side panel set to 80px (smaller than the 6.5% a single column would be). The middle content is over 8 columns and the right content is over 3. In theory I thought that would all fit across the page easily and the gap between the middle and right side would be more than enough.
What am I not seeing? I can solve the problem by moving the middle column across another 10 px but that results in it looking odd so would like to avoid that, but more importantly I would like to understand why the right column needs a sizeable gap.
. Thanks, Marty
3 Answers
Sam Deighton II
25,602 PointsHello Marty, I'm not an expert by any means, just an ideas. Without code it is difficult to say, you may want to check there is no extra margin/padding. If the grid has gutter that could throw it off too. If you have google chrome or firefox right click and try the inspect element option. That may give you an idea to the solution.
Ricardo Hill-Henry
38,442 PointsDon't forget that the browser does add on any padding applied to an element with that element's width. To fix that, you may want to reduce padding, or use the box-sizing property with border-box or padding-box values.
There also appears ti be some margin added to the left box. This won't be added to the elements width, but it does take up space when determining the amount of space available to include the right column.
Marty Hitchcock
13,108 PointsAh good ideas,
I inspected the right element and it showed a left margin which is preventing it from moving up the page. I had set the margins for that div to zero so unsure where that margin is coming from but atleast the problem is more clear now.
Thanks for the help!