Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1692 | Replies: 2
![]() |
•
•
•
•
| |
•
•
Join Date: Jul 2006
Location: Middle America
Posts: 173
Reputation:
Rep Power: 3
Solved Threads: 1
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,656
Reputation:
Rep Power: 12
Solved Threads: 311
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
Publilius Syrus
(~100 BC)
LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
To my knowledge, there is no valid way to do this using only html and css.
Try using the following script, where paragraphID is the id tag name of the paragraph.
(i.e.
Try using the following script, where paragraphID is the id tag name of the paragraph.
(i.e.
<p id="paragraphID"> window.onload = initPage;
window.onresize = initPage;
function initPage() {
// Get paragraph height
var paragraph = document.getElementById('paragraphID');
var paragraphHeight = paragraph.offsetHeight;
// Get browser window height
var windowHeight = getWindowHeight();
// Set paragraph area on page
paragraph.style.position = 'absolute';
paragraph.style.top = ((windowHeight - paragraphHeight) / 2) + 'px';
}
function getWindowHeight() {
var windowHeight = 0;
if (typeof(window.innerHeight) == 'number')
windowHeight = window.innerHeight;
else {
if (document.documentElement && document.documentElement.clientHeight)
windowHeight = document.documentElement.clientHeight;
else {
if (document.body && document.body.clientHeight)
windowHeight = document.body.clientHeight; }; };
return windowHeight;
};
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Hybrid Mode