Java教程

6 a元素

本文主要是介绍6 a元素,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

a元素

超链接

href属性

hyper reference: 表示跳转地址

  1. 普通链接(跳转地址),需要写全,如“https://www.baidu.com/”

  2. 锚链接(跳转某个锚点),如目录,转转时该页面不会刷新

    • id属性:全局属性,表示元素在文档中的唯一编号
    <!--content-->
    <!--a[href='#chapter$']>{section$}*6-->
    <a href="#chapter1">section1</a>
    <a href="#chapter2">section2</a>
    <a href="#chapter3">section3</a>
    <a href="#chapter4">section4</a>
    <a href="#chapter5">section5</a>
    <a href="#chapter6">section6</a>
    
    <!--换种方式简写:(h2>{section})+p>lorem1000-->
    <!--((h2[id='chapter$']>{section$})+p>lorem10)*6-->
    <!--h和p一定要加括号分开,否则生成的p就是以二级标题的形式出现了-->
    <!--生成乱数时可以多生成一些,不然在实现目录跳转时不容易观察到效果-->
    <h2 id="chapter1">section1</h2>
    <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Placeat, eum?</p>
    <h2 id="chapter2">section2</h2>
    <p>Expedita nulla assumenda eveniet beatae eligendi non temporibus laudantium perspiciatis.</p>
    <h2 id="chapter3">section3</h2>
    <p>Voluptatibus voluptatum fuga impedit possimus molestias tenetur officiis, deserunt facere?</p>
    <h2 id="chapter4">section4</h2>
    <p>Sit illum rem odio est praesentium nisi saepe explicabo minima!</p>
    <h2 id="chapter5">section5</h2>
    <p>Iste blanditiis accusantium omnis voluptates, inventore illo explicabo error qui?</p>
    <h2 id="chapter6">section6</h2>
    <p>Cumque quasi corrupti voluptas assumenda nobis, provident impedit incidunt. Necessitatibus?</p>
    
  3. 功能链接(点击后触发某个功能)

    • 执行js代码,javascript:
    • 发送邮件, mailto:要求用户计算机上安装有邮件发送软件,exchange
    • 拨号,tel:要求用户计算机上安装拨号软件或者在手机端操作

target属性

表示跳转窗口位置

  1. target的取值:

    • _self:在当前页面窗口中打开,默认值
    • _blank :在新窗口中打开
这篇关于6 a元素的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!