I'm helping my dad with a website and he wants the table sidebar i have to float down the page when the viewer scrolls. I know next to nothing about coding and could use some help updating it to be a floating table.
MelodyGrace99 wrote:
I'm helping my dad with a website and he wants the table sidebar i have to float down the page when the viewer scrolls. I know next to nothing about coding and could use some help updating it to be a floating table.
Can you draw a picture as to what exactly you want to do? Floating table may not be the ideal solution but without knowing what is required, it is impossible to give you a working solution.
What happening is he has a lot of text on the page. So the user has to scoll down a lot. The navigation bar is on the left hand side of the page, and when scolling to the bottom, it cannot be seen anymore. To keep from having to scoll back to the top of the page, We want the navigation bar to always be on the side.
Currently I have a table as the navigation bar, but I may be changing this to look a little different using graphics instead. But either way, the navigation bar would need to move with the scoll bar.
Thanks in advance for any help you can provide.
Something like this will work:
<div id="masthead">
<div id="logo">
</div>
<div id="header">
</div>
</div>
<div id="container">
<div id="left_col">
<------ Put your menu here ------>
</div>
<div id="page_content" style="overflow: auto;">
<------ Put your content here ------>
</div>
</div>
<div id="footer">
</div>
And the realted CSS will look like this:
body {
margin: 0;
padding: 0;
}
#masthead {
min-width: 600px;
}
#logo {
float: left;
width: 200px;
}
#header {
margin-left: 200px;
}
#container {
clear: both;
min-width: 600px;
}
#left_col {
float: left;
width: 200px;
}
#page_content {
margin-left: 200px;
}
#footer {
clear: both;
}
I suggest create a test page first and let us know if you need any further help to modify it.
Good luck.
Copy the css into a text file and save it in a folder called css. Then link that file by using this code:
<head>
<title>Your title goes here</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
</head>
You can name the file anything you want but I have used the name: style.css so keep it simple so that it works as in my example.
Unless you're display tabular data, don't use tables. You don't need them.
What you want is a menu with position:fixed. See link below. View page source to see the code.
http://alt-web.com/TEMPLATES/FixedLayout.shtml
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
Ok, I have the text file saved and now i'm trying to figure out where the new piece of code you sent me fits. I'm sorry i'm so slow with this. Here is what I have currently..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<div id="masthead">
<div id="logo">
</div>
<div id="header">
</div>
</div>
<div id="container">
<div id="left_col">
<table width="188" border="1">
<tr>
<td>Test 1 </td>
</tr>
<tr>
<td>Test 2 </td>
</tr>
<tr>
<td>Test 3 </td>
</tr>
<tr>
<td>Test 4 </td>
</tr>
</table>
</div>
<div id="page_content" style="overflow: auto;">
<p>The Department of the Navy desires a tool for analyzing the affects of budgetary changes upon Fire and Emergency Services provided upon Naval Installations throughout the world. The diversity of these installations suggests that across the board funding changes may affect each location differently. This project presents a Fire Loss Model to support the continued development of the analysis tool.</p>
</div>
</div>
<div id="footer">
</div>
</body>
</html>
The table is still above the text, not on the side like in the image you sent.
I have the test document in a folder called "Test" in that folder i have a folder named "CSS" where the text document is saved as style.css
The code i have now is below... Not sure what I'm doing wrong :/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<head>
<title>style.css</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="masthead">
<div id="logo">
</div>
<div id="header">
</div>
</div>
<div id="container">
<div id="left_col">
<table width="188" border="1">
<tr>
<td>Test 1 </td>
</tr>
<tr>
<td>Test 2 </td>
</tr>
<tr>
<td>Test 3 </td>
</tr>
<tr>
<td>Test 4 </td>
</tr>
</table>
</div>
<div id="page_content" style="overflow: auto;">
<p>The Department of the Navy desires a tool for analyzing the affects of budgetary changes upon Fire and Emergency Services provided upon Naval Installations throughout the world. The diversity of these installations suggests that across the board funding changes may affect each location differently. This project presents a Fire Loss Model to support the continued development of the analysis tool.</p>
</div>
</div>
<div id="footer"></div>
</body>
</html>
The table is now on the left hand side. But when i added more content (so you have to scroll to see the bottom) The table still stays at the top of the page. Is there something else I need to do?
Is there anyway to can post your page online so that we can see it how it is working. The code I have given is designed to make your table/menu (on the left hand side) to remain visible on the screen and the users can scroll down using the scroller bars to read the long text that is visible on the right. I hope I have got this right or have I misunderstood your needs?
The table/menu will always be on the screen; It won't move a single iota.
North America
Europe, Middle East and Africa
Asia Pacific