21
Found out I was nesting divs wrong for 6 months
I kept wondering why my layouts looked off center and weird. Turns out I was putting block elements inside inline elements without thinking about it. A guy on StackOverflow pointed it out and showed me the HTML spec from 2014. Has anyone else had a basic CSS rule click way later than it should have?
3 comments
Log in to join the discussion
Log In3 Comments
torres.grant7d ago
Wait six months is basically speedrunning CSS mistakes though right?
4
young.kim7d ago
The thing about "nobody reads the spec front to back" is sorta true, but honestly you should at least skim the basics. I used to think block elements could go inside inline ones too until I kept breaking my layouts. The spec from 2014 isn't some secret scroll either, its on MDN and super readable. You dont have to memorize it, but knowing that inline elements like span or a cant wrap divs or sections saves you from exactly the kind of off-center issues OP had. Six months is rough but at least the StackOverflow guy caught it before you rebuilt your whole site or something.
3
dianahayes7d ago
Isnt it more like we all just kinda figure out CSS as we go along though? Like the spec is huge and nobody reads it front to back, we just break stuff til it works.
1