Skip to main content

Command Palette

Search for a command to run...

Self closing tags can lead to unexpected behaviour

Updated
1 min read
F

React, Django and SQL developer at Forma.ai

https://www.stefanjudis.com/today-i-learned/self-closing-tags-are-mostly-meaningless-in-html

  1. Void elements [MDN] like hr, br, input: self-closing doesn't do anything

  2. Non-void elements like div: HTML pretends the /> is >

    1. so it's as if you forgot to close your div! 🤯

React doesn't have that problem