King@sh.itjust.works to Programmer Humor@programming.devEnglish · edit-25 days agoCentering a Divi.ibb.coimagemessage-square61fedilinkarrow-up1292arrow-down112file-text
arrow-up1280arrow-down1imageCentering a Divi.ibb.coKing@sh.itjust.works to Programmer Humor@programming.devEnglish · edit-25 days agomessage-square61fedilinkfile-text
minus-squareirelephant [he/him]@programming.devlinkfedilinkarrow-up4·4 days agoYou literally just have to give it a width and add margin: 0 auto;
minus-squarehumorlessrepost@lemmy.worldlinkfedilinkEnglisharrow-up3·edit-23 days 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-23 days agoOr use Flexbox But your solution works as well for simple cases
minus-squareirelephant [he/him]@programming.devlinkfedilinkarrow-up1·2 days 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.