logoalt Hacker News

yomismoaquilast Sunday at 4:57 PM5 repliesview on HN

It's a little shameful but I still struggle when centering divs on a page. Yes, I know about flexbox for more than a decade but always have to search to remember how it is done.

So instead of refreshing that less used knowledge I just ask the AI to do it for me. The implications of this vs searching MDN Docs is another conversation to have.


Replies

jfengellast Sunday at 6:17 PM

No shame in that. I keep struggling to figure out the point of view of the CSS designers.

They don't think like graphic designers, or like programmers. It's not easy for beginners. It's not aimed at ease of implementation. It's not amenable to automated validation. It's not meant to be generated.

If there is some person for whom CSS layout comes naturally, I have not met them. As far as I can tell their design goal was to confuse everyone, at which they succeeded magnificently.

show 1 reply
simonwlast Sunday at 5:15 PM

Hah, centering divs with flexbox is one of my uses for this too! I can never remember the syntax off the top of my head, but if I say "center it with flexbox" it spits out exactly the right code every time.

If I do this a few more times it might even stick in my head.

robofanaticlast Monday at 1:50 AM

> Yes, I know about flexbox for more than a decade but always have to search to remember how it is done.

These days I use display: flex; so much that I wish the initial value of the display property in CSS should be flex instead of inline;

barrkellast Sunday at 5:03 PM

Try tailwind. Very amenable to LLM generation since it's effectively a micro language, and being colocated with the document elements, it doesn't need a big context to zip together.

llmslave2last Sunday at 6:46 PM

Surely searching "centre a div" takes less time than prompting and waiting for a response...

show 3 replies