Building an HTML Template for Infinite Lists

The template for each list item needs to be built first in order to test

We'll cover the following

HTML templating

Learning CSS styling is generally a quick path to being proficient enough to build most things. That’s even more true with structuring the template with HTML.

The way to write HTML is not careful planning – it’s brute force. If you dive straight into writing CSS with reckless abandon, you might find your codebase tangled with conflicting rules, accidentally additive rules (e.g., the border is thicker because you’ve added borders to inner and outer elements which add up), dislocated rules (it gets one rule from this file and another from another file in a different directory), and other pitfalls which fall under the category of “messy CSS.”

None of that applies to HTML, in my opinion. It can be too long, in which case you should divide it into separate files. There can be duplicates that increase the time it takes to make changes, but errors will be immediately visible if anything goes wrong. I think the main misses are accessibility and choosing groups. If you choose a sensible grouping for your components, you generally don’t have to worry about mistakes here. If you notice you can’t achieve something with styling as easily as you think you should, you can go back and change groupings. That’s why I recommend getting 80% styling done immediately after creating the template – it acts as a validation that the template is reasonable.

Our starting point

With that said, here’s a tweet:

Question:

How would you group this at the top level? level?

Option A:

Option B:

Option C:

Option D:

Get hands-on with 1200+ tech skills courses.