JasoN_Sy

Centering techniques

Dec 8th, 2016
206
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.53 KB | None | 0 0
  1. ///////////
  2. //Default//
  3. ///////////
  4. div {
  5. margin: 0 auto;
  6. }
  7.  
  8. //////////////////
  9. //Using absolute//
  10. //////////////////
  11. .wrapper {
  12.     position: relative;
  13. }
  14. .insided {
  15. position: absolute;
  16. left: 50%; //top: 50%;
  17. transform: translateX(-50%); //transform: translateY(-50%);
  18. }
  19. //////////////////
  20. //Using flex box//
  21. //////////////////
  22. div {
  23.     display: flex;
  24.  
  25.     -webkit-justify-content: center;
  26.     -ms-flex-pack: center;
  27.     justify-content: center;
  28.  
  29.     -webkit-flex-align: center;
  30.     -ms-flex-align: center;
  31.     align-items: center;
  32. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment