curiouswebster
asked on
need a floating title
I need a title that wil always be in the same place (the top) regardless of whether the user has scrolled don to the bottom of the page.
Can someone tell me how to do this?
newbieweb
Can someone tell me how to do this?
newbieweb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
div.content
{
height: 100%;
overflow: auto;
}
div.title
{
position: absolute;
top: 0;
left: 0;
width: 100%;
}
goes into the css file and
<div class="title"></div>
<div class="content"></div>
in the html file.
Mark
{
height: 100%;
overflow: auto;
}
div.title
{
position: absolute;
top: 0;
left: 0;
width: 100%;
}
goes into the css file and
<div class="title"></div>
<div class="content"></div>
in the html file.
Mark
ASKER
Mark,
I put the word "Glossary" into both the title and the content. And in both cases the text scrolls with the window.
I need it to stay put, even when I scroll the window.
Any suggestions?
newbieweb
I put the word "Glossary" into both the title and the content. And in both cases the text scrolls with the window.
I need it to stay put, even when I scroll the window.
Any suggestions?
newbieweb
What browser?
Mark
Mark
ASKER
IE 6
I tried it, using IE6, it works in my opinion. Take a look:
<html>
<head>
<style>
div.content
{
height: 100%;
overflow: auto;
}
div.title
{
position: absolute;
top: 0;
left: 0;
width: 100%;
}
</style>
</head>
<body>
<div class="title">Glossary (this one should stay on top)</div>
<div class="content">
Glossary<br/><br/><br/><br /><br/><br /><br/>Glo ssary<br/> <br/><br/> <br/><br/> <br/><br/> Glossary<b r/><br/><b r/><br/><b r/><br/><b r/>Glossar y<br/><br/ ><br/><br/ ><br/><br/ ><br/>Glos sary<br/>< br/><br/>< br/><br/>< br/><br/>G lossary<br /><br/><br /><br/><br /><br/><br />Glossary <br/><br/> <br/><br/> <br/><br/> <br/>Gloss ary<br/><b r/><br/><b r/><br/><b r/><br/>Gl ossary<br/ ><br/><br/ ><br/><br/ ><br/><br/ >Glossary< br/><br/>< br/><br/>< br/><br/>< br/>
</div>
</body>
</html>
Mark
<html>
<head>
<style>
div.content
{
height: 100%;
overflow: auto;
}
div.title
{
position: absolute;
top: 0;
left: 0;
width: 100%;
}
</style>
</head>
<body>
<div class="title">Glossary (this one should stay on top)</div>
<div class="content">
Glossary<br/><br/><br/><br
</div>
</body>
</html>
Mark
Using external stylesheet:
==test.html==
<html>
<head>
<link rel="stylesheet" href="mystyle.css" type="text/css" />
</head>
<body>
<div class="title">Glossary (this one should stay on top)</div>
<div class="content">
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
Glossary
<br/><br/><br/><br/><br/>< br/><br/>
</div>
</body>
</html>
==mystyle.css==
div.content
{
height: 100%;
overflow: auto;
}
div.title
{
position: absolute;
top: 0;
left: 0;
width: 100%;
}
Mark
==test.html==
<html>
<head>
<link rel="stylesheet" href="mystyle.css" type="text/css" />
</head>
<body>
<div class="title">Glossary (this one should stay on top)</div>
<div class="content">
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
Glossary
<br/><br/><br/><br/><br/><
</div>
</body>
</html>
==mystyle.css==
div.content
{
height: 100%;
overflow: auto;
}
div.title
{
position: absolute;
top: 0;
left: 0;
width: 100%;
}
Mark
ASKER
Mark,
Yes it sure does work. I must have done something wrong when I integrated it.
Thanks.
Yes it sure does work. I must have done something wrong when I integrated it.
Thanks.
ASKER
Which parts go in the style sheet and which parts go in the HTML page?
My compiler didn't recognize: overflow-y: hidden;
"overflow-y" is not a known CSS property name.
newbieweb