I want to absolutely position the text on top of my image, but it does not seem to be the center. I tried something, but it was very strange. I'm going to a responsive site, but with that it starts to seem weird. here is my code.
HTML
<div id="container"></div>
<div class="parent">
<div class="child">
<h1> Richy Photography </h1>
</div>
</div>
CSS
#container {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
background-image:url(image.jpg);
background-size:cover;
background-position:50% 50%;
background-repeat: no-repeat;
}
body, html
{
height:100%;
width:100%;
}
.parent {
position:relative;
font-family: Helvetica, Arial, sans-serif;
width: 100%;
height: 100%;
margin:0;
padding:0;
}
.child {
position: absolute;
left:37%;
top:37%;
margin:0;
padding:0;
}
source
share