cm0002@lemmy.world to Programmer Humor@programming.dev · 2 years agoProgrammers then and nowlemmy.mlimagemessage-square100linkfedilinkarrow-up1928arrow-down130
arrow-up1898arrow-down1imageProgrammers then and nowlemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 2 years agomessage-square100linkfedilink
minus-squareObinice@lemmy.worldlinkfedilinkarrow-up33·2 years agoOkay but how do u center a div in 2025
minus-squareɪᴍᴘᴇᴅᴀɴꜱ@lemmy.worldlinkfedilinkarrow-up9·2 years agoIf you define what you mean by centering I’ll give you a straight answer. Vertically? Horizontally? Center the text or the entire box? Compared to the viewport, the parent container or the entire page? “Centering” isn’t as straight forward as you’d think, and what you actually want usually depends on the situation.
minus-squareɪᴍᴘᴇᴅᴀɴꜱ@lemmy.worldlinkfedilinkarrow-up3·2 years agoYeah that works if you wanna center a box of content it relative to the parent container, either horizontally or vertically. For other situations we’ve got different tools
minus-squareletsgo@lemm.eelinkfedilinkEnglisharrow-up7·2 years agoSame way you did it in 2024 but it’s easier because the springgirdles have been replaced with rotated manglebrackets.
minus-squarex00z@lemmy.worldlinkfedilinkEnglisharrow-up5·2 years agoAsk the browser nicely while using please and thanks.
minus-squareWhiskyTangoFoxtrot@lemmy.worldlinkfedilinkarrow-up5·2 years agoMake your web page in GIMP, export to PNG, <img>.
minus-squareburlemarx@lemmygrad.mllinkfedilinkarrow-up2·2 years ago2050: people still wondering how to center a div because html and CSS is a nightmare.
minus-squareirelephant [he/him]@programming.devlinkfedilinkarrow-up2·2 years agoWhat threw me was having to set a width.
minus-squareAnomalocaris@lemm.eelinkfedilinkarrow-up2·2 years agomaybe the div is already where it’s meant to be
minus-squareMadhuGururajan@programming.devlinkfedilinkEnglisharrow-up1·2 years agouse display: flex flex-direction: column align-items: center on the parent container
minus-squarehakunawazo@lemmy.worldlinkfedilinkarrow-up1·2 years agoIt’s not about the center, it’s about the friends we made along the way.
Okay but how do u center a div in 2025
If you define what you mean by centering I’ll give you a straight answer.
Vertically? Horizontally? Center the text or the entire box? Compared to the viewport, the parent container or the entire page?
“Centering” isn’t as straight forward as you’d think, and what you actually want usually depends on the situation.
Nah, just flex them boxes
Yeah that works if you wanna center a box of content it relative to the parent container, either horizontally or vertically. For other situations we’ve got different tools
Same way you did it in 2024 but it’s easier because the springgirdles have been replaced with rotated manglebrackets.
Ask the browser nicely while using please and thanks.
Make your web page in GIMP, export to PNG,
<img>.2050: people still wondering how to center a div because html and CSS is a nightmare.
What threw me was having to set a width.
maybe the div is already where it’s meant to be
use
display: flexflex-direction: columnalign-items: centeron the parent container
It’s not about the center, it’s about the friends we made along the way.