I have something like this:
[ [span][link] ]
but I would like something like this:
[ [span][link] ]
Where the <span>
and <a>
element inside <div>
element are centered in the middle horizontally
span
and a
element have auto width
div
has hardcoded width 250px
How to do that?
My current CSS code is not working, it's centered to the left ;(:
a {
margin: 0px;
padding: 0px;
display: block;
float: left;
width: auto;
}
span {
float: left;
}
div {
display: inline;
text-align: center;
margin-left: auto;
margin-right: auto;
width: 200px;
}
and HTML:
<div>
<span>Name</span>
<a href="#">Link</a>
</div>