fmsf
fmsf

Reputation: 37137

CSS set default scroll position

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.

Upvotes: 21

Views: 51573

Answers (3)

abstraktor
abstraktor

Reputation: 1035

Within boundaries, it is possible:

When you go to the url www.domain.com/#divWithScroll then you will scroll down by default.

<a href="#divWithScroll">Scroll down</a><!-- clicking this works either -->
<!-- long blablabla -->
<div id="divWithScroll">Scrolled here</div>

More on http://css-tricks.com/hash-tag-links-padding/

Upvotes: 19

Evan Meagher
Evan Meagher

Reputation: 4555

It's not really a "style" issue, so it's not something that CSS would cover.

Upvotes: 10

RichieHindle
RichieHindle

Reputation: 281475

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

Upvotes: 18

Related Questions