Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////
- //Default//
- ///////////
- div {
- margin: 0 auto;
- }
- //////////////////
- //Using absolute//
- //////////////////
- .wrapper {
- position: relative;
- }
- .insided {
- position: absolute;
- left: 50%; //top: 50%;
- transform: translateX(-50%); //transform: translateY(-50%);
- }
- //////////////////
- //Using flex box//
- //////////////////
- div {
- display: flex;
- -webkit-justify-content: center;
- -ms-flex-pack: center;
- justify-content: center;
- -webkit-flex-align: center;
- -ms-flex-align: center;
- align-items: center;
- }
Advertisement