更新: 2021-06-15

游览器 href 和 base href 绝对路径和相对路径

在没有 base href 的情况下

href="/about.html" 就是从 domain 开始走起, 算是绝对路径

href="../about.html" 往上走的相对路径

href="./about.html" 往 sibling 走的相对路径

href="detail.html" 往下走的相对路径

有时候 ./ 感觉不灵是因为我们经常用 folder + index.html 所以它看上去是 /about/ 但其实是 /about/index.html, 如果想去 contact 那么就得 ../ 而不是 ./, ./ 只能去到 index.html 的 sibling file (如果是 /about <-- 没有 end with / 就 ok )

有了 base href 之后, 所有相对路径都收到影响. 绝对路径没影响.

本来相对路径是对着当前的 path, 有了 base 之后就对着 base.

https://stackoverflow.com/questions/1889076/what-are-the-recommendations-for-html-base-tag

base href 常用来做 prefix 语言

记入一些偶尔会用到的基础知识.

1. blur mousedown click

比如有一个 input 和一个 button

绑定 input blur, button mousedown, click

首先 focus input 然后点击 button

触发顺序是 button mousedown -> input blur -> button click

如果我们在 input blur 的事件中把 button element remove 掉, 那么 button click 事件就不会触发了.

2. 空格是 &nbsp;

<span>a</span>
<span>a</span>

空行自带空格,

html4,5 basic的更多相关文章

  1. hbuilder中的 http://www.w3.org/TR/html4/loose.dtd

    <!-- This is the HTML 4.01 Transitional DTD, which includes presentation attributes and elements ...

  2. hbuilder中的 http://www.w3.org/TR/html4/strict.dtd

    <!-- This is HTML 4.01 Strict DTD, which excludes the presentation attributes and elements that W ...

  3. Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结

    Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...

  4. Basic Tutorials of Redis(9) -First Edition RedisHelper

    After learning the basic opreation of Redis,we should take some time to summarize the usage. And I w ...

  5. Basic Tutorials of Redis(8) -Transaction

    Data play an important part in our project,how can we ensure correctness of the data and prevent the ...

  6. Basic Tutorials of Redis(7) -Publish and Subscribe

    This post is mainly about the publishment and subscription in Redis.I think you may subscribe some o ...

  7. Basic Tutorials of Redis(6) - List

    Redis's List is different from C#'s List,but similar with C#'s LinkedList.Sometimes I confuse with t ...

  8. Basic Tutorials of Redis(5) - Sorted Set

    The last post is mainly about the unsorted set,in this post I will show you the sorted set playing a ...

  9. Basic Tutorials of Redis(4) -Set

    This post will introduce you to some usages of Set in Redis.The Set is a unordered set,it means that ...

  10. Basic Tutorials of Redis(3) -Hash

    When you first saw the name of Hash,what do you think?HashSet,HashTable or other data structs of C#? ...

随机推荐

  1. Vue bug from backend

    一个后端引发前端的BUG 使用的框架是vue 代码里面有一个组件 <table :data="data"/> 获取后台数据 this.data = await fetc ...

  2. oeasy教您玩转vim - 44 - # 综合练习

    ​ 综合练习 回忆上节课内容 上次我们学到了各种的替换模式 r,替换当前光标的字符 R,进入替换模式 ~,改变大小写 这次来个综合练习吧! 我们这次要完成这样一个任务 我们有的时候需要写日志 Syst ...

  3. locust多进程实现分布式压测遇到的问题

    多进程分布式的实现: locust分布式时,需借助命令locust 一个一个启动worker,在使用中有点繁琐, 下面借助于多进程,按既定worker数量,一键启动: from locust impo ...

  4. vscode添加python文件头模板

    pycharm可以自动生成python的文件头模板,但是vscode目前还不可以(不支持python,c的似乎有插件支持了).琢磨了一下,可以通过用户代码片段来实现. 1. 什么是用户代码片段 参考文 ...

  5. 【JavaScript】前端算法题(重建二叉树、反向输出链表每个节点)

    前言 今天复习了一些前端算法题,写到一两道比较有意思的题:重建二叉树.反向输出链表每个节点 题目 重建二叉树: 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的前序遍历和中序遍历的 ...

  6. docker 容器挂载技术

    创建和使用桥接网络 docker network create --driver bridge --subnet 192.168.13.0/24 --gateway 192.168.13.1 mqyn ...

  7. ComfyUI插件:ComfyUI layer style 节点(四)

    前言: 学习ComfyUI是一场持久战,而ComfyUI layer style 是一组专为图片设计制作且集成了Photoshop功能的强大节点.该节点几乎将PhotoShop的全部功能迁移到Comf ...

  8. 搞IT的为什么不建议搞底层(操作系统、编译器、编程语言)——当你搬进你的新家之后,你会在意这个楼是谁打的地基吗?—— 要站在钱流动的地方

    文字表达引自:https://www.youtube.com/watch?v=KITqGv1qYg8 当你搬进你的新家之后,你会在意这个楼是谁打的地基吗?你猜猜那些打地基的工人赚多少钱,卖你沙发电视机 ...

  9. 【转载】 【树莓派】为Ubuntu Mate for ARM 更换中国软件源

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/wr132/article/details ...

  10. 经典视频分享:Machine Learning: A New ICE (Identification, Control, Estimation) Age ? —— 自动控制和人工智能的结合前景

    机器学习作为近几年兴起的学科,虽然他诞生的时间已经而久远了,但是真正走进人们视野也就是这几年的事情. 机器学习领域本身只有强化学习这个分支和控制类是天然关联的,因此近几年国内的知名高校的强化学习研究者 ...