This is for a mobile website header. The page title is centered and the back button image floats left. I want the back button to be centered within the pageTitle div but cannot get it to work.
I found that if I give the pageTitle div a position of relative and backArrow a top of 0 I can get around the padding of the pageTitle div but I can't get any further. Giving a top or padding of 50% only made it worse.
Fiddle: http://jsfiddle.net/gjL4z/
CSS:
body {
background-color: #666;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.pageTitle {
text-align: center;
padding: 10px;
color: #ffffff;
font-size: large;
background: #2281b5;
position: relative;
}
.backArrow {
float: left;
position:absolute;
top: 0;
}
HTML:
<div class="pageTitle">
<div class="backArrow">
<a href="index.php">
<img src="http://s27.postimg.org/5iv71nvkf/backward_Arrow.png" width="29" height="29" />
</a>
</div>
Page Title
</div>