I'm trying to center a text inside a Relative>Absolute>Relative>'text to be centered'. I've tried most of the solutions that I could find, but I can only get it to center horizontally. Here is a Fiddle of what I've got so far.
HTML:
<div class='outer'>
<div class='inner'>
<div class='inner1'>
<p>
text
</p>
</div>
</div>
</div>
CSS:
.outer{
position: relative;
width: 500px;
height: 250px;
background-color: red;
}
.inner{
position: absolute;
width: 100px;
height: 100px;
background-color: blue;
top:20px;
left: 50px;
}
.inner1{
position: relative;
}
.inner1 p{
text-align: center;
margin: 0;
}