FreeCodeCamp心得

时间:2023-03-08 16:03:30
  1. <img>    <input>  tags are self-closing. So that there is only one tag without a slash in front of the closing angle bracket.
  2. For <input>
    1. For <input> with type "text",you can use palceholder to fill some default values at first and use required to make sure the input must be filled before submitting.
    2. For <input> with type "radio" and "checkbox", you can use "checked" to make it the default value.
    3. For <input> with type "radio" and "checkbox", you must specify the same name for all of them. And a kindly reminder is the radio and checkbox can be nested inside of <label>
  3. All of the other elements will inherit syles from body element.
  4. The order of classes declaration in <style> section is what is important. The second one will always take precedence over the first one.
  5. id declaration can take precedence over class declaration. It doesn't matter where the id declaration is in <style> section.
  6. In line style has the higher priority than id declaration.
  7. The attribute !important has the highest priority in CSS.
 <style>
   body {
     background-color: black;
     font-family: Monospace;
     color: green;
   }
   #orange-text {
     color: orange;
   }
   .pink-text {
     color: pink !important;
   }
   .blue-text {
     color: blue;
   }
 </style>
 <h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1>

8  There are three ways to represent color in CSS.

      (1)#000000

      (2)#f00  the abbreviation of the first one. This way will reduce the number of colors that it can represent.

      (3)rgb(255,0,0)

9