Center TEXT in a DIV

Here is the css and html of a div with text. I am trying to get the text centered in the middle (vertically/horizontally) in the middle of the div. I am having troubles… help please - thanks.

            margin-left: auto;
            margin-right: auto;
            margin-top: auto;
            margin-bottom: auto;
            display: inline-block;
            vertical-align: middle;
            text-align: center;

<div id="div1"><p>Hello</p>

Centering in CSS: A Complete Guide

Thank you for the reference.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.