at the desired location on the page; (Note: A name attribute must be written in the a tag, and the attribute value must be the same as the href attribute value in ①, without adding # ) fill in the necessary text as needed in the tag, generally do not write the content"/> at the desired location on the page; (Note: A name attribute must be written in the a tag, and the attribute value must be the same as the href attribute value in ①, without adding # ) fill in the necessary text as needed in the tag, generally do not write the content">
Home >Web Front-end >HTML Tutorial >Anchors and page jumps in html
1. Setting the anchor point for intra-page jump
Jumping within the page requires two steps:
Method 1:
①: Set an anchor link0a9b0e264ddbf322cec2bf7d1441f351Go find cats5db79b134e9f6b82c0b36e0489ee08ed; (Note: Add # at the beginning of the attribute value of the href attribute)
②: Set the anchor point at the required position on the pagee99f71bcb92fd9e6915562f012b6f8495db79b134e9f6b82c0b36e0489ee08ed (Note: A name attribute must be written in the a tag, and the attribute value must be the same as the href attribute value in ①, without adding #) Fill in the necessary text in the tag as needed, Generally do not write content
Method 2:
①: Same as method 1①
②: Set the location of the anchor point69448d96d5155946085bc042e89e96ceMeow Star Base39528cedfa926ea0c01e69ef5b2ea9b0 Add an id attribute to the label of the position you want to jump to. The attribute value is the same as the href attribute value in ①, without adding
#. Method 2 does not need to add a separate a tag to specifically set the anchor point, only in the required position. Just add an id to the tag.
Small case:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>萌宠集结号</title> </head> <body> <ul> <li><a href="#miao">去找喵星人</a></li> <li><a href="#wang">去找汪星人</a></li> <li><a href="#meng">其他萌物</a></li> </ul> <a name="miao"></a><!--设置锚点方法1--> <h3 id="miao">喵星人基地</h3><!--设置锚点方法2--> <p>喵喵喵~</p> <p>喵喵喵~</p> <p>喵喵喵~</p> <p>喵喵喵~</p> <p>喵喵喵~</p> <p>喵喵喵~</p> <a name="wang"></a> <p>汪汪汪~</p> <p>汪汪汪~</p> <p>汪汪汪~</p> <p>汪汪汪~</p> <p>汪汪汪~</p> <p>汪汪汪~</p> <a name="meng"></a> <p>萌萌萌~</p> <p>萌萌萌~</p> <p>萌萌萌~</p> <p>萌萌萌~</p> <p>萌萌萌~</p> <p>萌萌萌~</p> </body> </html>
2. Cross-page jump
①: Set the anchor link and append after the path in href: # Anchor name, you can
such as: 9b968f02576fd9c545cd3c25ac48baae Jump to the Cute Pet Collection Account page5db79b134e9f6b82c0b36e0489ee08ed
②: To jump to To set the anchor point on the page, please see step ② for the method. Choose one of the two methods.
The above is the detailed content of Anchors and page jumps in html. For more information, please follow other related articles on the PHP Chinese website!