How to place any object at the centre of the page in CSS?Please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to place any object at the centre of the page in CSS?Please help

30th May 2018, 9:41 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
6 Answers
+ 4
if you only have the object in the body of the webpage you can do: body { display: flex; min-height: 100vh; } and your object: margin: auto;
30th May 2018, 11:30 AM
Йордан Петров
Йордан Петров - avatar
+ 4
you can do this: position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
30th May 2018, 1:17 PM
Ayush
Ayush - avatar
+ 3
For positioning in center use margin:auto
30th May 2018, 10:25 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
+ 1
you can place image in centre using <img src="xyz.jpg"class="mx-auto d-block"
29th Jun 2018, 12:45 PM
Gopal Patil
Gopal Patil - avatar
0
Please answer fast!
30th May 2018, 9:51 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
0
I want to place a CSS generated circle to the center of page.How to do it??
30th May 2018, 9:58 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar