Внутри div, есть картинка, которая должна иметь отступ 10px во всех направлениях от границы DIV. В левом нижнем углу рисунка есть изображение про.
Картинка отображается только тогда, когда она загружена в DOM через jquery.
Проблема заключается в том, что наличие изображения около смещает изображение вниз на столько пикселей, сколько высота изображения около.
Я ищу самую чистую из возможных альтернатив, чтобы сохранить изображение внутри DIV и по-прежнему отображать на нем изображение-изображение. Установка изображения в качестве фона не будет работать, так как мне нужно, чтобы изображение загружалось сразу.
Любое улучшение #about css будет с благодарностью.
Ниже приведена полная html-страница, которая воспроизводит проблему
<html>
<head>
<title>Troubleshooting :: align the main picture inside the DIV</title>
<style type="text/css">
html, body {
background-color: #000000;
}
#about {
z-index:2;
position:relative;
top:82%;
left:3%;
}
#pic {
width:100%;
height:96%;
}
#main-content-image {
height:100%;
margin-right:10px;
margin-left:10px;
margin-top:10px;
margin-bottom:10px;
}
#main-content {
height:490px;
border-width: 1px;
border-style: solid;
border-color: #777777;
}
#main-content-image.loading {
background: url(http://farros.gr/images/ajax-loader2.gif) no-repeat center center;
}
a {
text-decoration: none;
text-decoration: none;
color: #868686;
outline:none;
}
.hide {
display:none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
$(function () {
var img = new Image();
$(img).load(function () {
$(this).hide();
$(this).width('100%');
$(this).height('96%');
$('#main-content-image').removeClass('loading').append(this);
$(this).fadeIn();
}).error(function () {
// notify the user that the image could not be loaded
}).attr('src', 'http://farros.gr/images/bg.jpg');
});
});
</script>
</head>
<body>
<div id="main-content">
<div id="main-content-image" class="loading">
<a href="#"><img id="about" src='http://farros.gr/images/about.png' alt='Haris Farros'/></a>
</div>
</div>
</body>
</html>