How to center div in Sass?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to center div in Sass?!

I really want to both vertically and horizontally align this div center. But it's written in Sass and I don't know how. I've tried flex, vertical align, absolute positioning, and body text-align but it won't move! https://code.sololearn.com/WV9Dl8mSTlX7/?ref=app

29th Jun 2020, 5:39 PM
Clueless Coder
Clueless Coder - avatar
1 Answer
+ 2
give body these properties position: relative; width:100%; height:100vh; give example these properties position: absolute top: 50%; left: 50%; and change your @include at the bottom to this @include sassFunction(translate(-50%, -50%) rotate(45deg));
29th Jun 2020, 6:05 PM
JME