CSS CSS Layout CSS Layout Techniques Float

Kelinia Johnson
Kelinia Johnson
6,032 Points

how to I use float or the image?

style.css
/* Complete the challenge by writing CSS below */
.img-thumbnail {
  float: right; 
}  
index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Developer Diane's blog</title>
  <link rel="stylesheet" href="page.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header>
    Developer Diane’s Blog
  </header>
  <article>
    <section class="intro">
      <img src="developer-diane.jpg" alt="Developer Diane coding on her laptop." class="img-thumbnail">
      <h1>The verdict is in. CSS Layout is great!</h1>
      <p class="clear">I’ve been working with CSS for a while now, and I have to say, it’s pretty awesome. I love being able to separate content from presentation, and to keep all my styles in an external stylesheet.</p>
      <p>I’ve had a pretty good grasp on the basics for a while now, but I needed to learn more about how to control layout with my CSS. Understanding CSS layout meant first exploring the parts of the CSS box model.</p>
    </section>
    <footer>©2020 Developer Diane.</footer>
</body>
</html>

2 Answers

John Maxwell
John Maxwell
9,249 Points

Hey, so for text to wrap on the right side, you need to float: left

And the challenge is asking you to target the img element. I would look like this:

img {
     float: left;
}
Jason Anders
Jason Anders
Treehouse Moderator 145,153 Points

Hi John Maxwell

Thank you for participating in the Community. I have move your response (and a few others) from the Comments section of the thread to the Answers section. Please, in the future, reply using "Add An Answer" as this signifies to the rest of the community that a question has been addressed.
The Add Comment should only be used for responses that don't provide assistance toward an answer to the Original Post's question -- For example, if you need and request additional information from the Poster of the thread, or like this comment that doesn't reference the question at all.
Also, as an Answer, you can be upvoted and marked as Best Answer.

Thanks :)

Jason ~Treehouse Community Moderator :dizzy:

John Maxwell
John Maxwell
9,249 Points

Jason,

I had honestly never noticed the difference. Thanks for letting me know!