Change the Font Size of an Element hep me

Tell us what’s happening:

Your code so far


<style>
  
  .red-text {
   <p  f
    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 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/7.0.185.1002 Safari/537.36.

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

You just need declare font-size:yoursize_px in element you wish to change the font size

if you wanna use selector
try this syntax
element_name{font-size:size_px;}
for eg: you wanna change the size of h2 element via using selector
here is an example for you

h2 { font-size: 16px; }

now this will change the size of your h2 element into 16px

What happens in the CSS part (or usually it is a file), is that classes, tags or other things are specified having a certain make-up

so in this case:
de class red-text (.red-text) has the color red.

Now they ask you to make a similar entry, but then for a p tag.

the entry for a class is .CLASSNAME (so .red-text in this case), but for a tag it suffices to just put the name of the tag: p in this case.

so doing the same thing:
.red-text {
color: red;
}
p {
and then the thing you have to put inside, the font-size with the 16px.
}
so you leave the red-text as it is, because not alle elements with the class of red-text need to be changed in font-size, only the p elements.

So a CSS document is basically a long list of selectors (elements, classes, attributes) and their style inside curly brackets for each element you want to give a special make-up. =) I hope to have helped you. I don’t want to give the whole answer, that is not helping to learn.

3 Likes