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 trialtomd
16,701 PointsI've been stuck for hours. My columns just wont work..
Columns are at 40%, 30%, 30%. Border box is on and they just wont appear on the same line. Im lost.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Best City Guide</title>
<link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header class="main-header">
<div class="wrap clearfix">
<h1 class="name"><a href="#">Best City Guide</a></h1>
<ul class="main-nav">
<li><a href="#">ice cream</a></li>
<li><a href="#">donuts</a></li>
<li><a href="#">tea</a></li>
<li><a href="#">coffee</a></li>
</ul>
</div>
</header><!--/.main-header-->
<div class="banner">
<div class="container center">
<img class="logo" src="img/city-logo.svg" alt="City">
<h1 class="headline">The Best City</h1>
<span class="tagline">The best drinks and eats in the best city ever.</span>
</div>
</div><!--/.banner-->
<div class="container clearfix">
<div class="secondary col">
<h2>Welcome!</h2>
<p>Everything in this city is worth waiting in line for.</p>
<p>Cupcake ipsum dolor sit. Amet chocolate cake gummies jelly beans candy bonbon brownie candy. Gingerbread powder muffin. Icing cotton candy. Croissant icing pie ice cream brownie I love cheesecake cookie. Pastry chocolate pastry jelly croissant.</p>
<p>Cake sesame snaps sweet tart candy canes tiramisu I love oat cake chocolate bar. Jelly beans pastry brownie sugar plum pastry bear claw tiramisu tootsie roll. Tootsie roll wafer I love chocolate donuts.</p>
</div><!--/.secondary-->
<div class="primary col">
<h2>Great food</h2>
<img class="feat-img" src="img/treats.svg" alt="Drinks and eats">
<p>Croissant macaroon pie brownie. Cookie marshmallow liquorice gingerbread caramels toffee I love chocolate. Wafer lollipop dessert. Bonbon jelly beans pudding dessert sugar plum. Marzipan toffee dragée chocolate bar candy toffee pudding I love. Gummi bears pie gingerbread lollipop.</p>
</div><!--/.primary-->
<div class="tertiary col">
<h2>How to get here</h2>
<p><strong>Plane: </strong>Tiramisu caramels gummies chupa chups lollipop muffin. Jujubes chocolate caramels cheesecake brownie lollipop dragée cheesecake.</p>
<p><strong>Train: </strong>Pie apple pie pudding I love wafer toffee liquorice sesame snaps lemon drops. Lollipop gummi bears dessert muffin I love fruitcake toffee pie.</p>
<p><strong>Car: </strong>Jelly cotton candy bonbon jelly-o jelly-o I love. I love sugar plum chocolate cake pie I love pastry liquorice.</p>
</div><!--/.tertiary-->
</div>
<footer class="main-footer clearfix center">
<span>©2015 Residents of The Best City Ever.</span>
</footer>
</body>
</html>
* {
box-sizing: border-box;
}
body {
color: #414040;
font-family: 'Varela Round', sans-serif;
line-height: 1.6;
font-size: 16px;
}
img {
max-width: 100%;
}
p {
line-height: 1.5;
font-size: 0.95em;
margin-bottom: 1.8em;
}
a:link,
a:visited {
text-decoration: none;
color: #3acec2;
}
.main-header {
padding: 0.5em 0;
}
.name {
margin: 0;
}
.name a {
color: #0b024a;
font-size: 0.6em;
}
.name a,
.main-nav a{
display: block;
text-align: center;
padding: 10px 15px;
}
.main-nav {
text-transform: uppercase;
}
.banner {
color: #fff;
background: #3acec2;
padding: 3em 0;
}
.logo {
width: 190px;
}
.headline {
margin-bottom: 0;
}
.tagline {
margin-top: 0;
}
.main-footer {
background: #bddfea;
padding: 2em;
}
.col {
padding-left: 1em;
padding-right: 1em;
}
.container {
width: 90%;
max-width: 1150px;
margin: 0 auto;
}
.wrap {
width: 80%;
max-width: 1150px;
margin: 0 auto;
}
.center {
text-align: center;
}
@media (min-width: 769px) {
.container {
width: 90%;
margin: 0 auto;
}
.name,
.col {
float: left;
}
.primary,
.secondary {
width: 50%;
}
.main-nav {
float: right;
}
.main-nav li {
display: inline-block;
margin-left: 15px;
}
.tagline {
font-size: 1.4em;
}
/* ---- Float clearfix ---- */
.clearfix::after {
content: " ";
display: table;
clear: both;
}
}
@media (min-width: 1025px) {
body {
padding-top: 60px;
}
.main-header {
position: fixed;
background: #fff;
box-shadow: 0 1px 4px rgba(0,0,0,.4);
width: 100%;
top: 0;
z-index: 1000;
}
.container {
width: 80%;
max-width: 1150px;
}
.primary {
width: 40%;
}
.secondary,
.tertiary {
width: 30%;
}
}
3 Answers
Rich Donnellan
Treehouse Moderator 27,708 PointsHow are the columns not behaving as expected? The primary, secondary/tertiary are set at those widths once the viewport reaches the minimum 1025px. It's doing exactly what it's set to do.
Open your browser's dev tools and watch the styles take effect when you resize the viewport.
Saud Tauqeer
Courses Plus Student 8,099 Pointsmy media queries wont work i tried everything. http://w.trhou.se/g7seer9ajl heres a snapshot please help me out too i am stuck for four days now
tomd
16,701 PointsI had to delete " *{box-sizing: border-box;}" and re-type it then it worked. It wasn't working for some reaason haha, thanks anyway.
Alex Busu
Courses Plus Student 11,819 PointsAlternatively set the width of the columns to 33% and make them inline-block You don't need to use floats then.
Rich Donnellan
Treehouse Moderator 27,708 PointsRich Donnellan
Treehouse Moderator 27,708 PointsQuestion updated with code formatting. Check out the Markdown Cheatsheet for syntax examples.