I am making a dynamic slide show.
I am trying to get some text that I assign dynamically to align itself centrally and vertically within a box.
So far, I have:
HTML
<body>
<div class="slide">
<span class="content">
<b>Hello. This text needs to be:</b><br><br>
- left-aligned but <br>
- centered in the grey box<br>
- even if it changes<br>
- the center of the white box <br>
should equal center of grey one.
</span>
</div>
</body>
CSS
.slide {
position:relative;
background-color: #ddd;
width: 300px;
height: 300px
}
.content {
position: absolute;
top: 30%;
left: 15%;
background-color: #fff;
}
OUTPUT
This doesn't work because if the text changes, it will no longer be central. Anyone have any ideas how to fix this?