Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS set default scroll position

Tags:

html

css

Is there any way to set the scroll position to a default value?

I know how to do it in javascript, for example with jquery:

$("div#divWithScroll").attr("scrollTop",200);

But I wanted to do it with css only, I have no idea if it is possible.

like image 628
fmsf Avatar asked Jun 04 '09 21:06

fmsf


People also ask

How do I set scroll position?

To get or set the scroll position of an element, you follow these steps: First, select the element using the selecting methods such as querySelector() . Second, access the scroll position of the element via the scrollLeft and scrollTop properties.

What is scroll offset?

forward, then scroll offset is the amount the top of the sliver has been scrolled past the top of the viewport. This value is typically used to compute whether this sliver should still protrude into the viewport via SliverGeometry.

How do I get a scrollbar on the top?

To simulate a second horizontal scrollbar on top of an element, put a "dummy" div above the element that has horizontal scrolling, just high enough for a scrollbar. Then attach handlers of the "scroll" event for the dummy element and the real element, to get the other element in synch when either scrollbar is moved.


1 Answers

No, there's no way to do that in CSS. Sorry!

like image 101
RichieHindle Avatar answered Sep 21 '22 05:09

RichieHindle