如何将我的东西链接到我的HTML中的其他页面? [英] How do I link my stuff to other pages in my HTML?

查看:55
本文介绍了如何将我的东西链接到我的HTML中的其他页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将我标题中的所有页面与我在下面提供的html链接?



 <   !DOCTYPE     html  >  
< html >
< head >
< meta charset = utf-8 >
< title > 主页< / title >
< link < span class =code-attribute> rel = stylesheet type = text / css href = style.css / >

< / head >
< body >

< div id = nav >

< ul >
< h1 > Ben NEWMAN < / h1 >
< li > < a href = > 组合<温泉n class =code-keyword>< / a >
< li > < a href = > 图库< / a > ; < / li >
< li > < a < SP class =code-attribute> href = > 关于< / a > < / li >
< li > < a href = > 主页< / a > < / li < span class =c ode-keyword>>

< / ul >

< / div >

< / body >
< < span class =code-leadattribute> / html >





我尝试了什么:



谷歌和其他不起作用的东西。

解决方案

 <   li  >  <   a     href   =   > 投资组合<   / a  >  



您应该提供相关html网页的路径,而不是。 br />
指的是,它不会以任何URL为目标,所以通过点击链接它不会导航到任何其他页面,除非有一个jquery点击事件映射到锚标签,但是我没有在你的代码中看到这些......

如下所示更改你的代码,你应该参考下面的链接来准确映射。

 <   h1  > 本纽曼<   / h1  >  
< li > < a href = Portfolio.html > 投资组合< / a >
< li > < a href = Gallery.html > 图库< / a & gt; < / li >





参考此 HTML链接 [ ^ ],< a href =http://www.w3schools.com/tags/att_a_href.asp> HTML a href属性 [ ^ ]用于在href属性中映射页面的路径。


参见< a> 标记用法:

HTML标记 [ ^ ]



这个网站是学习很多网络相关内容的好教程。


请看我对这个问题的评论。

也许,你想知道如何使用 anchors 导航同一页面。

这个想法非常简单:

 <   html  >  
< head > < title > 锚定示例< span class =code-keyword>< / title > < / head >
< span class =code-keyword>< body >

< ul >
< li > ; < a href = #a1 > 投资组合< / a >
< li > < a href = #a2 > 图库< / a > < / li >
< li > < a < span class =code-attribute>
href = #a3 > 关于< / a > < / li >
< li > <! - ... - > < / li >
< < span class =code-leadattribute> ul >

< h1 id = a1 > 投资组合< / h1 >

<! - ... < span class =code-comment> - >

< h1 id = a2 > 图库< / h1 >

<! - ... - >

< h1 id = a3 > 关于< / h1 >

<! - ... - >

< / body < span class =code-keyword>>
< / html >



重要!属性 id 的值在页面上应该是唯一的。



-SA

How do I link all of my pages in my header with the html I provide below?

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Home</title>
	<link rel="stylesheet" type="text/css" href="style.css"/>

</head>
<body>

	<div id="nav">

			<ul>
				<h1>Ben NEWMAN</h1>
				<li><a href="#">Portfolio</a> 
				<li><a href="#">Gallery</a></li>
				<li><a href="#">About</a></li>
				<li><a href="#">Home</a></li>

			</ul>
			
	</div>

</body>
</html>



What I have tried:

google and something else that did not work.

解决方案

<li><a href="#">Portfolio</a> 


Instead of #, you should provide the path to the related html pages.
# refers, it will not target any URL, So by clicking the link it wont navigate to any other page, unless there is a jquery click event mapped to the anchor tags, but i am not seeing those in your code..
Change your code like below and you shall refer the links below for mapping exactly.

<h1>Ben NEWMAN</h1>
<li><a href="Portfolio.html">Portfolio</a> 
<li><a href="Gallery.html">Gallery</a></li>
.
.



refer this HTML Links[^] , HTML a href Attribute[^] for mapping the path of the page in href attribute.


See <a> tag usage:
HTML a tag[^]

This site is a good tutorial to learn a lot of web related things.


Please see my comment to the question.
Probably, you want to know how to navigate withing the same page using anchors.
The idea is very simple:

<html>
   <head><title>Anchor sample</title></head>
<body>

<ul>
<li><a href="#a1">Portfolio</a>
<li><a href="#a2">Gallery</a></li>
<li><a href="#a3">About</a></li>
<li><!-- ... --></li>
<ul>

<h1 id="a1">Portfolio</h1>

<!-- ... -->

<h1 id="a2">Gallery</h1>

<!-- ... -->

<h1 id="a3">About</h1>

<!-- ... -->

</body>
</html>


Important! The values of the attribute id should be unique on the page.

—SA


这篇关于如何将我的东西链接到我的HTML中的其他页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆