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

HTML

Devin Monajem
Devin Monajem
3,590 Points

Question on Responsive, Adaptive, Fluid, Fixed

I'm making my way through the islands and I've gotten to the Responsive, Adaptive, Fluid, Fixed portion of the Intermediate island. In theory, everything makes sense. In practice... my html doesn't seem to be doing what I want it to do and I don't know why. For some reason my grid percentages aren't connecting to my HTML in such a way that makes the grid responsive to my browser's movements. I've tried getting rid of grids to see if there's actually something wrong with my <link rel> line, but that doesn't seem to be it. The grids work as grids, they just don't respond when I move my browser.

Anyone else have this problem? Any suggestions for other troubleshooting that I might try?

PS. my pictures also don't perfectly align the way they do in the video.

Devin Monajem
Devin Monajem
3,590 Points

Ah ha! I've figured out the alignment problem. But not the responsive one.

8 Answers

Kevin Korte
Kevin Korte
28,148 Points

Depending on your browser, you'll want to look at the CSS. Firefox has a nifty little extension you can download called FireBug, and Chrome will allow you to view the code in Tools >> Developer tools. CSS cascades, and will override other CSS rules based on specificity, which you'll learn more about later, but at the beginning can cause some confusion.

Is your grid converted to percentages entirely, or did you also leave in the fixed width amounts?

Seeing your code would help a lot here.

You can put your HTML and CSS in the forum following one of these options https://teamtreehouse.com/forum/how-to-type-code-in-the-forum

Devin Monajem
Devin Monajem
3,590 Points

Thanks for the prompt response. I've actually been working in Firefox for the most part, but think I'm going to have to switch back over to chrome shortly in order to make use of the screen size add-on there. Thanks for that link on how to insert code into comments. So. Here it goes.

 /*
 Width: 1000px
 # Columns : 12 
 Column width: 65px
 Gutter : 20px 
*/
/*The formula used to achieve the percentages was:
            target/context = result

 In this case, in order to achieve the percentages, we then had to multiply by 100.*/

.grid_1 { width: 6.5%; } /*65px*/
.grid_2 { width: 15.0%; } /*150px*/
.grid_3 { width: 23.5%; } /*235px*/
.grid_4 { width: 32.0%; } /*320px*/
.grid_5 { width: 40.5%; } /*405px*/
.grid_6 { width: 49.0%; } /*490px*/
.grid_7 { width: 57.5%; } /*575px*/
.grid_8 { width: 66.0%; } /*660px*/
.grid_9 { width: 74.5%; } /*745px*/
.grid_10 { width: 83.0%; } /*830px*/
.grid_11 { width: 91.5%; } /*915px*/
.grid_12 { width: 100%; }

.grid_1,
.grid_2,
.grid_3,
.grid_4,
.grid_5,
.grid_6,
.grid_7,
.grid_8,
.grid_9,
.grid_10,
.grid_11,
.grid_12 {
    margin: 0 2% 1% 0;
    float: left;
    display: block;
}

.alpha{margin-left:0px;}
.omega{margin-right:0px;}

.container{
    width: 90%;
    max-width: 1000px; 
    margin: auto;
}



.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}.clearfix:after{clear:both;content:' ';display:block;font-size:0;line-height:0;visibility:hidden;width:0;height:0}* html .clearfix,*:first-child+html .clearfix{zoom:1}

As you can see, all of the code in my grid.css (except for .container and .alpha and .omega) has been converted to percentages. With the exception of a couple of fonts in my style.css sheet, though, all the sizes remain in px. I don't know if it's my style.css that's causing the problem, but I don't think so.

Kevin Korte
Kevin Korte
28,148 Points

Have you tried re sizing your browser? It's been so long since I've done that code challenge. Nothing is jumping out at me as being wrong.

What does your HTML look like?

Also, personally, I like to develop in Firefox more than I do Chrome. Chome is great for the for the console, but in Firefox, go to the tools dropdown >> web developer >> Responsive Design view

Using that option is far superior for designing responsibly than anything I have seen Chrome do.

I also prefer Firebug over Chrome's native code and css view as well. I may be missing extensions that would allow Chrome to do the same, as easily.

Devin Monajem
Devin Monajem
3,590 Points

That Responsive Design View is nifty. Thanks for turning me on to that. As I'm pretty new to this, I haven't really looked at the Web Developed section in Firefox yet. Maybe if I play around with the web developer tools a bit more, I'll see something.

My HTML is:

<!DOCTYPE.HTML>
<html>
  <head>
    <meta-http equiv="Content-Type" content="text/html charset=utf-8"/>
    <title>Smells Like Bakin' Cupcake Company</title>
    <link rel="stylesheet" href="Sublimecss/normalize.css" type="text/css" media="screen">
    <link rel="stylesheet" href="Sublime/css/grid.css" type="text/css" media="screen">
    <link href='http://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="Sublime/css/style.css" type="text/css" media="screen"> 
  </head>
  <body>
  <div class="container clearfix">
      <div class="grid_4">
           <img src="Sublime/img/logo.gif" alt="Smells Like Bakin' Logo">
      </div>
      <div class="grid_8 omega"> 
      <ul class="nav">
        <li><a href="#">About</a></li>
        <li><a href="#">Cupcakes &amp; Prices</a></li>
        <li><a href="#">Locations</a></li>
        <li class="last"><a href="#">Contact Us</a></li>
      </ul> 
      </div>

      <div id="intro" class="grid_9">
        <h1>
          Opposites really do attract...
          <p><a href="#" class="btn">Browse our Cupcakes</a></p>
        </h1>
      </div>
      <div class="grid_3">
        <img src="Sublime/img/you-bake-me-blush.gif" alt="You Bake Me Blush">
      </div>

      <div id="featured-cupcake" class="grid_7">
        <h2>Cupcake of the Week</h2>
        <p>This week's featured cupcake is the <a href="">Avocado Chocolate Cupcake</a>... </p>
        <img src="Sublime/img/featured-cupcake.jpg" alt="Avocado Chocolate Cupcake">
        </div>

      <div id="new-cupcakes" class="grid_5 omega">
        <h2>Fresh Out the Oven</h2>
        <p>Our newest cupcakes are <a href="#">Bacon me Crazy</a> and <a href="#">Jalapeno So Spicy</a> </p>
        <img src="Sublime/img/new-cupcake-bacon.jpg" alt="Bacon Me Crazy">
        <img src="Sublime/img/new-cupcake-jalapeno.jpg" alt="Jalapeno So Spicy">
      </div>

      <div class="grid_7">
      <h2>Inside the Kitchen</h2>
      <p>Smells Like Bakin' started out in the garage of the husband wife duo Allison &amp; Joseph...</p>
      <p><a href="#" class="btn-small">Read More</a></p>
      </div>

      <div class="grid_3">
      <h2>Get Bakin' with Us</h2>   
      </div>

      <div id="contact">
        <p>Call us: <span>1-555-CUP-CAKE</span><br>
        Email us: <a href="#">Bakeon@smellslikebakin.com</a></p>
      </div>

      <p>We announce all of our new flavors first through Facebook &amp; Twitter, and even take requests!</p>
      <a href="http://www.facebook.com"><img src="Sublime/img/facebook.gif" alt="Facebook Logo"></a>
      <a href="http://twitter.com"><img src="Sublime/img/twitter.gif" alt="Twitter Logo"></a>

      <div id="copyright">
        <p>&copy; 2012 Smells Like Bakin' Cupcake Company. All Rights Reserved</p>
      </div>

    </div>

  </body>
</html>
Kevin Korte
Kevin Korte
28,148 Points

The divs are responding for me when I resize the viewport. When you resize, is your content running off of the screen?

No worries about having not looked at the developer tools much. Your workflow, and the tools you use will grow as your knowledge does. We all started new.

Take a look at this http://codepen.io/kevink/pen/xtAmp

Missing the pics for the site but it looks like it is acting responsive to me.

http://codepen.io/Bluediv/pen/uozgI

Kevin Korte you see something I am missing?

Kevin Korte
Kevin Korte
28,148 Points

It appears responsive to me too. That is what that block of code should be doing. We'll have to wait and see what Devin thinks.

Devin Monajem
Devin Monajem
3,590 Points

Hi everyone,

thanks for taking the time to look at my code. I appreciate it. Whenever I resize my screen, everything just stays frozen on the page as if it were fixed. But y'all have given me an idea: if it's not working on my computer, maybe I should try to test the website on a different computer.

I'll let you know how it goes.

Cheers!

Devin Monajem
Devin Monajem
3,590 Points

Hello again -

I've tried my code on a different computer and that one seems to be working. I'm having a bit of a design problem, but I think that as I go further along, I'll be able to figure that one out. It seems that the problem with having a fluid foundation is with my computer, which is troubling. It means that as I go through the next few lessons, I won't really be able to test what I'm coding on my own computer and will have to use another to see if I'm getting it right, which is kind of lame. I think I'm going to go on some forums and see if anyone else is having this kind of trouble with their computer.

Thanks for all the help!

Kevin Korte
Kevin Korte
28,148 Points

What browser and version are you using on the one that is not working. That info should be in the ABOUT section of the menu.

On the browser that isn't showing your responsive changes, what happens when you scale this site down? Does it scale down, because this site is responsive.

Devin Monajem
Devin Monajem
3,590 Points

I'm using Firefox 24.0.

And yes. This site scales for me using this browser.

Kevin Korte
Kevin Korte
28,148 Points

Weird! I'm using Firefox 24 too! I don't understand.

Devin Monajem
Devin Monajem
3,590 Points

Ya. I don't know what gives.

Maybe I just scrap it and start again. It'll be pretty fast because I already have all the code written in a different computer. Then I can just download the course files and see if it works. Clearly not the most efficient way of doing it, but one of the blessings of being a beginner is there isn't thousands of line of code or anything.

I'll let you know how it goes.

Devin Monajem
Devin Monajem
3,590 Points

I dunno what to say.

I deleted everything except for the actual text editor, "Sublime 3". Then I downloaded the files from the site. Then I converted everything in grid.css to percentages. And now everything works like a dream. I've found a few discrepancies between what I wrote and what I downloaded, but not a crazy amount. Not only that, but then I tried using my old code from before and all of a sudden it's become responsive and/or fluid. At first I thought that it was the small errors in what I'd written, but it doesn't seem that way.

When I started my old html file, I wrote, on top:

<!DOCTYPE.HTML>

The downloaded version doesn't have the . between DOCTYPE and HTML, but short of that, we might have to chalk it up to the machine gods messing with me.

Everything seems fine now though.

ooh yeah I can't remember the specifics but that . in your doctype declaration messing up the interpreter, I know in IE it puts it in quirk mode which would negate a lot of the css, Firefox and Chrome do the same type of thing. I will try to look it up when I get home.

Kevin Korte I bet this is why it was rendering ok in Codepen :)