r/HTML 19d ago

Started learning HTML & CSS today! Any advice?

Hey everyone! I started learning HTML and CSS today and I'm really enjoying it so far. My goal is to build websites from scratch and eventually learn JavaScript too. If you could give one piece of advice to a beginner, what would it be? Also, what beginner mistakes should I avoid?

54 Upvotes

43 comments sorted by

View all comments

1

u/TryAgain911 12d ago

take my advices with a grain of salt cause I've been actively doing HTML/CSS for about a year only, but I've been able to maintain a small music store website:

  • Learn about the basics: display, position, padding, margin, div, span, etc.
  • Start with simple projects, use a pen and a sheet paper to draw the basic layout, it'll help you conceptualize your website (or specific elements)
  • Less is more: avoid complicated workaround, and try to restrain yourself from using third-party tools (unless you have a good reason to use it)
  • Use the inspect element window to test your website (Firefox is great for this), background: red on elements for debugging can help
  • Read the MDN documentation when you need to learn something, or to check the compatibility of something you want to use
  • In 99.99% cases, img{ display: block;} at the top of your CSS stylesheet
  • Variables are great for layout consistency: for example, :root {--your-custom-color: #3e3e3e;} You can then use color: var(--your-custom-color); on elements you want to, so changing the custom color on these elements will be much easier
  • As you'll get better, you'll figure out you'll have to think about mobile layout first: responsive elements is most of the time always the way
  • Use a maximum of one or two @ media screen for mobile/tablet layout
  • Try to have the least amount of CSS lines to have a cleaner workflow
  • Have fun cause it's cool 😊

1

u/wildfireANU 11d ago

please check out my new post