標題的父元素有一個固定的高度(目前在我的屏幕上是402px)和相對定位。這是導致內容落在標題下方的原因。
<div id="banner" style="height:402px;">
該網站正在使用JS來保持這個高度正確。
腳本來源:http://static.hairproject.ch/js/script.js
的興趣代碼:
// Figure out browser width/height and ajust main picture -------------------------------------------------
var width = $(window).width();
var height = $(window).height();
if ((width > 320) && (width <= 480)) { height = height + 240; }
else if (width <= 320) { height = height + 80; }
var margintop = Math.round((height/3) - 120);
$("body.home #banner").attr("style","height:" + height + "px;");
$("body.home h2").attr("style","margin-top:" + margintop + "px");
$(window).resize(function() {
// $('#log').append('<div>Handler for .resize() called.</div>');
var width = $(window).width();
var height = $(window).height();
if ((width > 320) && (width <= 480)) { height = height + 240; }
else if (width <= 320) { height = height + 80; }
var margintop = Math.round((height/3) - 120);
$("body.home #banner").attr("style","height:" + height + "px;");
$("body.home h2").attr("style","margin-top:" + margintop + "px");
});
我知道一定是有JavaSrcipt。謝謝弗萊姆! – Andrewski