The name is a little deceiving. I know how to go to the section on the page using:
<a href="#link">Link</a>` <a name="Link">
My question is how can I make the transition location 50 pixels higher by default. This is mainly done when I go to the section, it does not appear exactly at the top of the browser, but allows you to use some buffer room.
You can add padding-top: 50px;to your target (s) with a possible unintended side effect, always having 50pxspaces above your target (s).
padding-top: 50px;
50px
Example:
HTML:
<a href="#test">Test</a> <div style="height:1000px"><!-- create some whitespace for demo purposes --></div> <h1 id="test">Target</h1> <div style="height:1000px"><!-- create some whitespace for demo purposes --></div>
CSS
#test { padding-top: 50px; }
DEMO
For clean code that solves your problem, use CSS "before":
<style> #link:before{ padding-top:50px;display:block;content:""; } </style> <a href="#link">Link</a> <div id="link">content</div>
CSS,
HTML
<a name="Link" class="link1">
.link1 { padding-top: 50px; }
, , . .
http://hyperlink#sms_recipient
This link refers to the page and puts focus on the mobile number field. The visitor can immediately enter the number and click send.