King@sh.itjust.works to Programmer Humor@programming.devEnglish · edit-22 months agoCentering a Divi.ibb.coimagemessage-square62fedilinkarrow-up1297arrow-down112file-text
arrow-up1285arrow-down1imageCentering a Divi.ibb.coKing@sh.itjust.works to Programmer Humor@programming.devEnglish · edit-22 months agomessage-square62fedilinkfile-text
minus-squareirelephant [he/him]@programming.devlinkfedilinkarrow-up4·2 months agoYou literally just have to give it a width and add margin: 0 auto;
minus-squarehumorlessrepost@lemmy.worldlinkfedilinkEnglisharrow-up3·edit-22 months agoI think it’s implied they’re talking about centering both horizontally and vertically. And probably with unknown height. Still easy these days , though.
minus-square𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.worldlinkfedilinkarrow-up2·edit-22 months agoOr use Flexbox But your solution works as well for simple cases
minus-squareirelephant [he/him]@programming.devlinkfedilinkarrow-up1·2 months agoI generally avoid flex for simple stuff (i like weird browsers), but for more complex layouts it should certainly be used.
You literally just have to give it a width and add
margin: 0 auto;I think it’s implied they’re talking about centering both horizontally and vertically. And probably with unknown height.
Still easy these days , though.
Or use Flexbox
But your solution works as well for simple cases
I generally avoid flex for simple stuff (i like weird browsers), but for more complex layouts it should certainly be used.