[Stuck] - Basic CSS - Size Your Images

I am being instructed to - [Create a class called smaller-image and use it to resize the image so that it’s only 100 pixels wide.]
Im stuck… :confused: any help to get me moving alone would be appreciated.
thanks

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

  h2 {
    font-family: Lobster, monospace;
  }

  p {
    font-size: 16px;
    font-family: monospace;
  }
</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://bit.ly/fcc-relaxing-cat" 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="/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>

You’ve built it!
You’re just missing the final part of the challenge, assign it to the image.
Here a class .red-text is assigned to the h2 element:
<h2 class="red-text ">

You should assign the class you created ( .smaller-image ) to the img tag in the html part - this one:
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">

Thats where im confused, I did this and also did not work.
sorry if im a little slow, im just confused. :confused:

  <img class=".smaller-image"></img> {
    width: 100px;
  }

in html there is no dot in front of the class definition.

the dot you only need in css

img class=‘smaller-image’

  <img class="smaller-image"></img> {
    width: 100px;
  }

Still doesnt want to work. hmmm :confused:

It looks like the problem here is that you are mixing HTML and CSS.

The CSS (in the style tags at the top of the page) should be:

.smaller-image {
   width: 100px;
}

Which is exactly what you had. You then just need to add the class to the image tag you have so it would look like:

<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back." class="smaller-image">

Don’t include the img tag in the style section and don’t include the {} bits within the HTML/img tags.

Hope this explains it

2 Likes

thanks so much for the explanation :slight_smile: