Change the Font Size of an Element,

Change the Font Size of an Element,
0

#1

Tell us what’s happening:
“Between the style tags, give the p elements font-size of 16px. Browser and Text zoom should be at 100%.”
How would i make this target p elements?

Your code so far


<style>
  .red-text {
    color: red;
  }
</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>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-css/change-the-font-size-of-an-element


#2

Hi there. I think this is what you’re looking to do in the CSS.

Also, your h2 tag has the same class-name as the paragraph. So, you should assign different class names in order to target the p element.

p { font-size: 16px; color: red; }


#3

could you explain more? sorry, this css is mixing up everything ive learned.


#4

Sure. So, let’s say you want both the h2 and the p elements to be red, you can simply assign the same class name to both which would be .red-text. This will make both elements red if in the CSS you write something like .red-text { color: red;}. However, if you want to change the text size of just that one particular p element, you need to add an additional class name or id.

So, your HTML would look something like this: <p class="red-text bigger">I am a paragraph</p>, and then your CSS for the bigger class name would be this: .bigger {font-size: 16px;}.

This way your font size of the paragraph is 16px and the color is red.


#5

okay thanks a lot man


#6

Sure thing. Hope that helps you out.