Home  >  Q&A  >  body text

Which CSS elements can get styles

<p>I am starting to learn CSS. However, I keep running into the same problem. How do I determine which element gets the attribute and value? </p> <p>Most of the time I get it right, but sometimes I try different elements until I find the right one to style. Thanks! </p>
P粉250422045P粉250422045412 days ago475

reply all(1)I'll reply

  • P粉529581199

    P粉5295811992023-08-11 00:59:17

    It's not complicated, using a CSS selector like the class attribute is the best styling option in most cases, and then in your stylesheet file, use what you specified for the element class name and implement the desired style.
    This way, you always know which element gets the style.
    Also, learn about CSS class naming conventions, such as BEM.

    reply
    0
  • Cancelreply