How to Size Your Images in css lessons

How to Size Your Images in css lessons
0.0 0

#1

Im on the css lesson size your image and Im stuck. I can resize the image using width but I don’t know haw to us class to resize the image . I keep getting error message that says img should have a class names smaller-image.Ive tried several different combinations with no luck . can someone point me in the right direction. the example shows how to use it in style.

Your code so far


<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;
  }

</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 class= ".smaller-image{
    width:100px;}"  src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."width=100></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>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-css/size-your-images


#2

You need to create a class. You’ve done this before with red-text. That class should have the appropriate CSS attributes. You should apply the class to the appropriate element(s). You’ve done that before with red-text too.


#3

You can use the style declerations in the “style” tag. Like this

<style>
     .smaller-image{
         width:100px;
     }
</style>

And then you can youse the smaller-image class name for the img tag like this

<img class="smaller-image" src="......."

Like @ArielLeslie said you have done it before. You can do it


#4

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Thank you.


#5

I had that combination before but I put the width=100px in the element class as well as the style , your reply set me straight, had a little more in the code than I needed
Thanks for the help