My Journey Learning Code — Day 2
Keep your code clean…
Today I enjoyed seeing ways to organize my HTML & CSS and how the parent-child relationship works. I liked that it helps reduce in repeating code, such as margins, text formatting, and more.
When discussing pseudo-selectors I found two that I believe I would use the most often. Those are ‘“:hover”, and “:active”.
With “:hover” you can change the CSS of an element when the user’s mouse hovers over it.
With “:active” it selects the active link. specifically I would use this on a navigation bar to change the styling of the link to show you the active page you are on. For example: Assume the user is on the “About Me” page. You can change the CSS for the link “About Me” on the navigation bar to distinguish it from the rest of the links on the navigation bar. This allows the user to know which page they currently are viewing.
An important factor of “clean code” can help prevent some of the “gotchas” of CSS code. You could prevent either repeating yourself or accidentally overriding necessary CSS for parent or child elements. You may need to double check of there is a simpler way to achieve your styling that would not interfere with each other.
Thank you for reading and as always, happy coding!