search

Home  >  Q&A  >  body text

css - Problems using class selectors

1. I just started to learn HTML and CSS by myself. I wanted to define two fonts in one block. I used the class selector, but after defining it, I didn’t see any change in the font on the page (it was still the default size and color). ), is it the selector or the code that is wrong? இ௰இ

2This is the html code

<p id="container">

       <p id="header">
          <p id="Love Live Sunshine">
              <p>
                                <h1>Love Live Sunshine</h1>
                                <hr width="960&">
                                <p>这是一个标题!!!</p>
              </p>
           </p> 
        </p>

This is the CSS

Please forgive me

给我你的怀抱给我你的怀抱2806 days ago1048

reply all(5)I'll reply

  • PHP中文网

    PHP中文网2017-05-24 11:38:28

    Use ID less, and don’t use it so long because ID is unique, so long is meaningless. Then don’t add dots in front of h1 and p, dots are for class selection

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-24 11:38:28

    Please use - instead of spaces
    There is also this called ID selector and class selector is class

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-24 11:38:28

    Do not include spaces in the id

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-24 11:38:28

    Just change . to a space = =
    . The beginning is the class selector. You need to write CSS for the label here. There is no need for any prefix in front of the label

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-24 11:38:28

    In addition to clear grammar specifications and selector properties, remember to introduce style files

    reply
    0
  • Cancelreply