HTML常用知识
图
HTML的全称为超文本标记语言,是一种标记语言,它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体

头部icon写法

<link rel="shortcut icon" href="图片url">

http转https

网页中的链接需要都转为https请求,并且数据是动态的情况处理方式

<!--指定该网页中http转https访问-->
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

a标签打开方式

// 语法
<a target="_blank"></a>

可选值:

  • _blank:新窗口打开
  • _self:在相同的框架中打开,默认
  • _parent:父框架中打开
  • _top:在整个窗口中打开
  • framename:在指定的框架中打开

textarea禁止拖拽

<textarea style="resize:none;"></textarea>

文字禁止选中

<div onselectstart="return false">

</div>

css方式

/* 禁止选中 */
user-select: none;

关闭输入框红色波浪线

<textarea spellcheck="false"></textarea>

contenteditable属性同样有效

svg的引入方式

<p><img src="/lib/svg/wechat-fill.svg" alt=""></p>
<p><object id="object" data="/lib/svg/wechat-fill.svg" type="image/svg+xml"></object></p>
<p><embed id="embed" src="/lib/svg/wechat-fill.svg" type="image/svg+xml"></p>

svg颜色跟随父容器调节

关键代码:fill="currentColor"

<svg t="1661761707943" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
  p-id="12758" width="16" height="16">
  <path d="M101.188 406.2l248.169 184.115 266.799-181.721-178.15 270.229L624.188 929.2l304.7-828.5z"
    p-id="12759" fill="currentColor"></path>
</svg>