I am trying this solution (first answer) to vertically align an image over a div that has the following additional css properties so it takes the whole space:
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right:0px;
The problem is, even with the fiddle referenced in the original question (here), if you add an additional span with a text, separated by a <br/>
, this span
shows outside of the containing div.
I want to align both the image and caption inside the div.
Any ideas?
HTML:
<html>
<head>
<title>Splash screen</title>
<style>
.frame {
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right:0px;
text-align: center;
}
.helper {
display: inline-block;
height: 100%;
vertical-align: middle;
}
img {
vertical-align: middle;
max-height: 25px;
max-width: 160px;
}
</style>
</head>
<body>
<div class="frame">
<span class="helper"></span>
<img class="center" src="img/splash/splash.png" />
<br />
HELLO WORLD
</div>
</body>