•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 427,493 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,471 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1609 | Replies: 2
![]() |
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,467
Reputation:
Rep Power: 11
Solved Threads: 296
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
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;
};
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Text input box alignment question (HTML and CSS)
- Html Vertical Alignment Help Needed (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: NEED HELP PLEASE!! with javascript issue.
- Next Thread: How to launch pop-up windows....



Linear Mode