I have a very simple layout that I am trying to achieve in CSS, but I am not having any luck. All I want to do is (horizontally) center a div that contains a link. The size of the div should be based on the size of its content.
I have tried a bunch of combinations of auto margins, text alignments, and display types, but can't seem to figure it out (I am a CSS noob). I have cooked up a very simple case (and the best I can do)
HTML:
<body>
    <div class="myDiv">
        <a href="google.com">google.com</a>
    </div>
</body>
CSS:
.myDiv
{
    background:lightblue;
    text-align:center;
    margin-left:auto;
    margin-right:auto;
}
.myDiv a
{
     text-decoration:none;
}
I have made a Fiddle as well. Is this type of layout possible without complicated HTML/CSS /hacks?
 
     
     
    