Garrettfromhp Garrettfromhp - 5 months ago 12
HTML Question

Element width and text centering

I'm working with HTML and I need to insert a heading that is centered on the page with a color-filled, width-limited background, so that the color-fill of the heading element does not cover the whole of the page space.

Heres my code:



style="text-align:center;background-color: white;max-width: 500px;"Support



As this code goes, it centers the text within the limits of the element width and not the page. The entire page has a background image, which I want to remain as uncovered as possible. I can center the text by excluding the width limit but this causes the element background to pass through the width of the page. I want the color-filled heading element background in order to help the text pop from the page background.


you might try putting a div around it, like

<div style="width:100%;margin:auto;text-align:center">your H1 tag here</div>

also do as Pamblam said, don't put this in the tag, but in the tag