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 trial

CSS

Content Defined break points

Been trying for a couple of hours to get through this task and I cant.... here are the instructions...... Write a media query at 705px where the layout begins to break, that forces grid_1 through grid_6 to span 100% width of the container.

Where exactly do I place the media query in the .css? If anyone can help me I'd really appreciate it..

body { font-family: 'Nunito', sans-serif; font-weight: 100; font-size: 1.25em; color: #faf3bc; background-color: #420600; }

.grid_1 { width: 15.625%; } /* 125px/800px = 15.625% / .grid_2 { width: 32.5%; } / 260px/800px = 32.5% / .grid_3 { width: 49.375%; } / 395px/800px = 49.375% / .grid_4 { width: 65.625%; } / 525px/800px = 65.625% / .grid_5 { width: 83.125%; } / 665px/800px = 83.125% / .grid_6 { width: 100%; } / 800px/800px = 100% */

.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6 { margin-right: 1.25%; float: left; display: block; } .alpha { margin-left:0; } .omega {margin-right:0; }

.container{ width: 90%; max-width: 800px; padding: 4% 0; margin: auto; } img { max-width: 100%; } h1 { font-size: 1.750em; line-height: 1.25em; font-weight: 100; letter-spacing: -2.75px; }

h2 { font-weight: 100; font-size: 1.15em; color: #b4c34f; } .cupcake { box-sizing: border-box; background-color: #faf3bc; padding: 8px; margin: 0 0 5% }

2 Answers

Keith Doyle
Keith Doyle
25,973 Points

According to the videos, breakpoints should go at the bottom. So your code would look something like this:

@media screen and (max-width: 705px) { grid_1, grid_2, grid_3, grid_4, grid_5, grid_6 { width: 100% } }

thanks it worked, and the code inside of the {} is called by a .? like how would i call an img

Keith Doyle
Keith Doyle
25,973 Points

you're welcome. not sure what your question is though.

If i wanted to call the variable img within that same media query at 705px to make the img disappear.

I've figured it out keith thank you so much you were a big help!

Alex

Keith Doyle
Keith Doyle
25,973 Points

you'd add another rule telling the IMG element none to display

Keith Doyle
Keith Doyle
25,973 Points

You're welcome. Feel free to mark my answer as correct :)