If is obsolete, what is preferred?

后端 未结 5 2026
北海茫月
北海茫月 2020-12-30 19:24

The HTML code text is very useful for creating links to specific sections of a page (e.g., page.html#some_bookma

5条回答
  •  星月不相逢
    2020-12-30 19:48

    (Note: migrated from https://webmasters.stackexchange.com/a/30031/10884 and edited for brevity.)

    If you need to jump users to in-page links, also known as fragment identifiers, you can set the id attribute (which is used for more than just frag ids) on any element. Then use the usual # in the URL of a href attribute of an a element. Here’s an example:

    
      

    Despite the many benefits you may experience while chewing gum, there are also many drawbacks, especially with non-sugarless gum.

    ...

    Benefits of Gum Chewing

    ...

    When writing my own pages, I like to give an id to each

    tag (HTML5), even if I don’t plan on using it. The value of the id is a URL-friendly version of its heading’s content. You can achieve the same effect by assigning the same id to an

    , etc.

提交回复
热议问题