Top 5 Tips
You can use comments to explain your code, which can help you or another developer when editing it at a later date. They’re great for reminding you of what various blocks of code are doing and why, they can come in useful when debugging too. Comments are not displayed in the browser, so they’re only visible to someone who’s editing the source code.
<!-- This is a HTML comment -->
Close HTML Tags
There are a few tags that don’t require a closing tag (e.g. <br>, which inserts a single line break), but most do. To prevent display issues in your code be sure to close tags properly. The below example shows a paragraph with the appropriate opening and closing tags.
<p> I'm getting the hang of this now.</p>
This won’t affect your code in any way but I find it helps me to keep my code clean and easy to follow. By using indentation you can easily see where each HTML element starts and ends. Some developers like to do this with one or two spaces and others use tabs. Personally, I like to use tabs!
Use Sensible Naming Conventions
Sensible naming conventions will help you (and others) to better understand what’s what in your code. For example, if you have a class that wraps around a video it would make sense to name it something like ‘video-wrapper’. This will make things easier to follow in your CSS stylesheets too.
Always keep your code tidy, clean and well-formated.
Follow the Community
There are some fantastic websites, individuals, companies and organisations out there who are dedicated to making the Internet a better place, through sharing best practice, developing incredible websites and web apps, and talking-out ideas to make things better. The Web Development community is a humble and helpful one on the whole and I’m proud to be apart of it.
If you’ve been getting into coding you’ve likely accessed a few of these places already, such as StackOverflow, CSS-Tricks and the SitePoint forums. These sites are great to use but you can also find some amazing people/groups to follow on Social Media too. Here are a few of my favourite Twitter accounts:
A popular place to learn about HTML is the W3Schools website. You’ll find loads of examples that use various HTML elements, along with exercises and quizzes.