zoukankan      html  css  js  c++  java
  • 测开之路八十七:HTML之a标签的用法

    初始化的HTML结构为,只需要在body里面加网页的标签和要显示的内容即可

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>page01</title>
    </head>
    <body>

    </body>
    </html>

    如:加个a标签,链接到外部资源

    <h1>a标签为超链接</h1>
    <!-- target="_blank" 在新标签中打开 -->
    <a href="https://www.baidu.com/" target="_blank">百度</a>

    链接到本地资源

    <!-- 链接到本地资源 ../上一级-->
    <a href="../page-02.html" target="_blank">去page02</a>

    标签关联:点击问题一,跳转到问题一的答案 #id

    <!-- 点击问题一,跳转到问题一的答案 #id-->
    <a href="#as01" style="color: blue">问题一</a>
    <p id="as01">问题一的答案</p>

    浏览器不能解析的资源自动为下载链接

    <!-- 浏览器不能解析的资源自动为下载链接 -->
    <a href="../new1.zip">点击下载new1</a>

    a标签自动连接到head的base的链接

      <base href="https://www.baidu.com/" target="_blank">
    </head>
    <body>

      <!-- href="contact.html" 会自动连接到上面head的base的链接 -->
      <a href="contact.html">联系我们</a>

    a标签自动连接到head的base的链接

      <base href="https://www.baidu.com/" target="_blank">
    </head>
    <body>
      <!-- href="contact.html" 会自动连接到上面的base的链接 -->
      <a href="contact.html">联系我们</a>

    返回顶端

    <a href="#">返回顶端</a>

     

    
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>page01</title>
    <base href="https://www.baidu.com/" target="_blank">
    </head>
    <body>
    <!-- href="contact.html" 会自动连接到上面的base的链接 -->
    <a href="contact.html">联系我们</a>

    <p>

    </p>

    <!-- href="contact.html" 会自动连接到上面head的base的链接 -->
    <a href="contact.html">联系我们</a>

    <p> </p>
    <!-- 浏览器不能解析的资源自动为下载链接 -->
    <a href="../new1.zip">点击下载new1</a>

    <p> </p>
    <!-- 点击问题一,跳转到问题一的答案 #id-->
    <a href="#as01" style="color: blue">问题一</a>
    <p id="as01">问题一的答案</p>

    <!-- 链接到本地资源 ../上一级-->
    <a href="../page-02.html" target="_blank">去page02</a>

    <h1>a标签为超链接</h1>
    <!-- target="_blank" 在新标签中打开 -->
    <a href="https://www.baidu.com/" target="_blank">百度</a>

    <a href="#">返回顶端</a>

    </body>
    </html>
  • 相关阅读:
    Java获取Linux系统cpu使用率
    jsoup 提取 html 中的所有链接、图片和媒体
    使用Spring定时任务并且通过AOP监控任务执行情况
    MySQL导出数据库、数据库表结构、存储过程及函数【用】
    linux下部署一个JavaEE项目的简单步骤
    MySQL 错误日志(Error Log)
    linux下程序JDBC连接不到mysql数据库
    linux下mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法
    Spring Boot的核心
    项目中菜单折叠问题
  • 原文地址:https://www.cnblogs.com/zhongyehai/p/11397318.html
Copyright © 2011-2022 走看看