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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...