Changing the Font Size of an Element CSS

Changing the Font Size of an Element CSS
0

#1

Tell us what’s happening:
I am attempting to change the size of font using CSS on an HTML script. I have formatted the style tag correctly (I think) so that “font-size: 16px;” but when I add font-size=16px to the HTML scrip the font size does not change.

What am I doing wrong?

Many thanks in advance!

Your code so far


<style>
  .red-text {
    color: red;
  }
  font-size: 16px;
   }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p font-size=16px 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/70.0.3538.16 Safari/537.36.

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


#2

You missed the p tag in the CSS


#3

Thanks for your help! I am still having trouble however.

When I apply the p tag into CSS style guide it still does not reflect the font size into the HTML letters, even after I have added font-size=16px to the HTML script.

Is there something wrong with my p tag in CSS


#5
<p font-size: 16px;

#6

Just to be clear, you are missing the p selector (it’s not a tag). You are also missing the opening bracket on the style rule.

selector {
  property: value;
}

#7

got it!! Thanks so much

.p {
    font-size: 16px;>
   }
``

#8

p is an element selector, not a class selector.

Element selector

p {

}

Class selector

.p {

}

#9

Thanks for the help!