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 trialDungaamaa Tudevdorj
8,815 Points.col width
Some reason when i put my .col width to 6o and 40 % and margin-right:-5px; my primary and secondary content does not align next to each other. after I make them under 100% ( 50 and 40) It will jump in to next to each other. Am I doing something wrong? Is it browser issue? Im on firefox.
PS. Even when i downloaded project file 1-5 and 1-6/Start primry-content and secondary-content wont come to next to each other.
2 Answers
Jonas Mørkeby
3,530 PointsHello. It is hard to say without seeing the actual code, but do you have borders on your columns?
Sometimes the borders trick you because you forget to count in their pixels. So if you have a column with 60% width and 1px borders, and another column with 40% width and 1px borders... That gives you a width larger than 100% because it's 60% + 40% + 1px + 1px + 1px + 1px.
And in addition to that you have the margin-right:-5px, which I don't know what is doing in your case exactly, but this could give you some issues too depending on how the columns are positioned and floated.
Hope this is a help to you... Otherwise please show us your code, so we can see the issue ourselves. :)
Dungaamaa Tudevdorj
8,815 PointsWell i am following step by step CSS Layout Technique videos. and lesson 1-5. and code is: CSS ```.col { display: inline-block; padding:20px; margin-right: -5px; vertical-align: top; }
.primary-content { width:60%; }
.secondary-content { width:40%; }```
HTML
<div class="primary-content col">
<h2>Primary Content</h2>
<p>Bacon ipsum dolor sit amet chicken pork ground round brisket corned beef ball tip shank tail salami filet mignon ham hock pork belly venison shankle. Pig kielbasa drumstick sausage pork chop boudin. Chicken t-bone salami pork chop, beef ribs kevin ham tri-tip beef venison biltong brisket.</p>
<p>Venison strip steak meatball chicken, brisket prosciutto sirloin. Capicola drumstick brisket tri-tip salami. Chicken beef jerky, tail turkey prosciutto cow ham sirloin boudin tenderloin. Meatloaf tri-tip turducken brisket andouille, pork belly corned beef fatback hamburger.</p>
</div>
<div class="secondary-content col">
<h3>Secondary Content</h3>
<p>Strip steak tenderloin kevin swine meatloaf capicola, doner beef turducken pancetta corned beef pork loin shoulder.</p>
<hr>
<p>Pork filet mignon leberkas, tail swine venison pancetta turkey shoulder brisket chalkers likes hamburgers.</p>
</div>