Choosing ideal IDs and Class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Choosing ideal IDs and Class

I struggle with what name to choose for an ID or Class. For example, as I’m writing out my HTML I’m also trying to figure out what to name a class so that I can target it in CSS. When using flexbox and grid containers I feel like I’m all over the place with multiple classes and IDs. Any guidelines or best practices with structuring html code. Should I assign classes and IDs as I go? Or as I’m about start styling with CSS?

21st Apr 2024, 2:01 AM
Mikel0nd0n
Mikel0nd0n - avatar
3 Answers
+ 4
On top of those great resources from Bob_Li you should also check out Tailwind. It is a library that brings a lot of predefined styles that you can mix and match as required. That way you don't need to come up with those names yourself, just use what is already available. https://tailwindcss.com/
21st Apr 2024, 3:50 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Thank you
21st Apr 2024, 2:54 AM
Mikel0nd0n
Mikel0nd0n - avatar