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 trialPeaches Stubbs
21,320 PointsI have to add a unique to a h1 header and adjust the typography.
http://teamtreehouse.com/library/viewport-sized-typography-fittextjs This is the question:
Using the unique ID defined within the fittext script, add the appropriate code to the level one header to make it scale with the fluid layout.
This is the script $("#fittext1").fitText(); When I try to add #fittext1 as the id to my h1 header I'm told that ive added the wrong id. So I tried .fitText ( which i figured is a class but i tried it just incase) and that is wrong as well. I am a little stumped here as i do not see any other id's in the code. <!DOCTYPE html> <html> <head> <link href='style.css' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Nunito:400,300,700' rel='stylesheet' type='text/css'> </head> <body> <div class="container"> <div class="grid_6 omega"> <h1>Smells Like Bakin'</h1> </div>
<div class="grid_2">
<h2>Bacon Me Crazy</h2>
<img src="img/bacon-medium.jpg" alt="Bacon Me Crazy" class="cupcake">
</div>
<div class="grid_2">
<h2>Jalapeno So Spicy</h2>
<img src="img/lime-medium.jpg" alt="Jalapeno So Spicy" class="cupcake">
</div>
<div class="grid_2 omega">
<h2>Avocado Chocolate</h2>
<img src="img/avocado-medium.jpg" alt="Avocado Chocolate" class="cupcake">
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.fittext.js"></script>
<script>
$("#fittext1").fitText();
</script>
</body>
</html>
May someone please assist ! Thank you in advance.
5 Answers
Ryan Trimble
15,559 PointsRemember that periods used for classes and hash marks used for id are only for reference by CSS and JavaScript. You do not need to type these when you are in the HTML. So instead of
<h1 id="#fittext1">
you will just use:
<h1 id="fittext1">
Hope this helps!
Sandra Weber
1,531 PointsHello Peaches,
The "#" in the ID is just there to indicate that it's an ID. When adding it to the HTML, it just needs to look like
id='fittext1'
I hope this helps!
Peaches Stubbs
21,320 PointsThanks guys !
Omh MG
19,233 PointsIf you are adding it to the HTML code document, you want to make sure you you add it below the <div class="container"> tag in this format.
<h1 id="fittext1">
Jay Thompson
2,302 PointsI keep getting an "undefined" error for the example video on fittext..not even on the assignment: https://www.dropbox.com/s/li92lscytgffmoo/Screenshot%202014-04-20%2008.28.39.png
Here's the code: <!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="css/grid.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link href='http://fonts.googleapis.com/css?family=Nunito:400,300,700' rel='stylesheet' type='text/css'> <script src="external/matchmedia.js"></script> <script src="picturefill.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> </head>
<body>
<div class="container clearfix">
<div id="logo" class="grid_4">
<object data="img/logo.svg" type="image/svg+xml" class="chart">
<a href="img/logo.svg">
<!--[if lte IE 8 ]-->
<img src="img/logo.gif" alt="Smells Like Bakin'">
<!--[endif]-->
</a>
</object>
</div>
<div id="nav" class="grid_8 omega">
<ul>
<li class="about"><a href="#">About</a></li>
<li class="pricing"><a href="#">Cupcakes & Prices</a></li>
<li class="locations"><a href="#">Locations</a></li>
<li class="contact"><a href="#">Contact Us</a></li>
</ul>
</div>
<div id="intro" class="grid_9">
<h1 id='fittext1'>Opposites really do attract, especially in our kitchen! We combine unexpected flavors that melt together to create ironically delicious desserts. </h1>
<p><a href="#" class="btn">Browse Our Cupcakes</a></p>
</div>
<div id ="intro-img" class="grid_3">
<object data="img/you-bake-me-blush.svg" type="image/svg+xml" class="chart">
<a href="img/you-bake-me-blush.svg">
<!--[if lte IE 8 ]-->
<img src="img/you-bake-me-blush.gif" alt="You Bake Me Blush">
<!--[endif]-->
</a>
</object>
</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>. It’s flavors will kick your taste buds into fiesta mode!</p>
<span data-picture data-alt="Avocado Chocolate Cupcake">
<span data-src="external/imgs/avocado-small.jpg"></span>
<span data-src="external/imgs/avocado-medium.jpg" data-media="(min-width: 400px)"></span>
<span data-src="external/imgs/avocado-large.jpg" data-media="(min-width: 800px)"></span>
<span data-src="external/imgs/avocado-extralarge.jpg" data-media="(min-width: 1000px)"></span>
<!-- <div data-src="extralarge_x2.jpg" data-media="(min-width: 1000px) and (min-device-pixel-ratio: 2.0)"></div> -->
<!-- Fallback content for non-JS browsers. Same img src as the initial, unqualified source element. -->
<noscript>
<img src="external/imgs/avocado-small.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia">
</noscript>
</span>
</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="#">Jalapeño So Spicy</a>. </p>
<img src="img/new-cupcake-bacon.jpg" alt="Bacon Me Crazy">
<img src="img/new-cupcake-jalapeno.jpg" alt="Spicy Lime">
</div>
<div id="about" class="grid_7">
<h2>Inside the Kitchen</h2>
<p>Smells Like Bakin’ started out in the garage of the husband wife duo Allison & Joseph. Allison is the baker, and Joseph found a way for them to make a business out of her tasty treats. Flash forward to today and they have a successful store front, catering business and cupcake truck. </p>
<p><a href="#" class="btn-small">Read More</a></p>
</div>
<div class="grid_5 omega">
<h2>Get Bakin’ with Us</h2>
<div id="contact">
<p>Call us: <span>1-800-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 & Twitter, and even take requests!</p>
<object data="img/facebook.svg" type="image/svg+xml" class="chart">
<a href="img/facebook.svg">
<!--[if lte IE 8 ]-->
<a href="http://www.facebook.com/SmellsLikeBakin"><img src="img/facebook.gif" alt="Facebook"></a>
<!--[endif]-->
</a>
</object>
<object data="img/twitter.svg" type="image/svg+xml" class="chart">
<a href="img/twitter.svg">
<!--[if lte IE 8 ]-->
<a href="https://twitter.com/#!/smellslikebakin"><img src="img/twitter.gif" alt="Twitter"></a>
<!--[endif]-->
</a>
</object>
</div>
<div id="copyright" class="grid_12">
<p>© 2012 Smells Like Bakin' Cupcake Company. All Rights Reserved.</p>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script scr="jquery.fittext.js"></script>
<script type="text/javascript">
$("#fittext1").fitText(2.2);
</script>
</body> </html>