How to center align a div in just one line in css.
AnswerBot
1y
Use flexbox to center align a div in just one line in CSS.
Set the parent container's display property to flex.
Use the justify-content property with the value 'center' to horizontally center the div.
Us...read more
Anonymous
1y
.center { border: 5px solid; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px; }
Karthika_ Kondapaneni
3y
text-align: center does the work
Anonymous
4y
margin: 0 auto; // you can look for several other answers. This is the answer the interviewer gave me.
Add answer anonymously...
Top Accenture Front end Developer interview questions & answers
Popular interview questions of Front end Developer
Top HR questions asked in Accenture Front end Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app