开发者

Navigation / Links in HTML [closed]

开发者 https://www.devze.com 2023-02-14 15:37 出处:网络
开发者_如何转开发 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
开发者_如何转开发 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Hoe moet je link maken in html? en verder?


How to make navigation link in html?


<a href="http://stackoverflow.com/questions/5171968/navigatie-links-in-html">woco's link</a>


As I understood from your original post:

<a href="link.html">This is a link</a>


To create a text link

<a href="targetpage.html">Your Link</a>

To create an image link

<a href="targetpage.html">
  <img src="image-file.jpg">
</a>


I think we can manage a longer explanation.

A link takes the form <a href="target">caption</a>. That's the really simplistic way to look at things. target can be a number of things:

  • An anchor within the current document. So if you, at some point on the page, write <a name="anchor"> then <a href="#anchor">go to anchor</a> takes you there. In XHTML this should be <a id="anchor"/> rather than name. This is, in my opinion, one of the overlooked features of html, originally designed to make navigating documents easier.
  • It can be an absolute URI, like mailto:enquiries@mysite.com or ftp://downloads.somesite.com. It doesn't have to be http:// although the most common use is with http. You are free, in fact, to use file://.
  • It can be a relative URI. So for example you might link to <a href="../users">Users</a> in which case stackoverflow.com/questions/123456 would go to stackoverflow.com/users.
  • If you specify <base href="http://someurl" /> then everything in terms of relative addressing, the point above, becomes relative to that base I believe. I don't use it much.

Now, as others have observed, caption can contain other items. Literally anything, say <img/> or <div></div> or <li>. The last case gives you a way to create css menus; how to do that is another question, but the point is, this is pretty powerful.

<a> has some other properties, specifically target The most commonly used one is target="_blank" which asks the browser to open up a new window. You can use this with html frames too, but if you don't know what frames are, forget I mentioned them. Really.

0

精彩评论

暂无评论...
验证码 换一张
取 消