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

Flexible Images Pt.1 Vector Graphics Code Challenge 1 of 2

Argh. I can't seem to figure this answer out. Someone help please! Here is the code:

<object data="img/love-at-first-bite.svg" type="img/svg+xml" alt="Love at first bite"></object>

In the stylesheet as well I have this:

img,object{
  max-width: 100%;

11 Answers

I found that this code challenge required a hefty bit of code using the object tag.

<object data="WHERE IS IT?" type="WHAT TYPE OF IMAGE IS THIS?">
  <a href="WHERE IS OUR IMAGE AGAIN?">
    <!--[AN IF STAEMENT TO CHECK FOR IE8 OR LESS]-->
      <img src="WHERE IS THE FALLBACK IMAGE?" alt="A GOOD PLACE FOR A DESCRIPTION">
    <!--[CLOSE THE IF STATEMENT]-->

Don't forget to close your <object> & <a> tags!

If you need more help with the syntax check out this tutorial on using SVG with the <object> tag.

Oliver Hough - I really like the way you broke down this code challenge. Although here on the forum we generally try to avoid spoilers in most cases. So I edited them out.

Remember the goal of the forum is to help users learn to solve their own issues without giving away the answer itself. I think your example gives users a good head start on figuring out this challenge for themselves without needing to all of the work for them.

Rock on with your forum'ing :smile:

Cheers James Barnett!

Thanks for the help with the tips. Saved me a bunch of frustration I think.

I was able to get this working by using the hints provided by Oliver, but this particular code challenge should be rewritten or the video should be edited. This is the first challenge where I would have NEVER been able to write out the code based on the information provided in the clues and/or the video.

I've tried this like 50 times! Here is what I have.. what do I have wrong?!?

<object data="   " type="   ">
  <a href="   ">
    <!--[AN IF STAEMENT TO CHECK FOR IE8 OR LESS]-->
      <img src="    " alt="    ">
    <!--[CLOSE THE IF STATEMENT]-->
  </a>
</object>

This is so frustrating.. I've re-watched this lesson several times, and have copied exactly what the instructor showed on her screen and still nothing... I agree that this lesson was not well done.

Can you post a link to the code challenge you are having issues with.

I'm having problems with this challenge too. They didn't really explain how to use the code properly, they just pasted a code (which didn't even work for the challenge).... Here's a link to the code challenge: http://teamtreehouse.com/library/websites/build-a-responsive-website/responsive-design/flexible-images-part-one-vector-graphics-2

Agreed.

I'm having a problem with this as well. I tried your approach oliver, and It will not work. I don't know if the code is wrong or if the challenge is messed up.

There was a small typo in my example code ( a missing " after object data="img/love-at-first-bite.svg )

The challenge works fine I just tried it.

I feel like the answer I've provided is correct. Although, it is not allowing me to pass through. Please help!

Thanks.

You might be having a hard time because you skipped over the CSS Foundations course. You should try following along with the Learn HTML & CSS learning adventure.

I thought I was going in order of the [Learning Adventures/Become a Web Designer] - I finished the first part then I thought i was being lead into the second part but going all the way back to the Become a Web Designer I see now that I missed two whole sections. Thanks.

From the badges on your profile it appears you went from Build a Basic Website skipped the over both HTML Foundation & CSS Foundations and went straight to Build a Responsive Website