CSS CSS Layout CSS Layout Techniques Float

Thea Partin
Thea Partin
5,879 Points

How does this not work? .small-img{ float: right; }

style.css
/* Complete the challenge by writing CSS below */
.small-img{
  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">
      <p><img src="developer-diane.jpg" alt="Developer Diane coding on her laptop." class="small-img"style="width:250px;height:170px;margin-left:15px;"></p> 
      <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>
John Maxwell
John Maxwell
9,249 Points

It is asking you to target the img element with the float property. It wants the texts to wrap on the right side, so you need to utilize float: left. See below for CSS example. Hope this helps!

img {
float: left;
}

1 Answer

Thea Partin
Thea Partin
5,879 Points

I figured it out it is to be float: left