logoalt Hacker News

taericyesterday at 6:29 PM2 repliesview on HN

I did mean grid, there.

And don't get me wrong, I don't necessarily want everything absolute positioned. I just find it amusing when people try to get a badge or some such on something and then herculean efforts they will go through to get that badge exactly where they want it.

So, with bluesky, the amount of markup that goes into the footer menu of each post would be what I'm looking at. Tools were clearly used to get styles such as "css-g5y9jx" and this isn't the worst examples I've seen. But I am curious on why so many nested divs seem to be needed all of the time.

I am not clear what you mean by canvas-like approach? I think folks should still use elements. Just fewer of them, all told.

Direct to my claim, though; my argument is just that templates/designs are visual things. I don't think people are thinking in terms of nested div elements. They largely don't even think of sections of their template as parent/child relationships. They have a visual thing and want it filled in with whatever data.


Replies

moritzwarhiertoday at 1:13 PM

The badge on something is a good example for using absolute positioning exactly for what it's meant for imho.

With "canvas-like approach", I meant this part of your comment (not the web technology):

> Basically, my assertion used to be to draw out what you have in mind on grid paper.

I guess we were talking past each other because you equate templates and designs, and I didn't think of this usage of the term (the post also is not about this).

Templating is not necessarily for full pages always, that defeats the purpose of templating languages in the first place to me.

> Direct to my claim, though; my argument is just that templates/designs are visual things. I don't think people are thinking in terms of nested div elements.

Agree. And using modern CSS is a great way to reduce the number of "div"s.

> But I am curious on why so many nested divs seem to be needed all of the time.

I fought many these battles in my jobs, and often it's just for flexibility, because different components are written in a modular fashion. Minimizing the DOM tree size is my goal too, but often the version with less nesting requires a bit more thinking and breaks more easily when elements are added or changed.

CSS gris vs nesting flex containers is a great example for that.

Other times it's just laziness / people don't care.

show 1 reply
curioussavagetoday at 4:45 AM

The nested divs in modern markup are just signs of lazy bone headed devs. I’m constantly removing them from our own app because with either grid or flex box layout in the browser is stupid easy. Haven’t even been tempted to use the old tricks like floats or absolute positioning in years and years.