单击外部链接后链接到页面的特定位置
问题描述:
我想知道在外部链接中单击后是否可以移动到页面的特定位置。单击外部链接后链接到页面的特定位置
假设我有一个链接:<a href="another_page.html">Go there</a>
。当我点击'Go there'
后,我想要移动到another_page.html
的特定位置。职位可能在buttom或中心或任何其他职位。可能吗。
答
你可以去到页面的任何位置,通过参考元素ID一样,
<a href="another_page.html#position">Go there</a>
another_page.html
页面上创建id="position"
一个div
,
<div id="position">
它将点position
div
答
您可以使用HTML's anchors:
例
主页:
<a href="test1.html#John">John</a>
<a href="test1.html#Doe">Doe</a>
示例页面:
<div id='John'></div>
<div id='Doe'></div>
答
您可以使用链接的ID作为参考实现这个!
说:<a href="another_page.html#mylink">Go there</a>
和another_page.html
页面,创建提到id
(例如:<p id="mylink">Mylink<p>
)
答
您可以使用一个href以 '#' 与特定的ID链接的元素:
<a href="another_page.html#gothere">Go There</a>
凡another_page.html与
元素
答
<a href="#section">Section part></a>
When click on the anchor then it will be redirect on this section which is mentioned below.
<div id="section">
Hi I am websolutionexpert
You can follow me.
</div>
+0
这只是内部链接。问题不在于此。 – user254153 2014-10-07 07:49:00
''元素的结束标记是强制性的,并且在XHTML 1.0中不再使用''元素上的'name'属性(在任何元素上使用'id'替换为HTML 4中的元素后)。 – Quentin 2014-10-07 06:58:07