56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| 
								 | 
							
								---
							 | 
						|||
| 
								 | 
							
								title: Href
							 | 
						|||
| 
								 | 
							
								localeTitle: HREF
							 | 
						|||
| 
								 | 
							
								---
							 | 
						|||
| 
								 | 
							
								## HREF
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								超文本引用(HREF)是一种HTML属性,可用于指定链接目标或统一资源定位符(URL)。最常见的是,您会看到HREF属性与锚标签`<a>`配对。
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								HREF属性根据使用它的元素获取链接的确切含义。例如,当与`<a>`标签一起使用时,它将表示对象的位置表示为URL。将HREF属性与`<image>`标记一起使用时,HREF属性引用要呈现的图像的URL。
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								### 例子:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								链接到Google的主页:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								\- >文本“访问Google的主页就像链接到主页一样
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								```html
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<a href="https://www.google.com">Visit Google's Homepage</a> 
							 | 
						|||
| 
								 | 
							
								```
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								图像作为链接:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								\- > Google徽标,指的是Google的主页
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								```html
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<a href="https://www.google.com"> 
							 | 
						|||
| 
								 | 
							
								 <img border="0" alt="Google" src="https://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif" width="100" height="100"> 
							 | 
						|||
| 
								 | 
							
								```
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								使用HREF的标签:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								```html
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<a> 
							 | 
						|||
| 
								 | 
							
								 <area> 
							 | 
						|||
| 
								 | 
							
								 <base> 
							 | 
						|||
| 
								 | 
							
								 <cursor> 
							 | 
						|||
| 
								 | 
							
								 <discard> 
							 | 
						|||
| 
								 | 
							
								 <feImage> 
							 | 
						|||
| 
								 | 
							
								 <hatch> 
							 | 
						|||
| 
								 | 
							
								 <image> 
							 | 
						|||
| 
								 | 
							
								 <link> 
							 | 
						|||
| 
								 | 
							
								 <mesh> 
							 | 
						|||
| 
								 | 
							
								 <meshgradient> 
							 | 
						|||
| 
								 | 
							
								 <mpath> 
							 | 
						|||
| 
								 | 
							
								 <pattern> 
							 | 
						|||
| 
								 | 
							
								 <script> 
							 | 
						|||
| 
								 | 
							
								 <textPath> 
							 | 
						|||
| 
								 | 
							
								 <use> 
							 | 
						|||
| 
								 | 
							
								```
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								#### 更多信息:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								[无论如何,WTF是一个href](https://tomayko.com/blog/2008/wtf-is-an-href-anyway) [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/href)
							 |