html4,5 basic

更新: 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>

空行自带空格, 

 

posted @ 2020-02-12 17:36  兴杰  阅读(119)  评论(0)    收藏  举报