Link to home
Start Free TrialLog in
Avatar of VBBRett
VBBRett

asked on

How do you center a label using CSS?

I am trying to center a label using CSS in a user control but for some reason it is not working.  Here is what I have:

<div id="headertag" style="width:500%; margin-left:auto; margin-right:auto;">
        <div id="subheadtag" style="width:300px; margin-left:auto; margin-right:auto;"
            runat="server">
            <asp:Label ID="lblsandmed" style="font-weight:bold; margin-left:auto; margin-right:auto;" runat="server">THIS IS A HEADER LABEL</asp:Label>            
        </div>        
    </div>

What is it that I am doing wrong in order to center this header label?  I thought margin-left:auto; margin-right:auto; was supposed to
Avatar of VBBRett
VBBRett

ASKER

By the way, I am trying to do this in a user control.  Anybody have a clue what I am doing wrong?  Please let me know.  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial