search
HomeWeb Front-endHTML TutorialHtml learning (5) - hyperlinks

Html learning (5) - hyperlinks

Dec 29, 2016 pm 03:35 PM
html

Hyperlink tag:

<a>

Two usages:

Hyperlink:

<a href="">
[code]<a href="htpp://www.sina.com.cn" target="_blank">新浪</a>
<!-- href属性值可以使url,也可以是本地文件。target属性是指定在哪个窗口或者帧中打开 -->

Location tag:

<a name="">

Generally used on pages. When the page content is too long, positioning markers are more convenient than drag strips.

Positioning tags are only effective when used in combination with hyperlinks.

[code]<a name="标记">标记位置</a>
<p>....<!-- 很多空行以制造网页过长的效果 -->
<a href="#标记">返回标记位置</a>
<!-- 使用标记时一定在href值的开始加入#标记名 -->
[code]<!DOCTYPE html> 
<html> 
<head>   
<meta charset="utf-8">   
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame         
Remove this if you use the .htaccess -->   
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">   
<title>link</title> 
</head> 
<body>     
<!--         
超链接:         
作用:连接资源         
当有了href属性才有了点击效果。         
hred属性值的不同,解析方式也不一样。         
解析时,如果该值没有指定过任何协议,按照默认的协议来解析该值的。默认协议是file协议    
-->     
<a name="top">顶部位置</a>     
<hr/>     
<a href="http://www.sina.com.cn" target="_blank">新浪网站</a>     
<hr/>     
<a href="http://f.hiphotos.baidu.com/image/h%3D200/sign=97adfa3549fbfbedc359317f48f0f78e/8b13632762d0f7035c8dfed60afa513d2697c5f9.jpg">美女图片</a>     
<hr/>     
<a href="mailto:luoshunxiang@adflash.cn">联系我</a>     
<hr/>     
<a href="http://www.xunlei.com/moves/mgdz.rmvb">美国队长</a> <br/>     
<a href="thunder://askjdhwudhkjasfkjdhsff==">美国队长</a>     
<hr/>     
<!--         
取消超链接默认点击效果,自定义点击效果     
-->     
<a href="javascript:void(0)" onclick="alert(&#39;我弹&#39;)">这是一个超链接</a>     
<hr/>        
<!--         
定位标记         
专业术语:锚     
-->     
<a name="center">中间位置</a>        
<hr/>     
<img  src="/static/imghwm/default1.png"  data-src="a.jpg"  class="lazy"      style="max-width:90%"  style="max-width:90%" border=10/ alt="Html learning (5) - hyperlinks" >     
<hr/>     
<hr/>     
<img  src="/static/imghwm/default1.png"  data-src="a.jpg"  class="lazy"      style="max-width:90%"  style="max-width:90%" border=10/ alt="Html learning (5) - hyperlinks" >     
<hr/>     
<a href="#center">回到中间位置</a>     
<a href="#top">回到顶部位置</a> 
</body> 
</html>

The above is the content of Html learning (5) - hyperlink. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

How do you insert an image into an HTML page?How do you insert an image into an HTML page?May 04, 2025 am 12:02 AM

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

HTML's Purpose: Enabling Web Browsers to Display ContentHTML's Purpose: Enabling Web Browsers to Display ContentMay 03, 2025 am 12:03 AM

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

Why are HTML tags important for web development?Why are HTML tags important for web development?May 02, 2025 am 12:03 AM

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.

Explain the importance of using consistent coding style for HTML tags and attributes.Explain the importance of using consistent coding style for HTML tags and attributes.May 01, 2025 am 12:01 AM

A consistent HTML encoding style is important because it improves the readability, maintainability and efficiency of the code. 1) Use lowercase tags and attributes, 2) Keep consistent indentation, 3) Select and stick to single or double quotes, 4) Avoid mixing different styles in projects, 5) Use automation tools such as Prettier or ESLint to ensure consistency in styles.

How to implement multi-project carousel in Bootstrap 4?How to implement multi-project carousel in Bootstrap 4?Apr 30, 2025 pm 03:24 PM

Solution to implement multi-project carousel in Bootstrap4 Implementing multi-project carousel in Bootstrap4 is not an easy task. Although Bootstrap...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.