Jump to content
MARCELO

Scroll down

Recommended Posts

Put an element with an id attribute on the page at the point where you want the browser to scroll to.

<div id="destination">Destination</div>

Then put a link that goes to that element:

<a href="#destination">Go to destination</a>

 

Share this post


Link to post
Share on other sites

To centre text and inline elements <a>..</a>, it must be within a block element paragraph <p>...</p>, or  <div>...</div> , and that block element must use text-align: center;

OR turn inline element '<a>' then use 'text-align: center;' on that. but note the link will stretch from left to right, unless you give it a specific fixed width, and use margin: 0 auto;

https://www.w3schools.com/code/tryit.asp?filename=FQ7TVLU3G4O9

Edited by dsonesuk

Share this post


Link to post
Share on other sites
9 hours ago, dsonesuk said:

OR turn inline element '<a>' then use 'text-align: center;' on that

OR turn inline element '<a>‘ into block element, using display: block; then...

Share this post


Link to post
Share on other sites

Instead of putting an element with an id attribute on the page at the point where i EXACTLY  want the browser to scroll to, can i specify a distance from this point - up or down - to the browser scroll to?

Share this post


Link to post
Share on other sites

To specify a distance, you'll have calculate the distance to specific a point, which is usually done to an element with a specific id, then by using JavaScript .scrollTop, so either way you will require and element with id attribute.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×