CSS로 div 가운데 두기

CSS로 div 가운데 두는 6가지 방법

Codepen Examples

a. padding

calc(100px / 2 - (20px / 2))

b. translate

calc(50px - (100% / 2)), calc(50px - (100% / 2))

c. flex

d. grid

e. position

calc(50% - 10px)

f. flex and margin

--

--

JavaScript Developer, https://afrontend.github.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store