I am in Responsive Web Design Size Your Images. I don't know what I am doing wrong, I need help. Thank you

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
img class="smaller-image" {width:100px;}
</style>
<style>
.red-text {
  color: red;
}

h2 {
  font-family: Lobster, monospace;
}

p {
  font-size: 16px;
  font-family: monospace;
}
</style>
<style>
.smaller-image {width: 100px;}
img class="smaller-image"
</style>
<h2 class="red-text">CatPhotoApp</h2>
<main>
<p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>

<div>
  <p>Things cats love:</p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
</div>

<form action="https://freecatphotoapp.com/submit-cat-photo">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label><br>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
</main>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36

Challenge: Size Your Images

Link to the challenge:

You need to assign the class within the img tag, not in the stylesheet. .smaller-img already names that class in your style tags. To make the class of the image itself “smaller-img,” you need to add class="smaller-image" within the image tag itself.

Assigning classes like this allows for more control over your code; If you just want to make all images share a CSS attribute, you would just use img in the <style> tags, as has been done for h2 and p in the example code.

I hope this helps, good luck!

Thank you MoeMoeKyun for responding to me. I have tried many different ways to add the img element with the class=“smaller-image” When I run the test this is what it says, Your

```element should have the class
```smaller-image
```. Your image should be 100 pixels wide. this is what the code looks like now.
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>

  .red-text {

    color: red;

  }

  h2 {

    font-family: Lobster, monospace;

  }

  p {

    font-size: 16px;

    font-family: monospace;

  }

  .smaller-image {

    width: 100px;

  }

  <img class="smaller-image"https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg/>

</style>

<h2 class="red-text">CatPhotoApp</h2>

<main>

  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>

  <a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>

  <div>

    <p>Things cats love:</p>

    <ul>

      <li>cat nip</li>

      <li>laser pointers</li>

      <li>lasagna</li>

    </ul>

    <p>Top 3 things cats hate:</p>

    <ol>

      <li>flea treatment</li>

      <li>thunder</li>

      <li>other cats</li>

    </ol>

  </div>

  <form action="https://freecatphotoapp.com/submit-cat-photo">

    <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>

    <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>

    <label><input type="checkbox" name="personality" checked> Loving</label>

    <label><input type="checkbox" name="personality"> Lazy</label>

    <label><input type="checkbox" name="personality"> Energetic</label><br>

    <input type="text" placeholder="cat photo URL" required>

    <button type="submit">Submit</button>

  </form>

</main>

In the <style> tags, you only need .smaller-image { width: 100px; } That code creates the class .smaller-image and assigns the style to that class which is width: 100px. You then need to tell the computer to apply the class .smaller-image to the particular image later in your code’s main body, which applies the style rules to that image. You’re done with the stylesheet; Now you have to go down to the code that displays the image itself. That’s where you apply class="smaller-image", to tell the computer to apply the style rules of .smaller-image to that particular image. The code within your style tags that says <img class="smaller-image"https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg/> isn’t doing anything, and can freely be deleted.

A hint: The <a> tags in your <main> section contain your <img> element. Apply the class to the img there. Observe the <p> tag directly above the <a> tag for an example, line 19 in the default challenge.

I hope this helps and gives a better understanding of how classes work in HTML! Good luck!

Thank you MoeMoeKyum
This problem has been solved , I was adding an extra img when there was one already.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.