Reputation: 329
<div id = "nav"></div>
I already know how to set scrollbar position of that DIV with Javascript(jQUery). but what I want to know is how to set with HTML or CSS property something like
<div id = "nav" scrollTop = "100"></div>
or
<div id = "nav" style = "scrollTop:100px"></div>
is there any solution?
Upvotes: 0
Views: 259
Reputation: 8477
You cannot accomplish this to specifically go to exact position on the page without using javascript.
What you can however do is :
Create a div with the styles associated with it. The position where you want to goto.
<div id="top10px"></div>
and apply css as :
#top10px {position:absolute;top:10px;left:0}
And make these div's where ever you want to navigate to,
<div id="top0px"></div> <div id="top100px"></div> <div id="bottom0px"></div>
and apply styles accordingly.
Here's a fiddle : Fiddle
Upvotes: 2