Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

css
html

How to center-align items

Fahad Farid
svg viewer

Use the following steps to center-align text in the middle of a div container.

  1. Create a div container.
  2. Insert the button tag, image tag, or text you want to enter.
  3. In the CSS for the div, set text-align to center.

The button and all the contents within the div should now be center aligned.

Below is a working code example that can help you better understand the concept:

Note: The <center> tag has been discontinued in HTML 5 and can no longer be used to center-align the text.

RELATED TAGS

css
html

CONTRIBUTOR

Fahad Farid
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring