top | item 38257185

(no title)

pixelrevision | 2 years ago

Thanks, I really didn’t get what they meant with the example they were using.

Out of curiosity why is writing everything as a single element type more ergonomic? I’ve not done frontend web dev in a while and using <p> <h1> and so on seems like it would be more ergonomic to express intent.

discuss

order

yen223|2 years ago

The reason why it's so tempting to just use `<div>` everywhere is that `<div>` elements have very simple and predictable behaviour with regards to styling, composition and event handling.

Same cannot be said for a lot of other HTML elements, which often have bizarre and inconvenient rules when it comes to style-ability, or nest-ability.