HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
How do i freeze text on a page?
Post new topic   Reply to topic    HTML Help Forum Index -> CSS
View previous topic :: View next topic  
Author Message
raamjoshi



Joined: 18 Jun 2006
Posts: 1

PostPosted: Sun Jun 18, 2006 8:45 am     How do i freeze text on a page? Reply with quote

hi, i was wondering how i can freeze text only on the footer of the page so even when the user scrolls down the page, the footer text will stay where it is.
gary.newelluk



Joined: 12 May 2005
Posts: 548
Location: Peterhead, Scotland

PostPosted: Sun Jun 18, 2006 2:16 pm     Reply with quote

I don't know if there is a way to do it using HTML alone but here is a javascript method.

Code:

<html>
<head>
<title>Static footer</title>
<style>
#foottext
{
   position: absolute;
   background: black;
   color: white;
   width: 100%;
   z-Index: 5;
}
</style>
<script type="text/javascript">
function movefooter()
{
var xl = document.getElementById("foottext");
var newy = document.body.clientHeight - 25 + document.body.scrollTop;
xl.style.top = newy + "px";
}
</script>
</head>
<body onscroll="movefooter()">
<div id="foottext" >
Hello World
</div>
</body>
</html>


Now you may have to play around with it but it seems to work for me on internet explorer and firefox.

There is a flicker though when code goes underneath.
gary.newelluk



Joined: 12 May 2005
Posts: 548
Location: Peterhead, Scotland

PostPosted: Sun Jun 18, 2006 2:21 pm     Reply with quote

Sorry of course there is the HTML option of using frames as follows:

<frameset="rows=80%,20%">
<frame name="top" src="main.html">
<frame name="footer" src="footer.html">
</frameset>

Now you need to create two pages... one called main.html and the other called footer.html.

In the main you add the main code of the page and in the footer.html you place your footer message.

The footer will always appear in the same place no matter how much someone scrolls.

(Personally I don't like frames but then a lot of people don't like javascript either because both have their potential flaws).

This seems as good a reason as any for using frames however.

Visit http://www.easywebpagedesign.com/html_frames.html for more information about the use of frames.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> CSS All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial