Here is the structure:
+-----------------------------------------------------------------------+
| |
| heading {position: fixed;} |
|_______________________________________________________________________|
| |
| title1 | title2 | title3 |
| |
| |
| |
| tile1: here is an explanation ... |
| |
| |
| title2: here is an explanation ... |
| |
| |
| title3: here is an explanation ... |
| |
+-----------------------------------------------------------------------+
Here are my codes:
<div id = "heading">header</div>
<a href="#title1">title1</a>
<a href="#title2">title2</a>
<a href="#title3">title3</a>
<div id="title1">tile1: here is an explanation ...</div>
<div id="title2">tile2: here is an explanation ...</div>
<div id="title3">tile3: here is an explanation ...</div>
When I click on the title1
(link), the related div is displayed at the top of the page, under the header (due to the fixed position of the header).
Here is my output: (when I click on title1)
+-----------------------------------------------------------------------+
| |
| header {position: fixed;} |
|_______________________________________________________________________|
| title2: here is a explanation ... |
| |
| |
| title3: here is a explanation ... |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+-----------------------------------------------------------------------+
However, I want this output:
+-----------------------------------------------------------------------+
| |
| header {position: fixed;} |
|_______________________________________________________________________|
| title1: here is a explanation ... |
| |
| |
| title2: here is a explanation ... |
| |
| |
| title3: here is a explanation ... |
| |
| |
| |
| |
| |
| |
+-----------------------------------------------------------------------+
How can I achieve that?
Edit:
Here is my JSFiddle link.