Which CSS elements can get styles
P粉250422045
2023-08-10 16:34:10
<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>
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.