<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>COOLGuysneverSleep</title>
  
  
  <link href="http://babytoast.shop/atom.xml" rel="self"/>
  
  <link href="http://babytoast.shop/"/>
  <updated>2022-11-14T08:26:56.340Z</updated>
  <id>http://babytoast.shop/</id>
  
  <author>
    <name>NENEIIII</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title></title>
    <link href="http://babytoast.shop/uncategorized/web3/5%E5%A6%82%E4%BD%95%E9%83%A8%E7%BD%B2%E5%88%B0testnet/"/>
    <id>http://babytoast.shop/uncategorized/web3/5%E5%A6%82%E4%BD%95%E9%83%A8%E7%BD%B2%E5%88%B0testnet/</id>
    <published>2023-05-17T07:08:16.483Z</published>
    <updated>2022-11-14T08:26:56.340Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css">]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;</summary>
    
    
    
    
  </entry>
  
  <entry>
    <title>量化 概念先导</title>
    <link href="http://babytoast.shop/%E9%87%8F%E5%8C%96/Quant/%E6%A6%82%E5%BF%B5%E5%85%88%E5%AF%BC/"/>
    <id>http://babytoast.shop/%E9%87%8F%E5%8C%96/Quant/%E6%A6%82%E5%BF%B5%E5%85%88%E5%AF%BC/</id>
    <published>2023-04-20T02:05:34.000Z</published>
    <updated>2023-04-23T07:05:20.242Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p>简单来讲：量化投资就是利用计算机科技并采用一定的数学模型去实现投资理念、实现投资策略的过程<br>—-传统的投资方法主要有基本面分析法和技术分析法</p><ul><li>国内量化投资起步：2009年</li><li>是一种主动投资</li><li>理论基础：市场是无效的/弱有效</li></ul><p>理论变迁—</p><ul><li>有效市场假说EMH—在功能齐全、信息畅通的资本市场中，任何用历史价格及其他信息来预测证券价格的行为都是徒劳</li><li>期权定价模型</li><li>套利定价理论APT</li><li>VaR风险管理模型</li><li>行为金融学—吸收心理学，分析与有效市场理论不相符合的异常现象</li><li><strong>非线性技术</strong></li></ul><p><strong>—–</strong><br><strong>为何要用量化策略投资A股—A股市场就不是特别有效的市场，</strong>量化投资策略正好可以发挥其纪律性、系统性、及时性、准确性、分散化的优点而捕获国内市场的各种投资机会</p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;简单来讲：量化投资就是利用计算机科技并采用一定的数学模型去实现投资理念、实现投资策略的过程&lt;br&gt;—-传统的投资方法主要有基本面分析法和技术分析法&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;国内量化投资起步：2009年&lt;/li&gt;
&lt;li&gt;是一种主动投资&lt;/li&gt;
&lt;li&gt;理论基础：市场是无效的/弱有效&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;理论变迁—&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;有效市场假说EMH—在功能齐全、信息畅通的资本市场中，任何用历史价格及其他信息来预测证券价格的行为都是徒劳&lt;/li&gt;
&lt;li&gt;期权定价模型&lt;/li&gt;
&lt;li&gt;套利定价理论APT&lt;/li&gt;
&lt;li&gt;VaR风险管理模型&lt;/li&gt;
&lt;li&gt;行为金融学—吸收心理学，分析与有效市场理论不相符合的异常现象&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;非线性技术&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;—–&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;为何要用量化策略投资A股—A股市场就不是特别有效的市场，&lt;/strong&gt;量化投资策略正好可以发挥其纪律性、系统性、及时性、准确性、分散化的优点而捕获国内市场的各种投资机会&lt;/p&gt;
</summary>
    
    
    
    <category term="量化" scheme="http://babytoast.shop/categories/%E9%87%8F%E5%8C%96/"/>
    
    
    <category term="读书笔记" scheme="http://babytoast.shop/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/"/>
    
    <category term="量化" scheme="http://babytoast.shop/tags/%E9%87%8F%E5%8C%96/"/>
    
  </entry>
  
  <entry>
    <title>量化选股</title>
    <link href="http://babytoast.shop/%E9%87%8F%E5%8C%96/Quant/%E9%87%8F%E5%8C%96%E9%80%89%E8%82%A1/"/>
    <id>http://babytoast.shop/%E9%87%8F%E5%8C%96/Quant/%E9%87%8F%E5%8C%96%E9%80%89%E8%82%A1/</id>
    <published>2023-04-20T01:54:15.000Z</published>
    <updated>2023-04-23T07:07:04.576Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h2 id="采用数量的方法判断某个公司是否值得买入"><a href="#采用数量的方法判断某个公司是否值得买入" class="headerlink" title="采用数量的方法判断某个公司是否值得买入"></a>采用数量的方法判断某个公司是否值得买入</h2><p>【主要思路】<br>公司估值—比较理论股票价格与市场价格差异，找出被低估或高估的股票<br>趋势法—根据市场<strong>强势、弱势、盘整</strong>等形态作出对应投资行为<br>资金法—追随市场主力资金的方向（资金流入价格上涨|资金流出价格下跌）</p><hr><h1 id="基本面选股"><a href="#基本面选股" class="headerlink" title="基本面选股"></a>基本面选股</h1><p><a href="file:///E:/量化投资/基本面选股/多因子模型.md">多因子模型</a>–最常用，采用一系列因子作为标准，满足则买入不满足则卖出</p><p><a href="file:///E:/量化投资/基本面选股/风格轮动模型.md">风格轮动模型</a>—有时市场偏好小盘股有时偏好大盘股</p><p><a href="file:///E:/量化投资/基本面选股/行业轮动模型.md">行业轮动模型</a>–类似风格轮动(市场)，对轮动的行业进行配置比买入持有更有效</p><h1 id="市场行为选股"><a href="#市场行为选股" class="headerlink" title="市场行为选股"></a>市场行为选股</h1><p><a href="file:///E:/量化投资/市场行为选股/资金流模型.md">资金流模型</a>—将资金流入流出编成指标，判断未来一段时间股票涨跌</p><p><a href="file:///E:/量化投资/市场行为选股/动量反转模型.md">动量反转模型</a>–股票强弱变化情况</p><blockquote><p>动量效应：过去一段强，未来一段继续保持</p></blockquote><blockquote><p>反转效应：过去一段强，未来一段会走弱</p></blockquote><blockquote><p>判定是动量效应持续还是反转</p></blockquote><p><a href="file:///E:/量化投资/市场行为选股/一致预期模型.md">一致预期模型</a>、–利用大多数分析师的看法进行买入卖出</p><p><a href="file:///E:/量化投资/市场行为选股/趋势追踪模型.md">趋势追踪模型</a>–根据判断趋势的指标追涨杀跌（MA EMA MACD）</p><p><a href="file:///E:/量化投资/市场行为选股/筹码选股模型.md">筹码选股模型</a>–根据筹码分布和变动预判股票未来是上涨还是跌</p><blockquote><p>如果主力资金要拉升一支股票，会慢慢收集筹码，如果主力资金要卖出一支股票，则会慢慢分派筹码</p></blockquote><h1 id="量化选股的评价指标"><a href="#量化选股的评价指标" class="headerlink" title="量化选股的评价指标"></a>量化选股的评价指标</h1><p>收益率</p><p>风险指数</p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h2 id=&quot;采用数量的方法判断某个公司是否值得买入&quot;&gt;&lt;a href=&quot;#采用数量的方法判断某个公司是否值得买入&quot; class=&quot;headerlink&quot; title=&quot;采用数量的方法判断某个公司是否值得买入&quot;&gt;&lt;/a&gt;采用数量的方法判断某个公司是否值得买入&lt;/h2&gt;&lt;p&gt;【主要思路】&lt;br&gt;公司估值—比较理论股票价格与市场价格差异，找出被低估或高估的股票&lt;br&gt;趋势法—根据市场&lt;strong&gt;强势、弱势、盘整&lt;/strong&gt;等形态作出对应投资行为&lt;br&gt;资金法—追随市场主力资金的方向（资金流入价格上涨|资金流出价格下跌）&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;基本面选股&quot;&gt;&lt;a href=&quot;#基本面选股&quot; class=&quot;headerlink&quot; title=&quot;基本面选股&quot;&gt;&lt;/a&gt;基本面选股&lt;/h1&gt;&lt;p&gt;&lt;a href=&quot;file:///E:/量化投资/基本面选股/多因子模型.md&quot;&gt;多因子模型&lt;/a&gt;–最常用，采用一系列因子作为标准，满足则买入不满足则卖出&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;file:///E:/量化投资/基本面选股/风格轮动模型.md&quot;&gt;风格轮动模型&lt;/a&gt;—有时市场偏好小盘股有时偏好大盘股&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;file:///E:/量化投资/基本面选股/行业轮动模型.md&quot;&gt;行业轮动模型&lt;/a&gt;–类似风格轮动(市场)，对轮动的行业进行配置比买入持有更有效&lt;/p&gt;
&lt;h1 id=&quot;市场行为选股&quot;&gt;&lt;a href=&quot;#市场行为选股&quot; class=&quot;headerlink&quot; title=&quot;市场行为选股&quot;&gt;&lt;/a&gt;市场行为选股&lt;/h1&gt;&lt;p&gt;&lt;a href=&quot;file:///E:/量化投资/市场行为选股/资金流模型.md&quot;&gt;资金流模型&lt;/a&gt;—将资金流入流出编成指标，判断未来一段时间股票涨跌&lt;/p&gt;</summary>
    
    
    
    <category term="量化" scheme="http://babytoast.shop/categories/%E9%87%8F%E5%8C%96/"/>
    
    
    <category term="读书笔记" scheme="http://babytoast.shop/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/"/>
    
    <category term="量化" scheme="http://babytoast.shop/tags/%E9%87%8F%E5%8C%96/"/>
    
  </entry>
  
  <entry>
    <title>《量化投资：策略与技术》读书笔记</title>
    <link href="http://babytoast.shop/%E9%87%8F%E5%8C%96/Quant/%E9%87%8F%E5%8C%96%E6%8A%95%E8%B5%84/"/>
    <id>http://babytoast.shop/%E9%87%8F%E5%8C%96/Quant/%E9%87%8F%E5%8C%96%E6%8A%95%E8%B5%84/</id>
    <published>2023-04-19T12:10:26.000Z</published>
    <updated>2023-04-23T07:03:35.730Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><em><u>—其实是本书大纲</u></em><br><strong>【策略篇】</strong><br><strong>判断趋势型</strong>—趋势向上则做多，趋势向下则做空(高抛低吸)<br><a href="onenote:#量化选股&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={8531C8B9-3718-4CBF-903E-B11925DB7901}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">量化选股</a></p><p><a href="onenote:#量化择时&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={D62E1053-F6DE-4F5E-B89E-32D0075C98E1}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">量化择时</a><br><strong>判断波动率型</strong>—<u>套利</u>【通过在不同市场上买入和卖出同一资产以利用市场价格差异，从而赚取风险较小的利润。例如，如果某个商品在两个市场上的价格不同，买入价格低的市场，并在价格高的市场上卖出，获得利润】<br><a href="onenote:#股指期货套利&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={5BFF3620-B0A8-4B12-B7D9-499D2F3A9CD4}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">股指期货套利</a>—在股票和股指期货之间的对冲操作</p><p><a href="onenote:#商品期货&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={85643326-9837-422C-95ED-27D90CDD5907}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">商品期货</a>—在不同的期货品种之间</p><p><a href="onenote:#统计套利&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={6433549A-3967-47D7-A64A-86B1F55EDE87}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">统计套利</a>—在有相关性的品种之间</p><p><a href="onenote:#期权套利&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={DC630C63-D2E7-42C6-BBBA-8E9F9E628B5F}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">期权套利</a>—在看涨看跌期权之间的对冲</p><p><strong>降低冲击成本</strong>—买卖订单本身对市场都是有影响的，会降低投资者的收益率<br><a href="onenote:#被动交易算法&section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&page-id={5AB4D642-394E-491E-BDD7-B5F2781EAE2C}&end&base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one">被动交易算法</a></p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;em&gt;&lt;u&gt;—其实是本书大纲&lt;/u&gt;&lt;/em&gt;&lt;br&gt;&lt;strong&gt;【策略篇】&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;判断趋势型&lt;/strong&gt;—趋势向上则做多，趋势向下则做空(高抛低吸)&lt;br&gt;&lt;a href=&quot;onenote:#量化选股&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={8531C8B9-3718-4CBF-903E-B11925DB7901}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;量化选股&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;onenote:#量化择时&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={D62E1053-F6DE-4F5E-B89E-32D0075C98E1}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;量化择时&lt;/a&gt;&lt;br&gt;&lt;strong&gt;判断波动率型&lt;/strong&gt;—&lt;u&gt;套利&lt;/u&gt;【通过在不同市场上买入和卖出同一资产以利用市场价格差异，从而赚取风险较小的利润。例如，如果某个商品在两个市场上的价格不同，买入价格低的市场，并在价格高的市场上卖出，获得利润】&lt;br&gt;&lt;a href=&quot;onenote:#股指期货套利&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={5BFF3620-B0A8-4B12-B7D9-499D2F3A9CD4}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;股指期货套利&lt;/a&gt;—在股票和股指期货之间的对冲操作&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;onenote:#商品期货&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={85643326-9837-422C-95ED-27D90CDD5907}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;商品期货&lt;/a&gt;—在不同的期货品种之间&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;onenote:#统计套利&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={6433549A-3967-47D7-A64A-86B1F55EDE87}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;统计套利&lt;/a&gt;—在有相关性的品种之间&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;onenote:#期权套利&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={DC630C63-D2E7-42C6-BBBA-8E9F9E628B5F}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;期权套利&lt;/a&gt;—在看涨看跌期权之间的对冲&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;降低冲击成本&lt;/strong&gt;—买卖订单本身对市场都是有影响的，会降低投资者的收益率&lt;br&gt;&lt;a href=&quot;onenote:#被动交易算法&amp;section-id={7E95DD7E-3386-4C4B-85F6-A5D9ED328624}&amp;page-id={5AB4D642-394E-491E-BDD7-B5F2781EAE2C}&amp;end&amp;base-path=https://d.docs.live.net/bf620764616ba8b0/OneNote%20backups/Documents/每日快速笔记/投资理财.one&quot;&gt;被动交易算法&lt;/a&gt;&lt;/p&gt;
</summary>
    
    
    
    <category term="量化" scheme="http://babytoast.shop/categories/%E9%87%8F%E5%8C%96/"/>
    
    
    <category term="读书笔记" scheme="http://babytoast.shop/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/"/>
    
    <category term="量化" scheme="http://babytoast.shop/tags/%E9%87%8F%E5%8C%96/"/>
    
  </entry>
  
  <entry>
    <title>Django框架</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.xDjango/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.xDjango/</id>
    <published>2022-12-06T08:42:23.000Z</published>
    <updated>2023-05-17T07:11:23.776Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><a href="https://pythondjango.cn/django/basics/2-installation-use/">参考文档</a></p><h1 id="项目结构"><a href="#项目结构" class="headerlink" title="项目结构"></a>项目结构</h1><pre><code class="text">mysite/ # 根目录    manage.py # Django命令行工具    mysite/ # 项目配置目录        __init__.py # 空文件，告诉python这个目录是python包        settings.py # 项目配置文件        urls.py # 项目所有urls声明汇总        asgi.py # ASGI服务器的入口文件        wsgi.py # WSGI服务器的入口文件</code></pre><h1 id="软件开发模式"><a href="#软件开发模式" class="headerlink" title="软件开发模式"></a>软件开发模式</h1><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221128154838012.png" alt="image-20221128154838012"></p><p>==Django所采用的MVT 模型-视图-模板==</p><p>Django的MVT设计模式由Model(模型), View(视图) 和Template(模板)三部分组成，分别对应单个app目录下的models.py, views.py和templates文件夹。它们看似与MVC设计模式不太一致，其实本质是相同的。Django的MVT设计模式与经典的MVC对应关系如下。</p><ul><li><strong>Django Model(模型)</strong>: 这个与经典MVC模式下的模型Model差不多。</li><li><strong>Django View(视图)</strong>: 这个与MVC下的控制器Controller更像。视图不仅负责根据用户请求从数据库读取数据、指定向用户展示数据的方式(网页或json数据), 还可以指定渲染模板并处理用户提交的数据。</li><li><strong>Django Template(模板)</strong>: 这个与经典MVC模式下的视图View一致。模板用来呈现Django view传来的数据，也决定了用户界面的外观。Template里面也包含了表单，可以用来搜集用户的输入内容。</li></ul><p>Django MVT设计模式中最重要的是视图(view), 因为它同时与模型(model)和模板(templates)进行交互。当用户发来一个请求(request)时，Django会对请求头信息进行解析，解析出用户需要访问的url地址，然后根据路由urls.py中的定义的对应关系把请求转发到相应的视图处理。视图会从数据库读取需要的数据，指定渲染模板，最后返回响应数据。这个过程如下图所示：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221128155514275.png" alt="image-20221128155514275"></p><h1 id="报错及要点"><a href="#报错及要点" class="headerlink" title="报错及要点"></a>报错及要点</h1>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://pythondjango.cn/django/basics/2-installation-use/&quot;&gt;参考文档&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;项目结构&quot;&gt;&lt;a href=&quot;#项目结构&quot; class=&quot;headerlink&quot; title=&quot;项目结构&quot;&gt;&lt;/a&gt;项目结构&lt;/h1&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;mysite/ # 根目录
    manage.py # Django命令行工具
    mysite/ # 项目配置目录
        __init__.py # 空文件，告诉python这个目录是python包
        settings.py # 项目配置文件
        urls.py # 项目所有urls声明汇总
        asgi.py # ASGI服务器的入口文件
        wsgi.py # WSGI服务器的入口文件
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&quot;软件开发模式&quot;&gt;&lt;a href=&quot;#软件开发模式&quot; class=&quot;headerlink&quot; title=&quot;软件开发模式&quot;&gt;&lt;/a&gt;软件开发模式&lt;/h1&gt;&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221128154838012.png&quot; alt=&quot;image-20221128154838012&quot;&gt;&lt;/p&gt;
&lt;p&gt;==Django所采用的MVT 模型-视图-模板==&lt;/p&gt;
&lt;p&gt;Django的MVT设计模式由Model(模型), View(视图) 和Template(模板)三部分组成，分别对应单个app目录下的models.py, views.py和templates文件夹。它们看似与MVC设计模式不太一致，其实本质是相同的。Django的MVT设计模式与经典的MVC对应关系如下。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Django Model(模型)&lt;/strong&gt;: 这个与经典MVC模式下的模型Model差不多。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Django View(视图)&lt;/strong&gt;: 这个与MVC下的控制器Controller更像。视图不仅负责根据用户请求从数据库读取数据、指定向用户展示数据的方式(网页或json数据), 还可以指定渲染模板并处理用户提交的数据。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Django Template(模板)&lt;/strong&gt;: 这个与经典MVC模式下的视图View一致。模板用来呈现Django view传来的数据，也决定了用户界面的外观。Template里面也包含了表单，可以用来搜集用户的输入内容。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Django MVT设计模式中最重要的是视图(view), 因为它同时与模型(model)和模板(templates)进行交互。当用户发来一个请求(request)时，Django会对请求头信息进行解析，解析出用户需要访问的url地址，然后根据路由urls.py中的定义的对应关系把请求转发到相应的视图处理。视图会从数据库读取需要的数据，指定渲染模板，最后返回响应数据。这个过程如下图所示：&lt;/p&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
    <category term="Django" scheme="http://babytoast.shop/tags/Django/"/>
    
  </entry>
  
  <entry>
    <title>JS异步编程</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.14JS%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.14JS%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/</id>
    <published>2022-11-25T08:42:23.000Z</published>
    <updated>2022-11-29T02:58:21.571Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h1 id="服务器"><a href="#服务器" class="headerlink" title="服务器"></a>服务器</h1><p>C/S架构</p><p>B/S架构</p><h2 id="使用-WampServer-搭建-HTTP服务"><a href="#使用-WampServer-搭建-HTTP服务" class="headerlink" title="使用 WampServer 搭建 HTTP服务"></a><a href="https://web.qianguyihao.com/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/00-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB%E5%8F%8APHP%E5%85%A5%E9%97%A8.html#wampserver-%E7%9A%84%E5%AE%89%E8%A3%85">使用 WampServer 搭建 HTTP服务</a></h2><h2 id="静态网站和动态网站"><a href="#静态网站和动态网站" class="headerlink" title="静态网站和动态网站"></a>静态网站和动态网站</h2><p>静态网站：</p><ul><li>访问的是实实在在保存在服务器上的文件。静态资源包括：html页面、css文件、js文件、图片等。</li><li>当内容、图片、界面需要更新时，直接修改.html文件。</li></ul><p>动态网站：</p><ul><li>当用户访问网站时，根据<code>某些逻辑</code>,动态生成对应的<code>HTML、CSS、JS</code>代码给用户（这也就是web服务器开发的本质）。</li><li>通过某种手段，当有新的消息时，<strong>自动</strong>的完成网站的更新。</li></ul><p>总结：</p><p>由于静态网站在维护的局限性，所以产生了动态网站。</p><p>实现动态网站的技术：php/jsp/.net/python等。</p><p>动态网站的原理：浏览器请求动态网站的页面（比如*.php），php拼接数据并动态生成html页面，然后将新生成的页面返回给浏览器</p><h1 id="PHP"><a href="#PHP" class="headerlink" title="PHP"></a>PHP</h1><p><a href="https://web.qianguyihao.com/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/00-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB%E5%8F%8APHP%E5%85%A5%E9%97%A8.html#php%E7%9A%84%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95">自己看</a></p><h1 id="异步"><a href="#异步" class="headerlink" title="异步"></a>异步</h1><p>JavaScript 语言和执行环境是<strong>单线程</strong>。即同一时间，只能处理一个任务。</p><ul><li>同步任务：在<strong>主线程</strong>上排队执行的任务。只有前一个任务执行完毕，才能执行下一个任务。</li><li>异步任务：不进入主线程、而是进入<strong>任务队列</strong>（Event Queue）的任务，该任务不会阻塞后面的任务执行。只有”任务队列”通知主线程，某个异步任务可以执行了，该任务才会进入主线程执行。</li></ul><p>==什么时候需要<strong>等待</strong>，就什么时候用异步==(因为需要等待的任务不能阻塞在主线程里)</p><ul><li>1、事件监听（比如说，按钮绑定点击事件之后，用户爱点不点。我们不可能卡在按钮那里，什么都不做。所以，应该用异步）</li><li>2、回调函数：<ul><li>2.1、定时器：setTimeout（定时炸弹）、setInterval（循环执行）</li><li>2.2、ajax请求。</li><li>2.3、Node.js 中的一些方法回调。</li></ul></li><li>3、ES6 中的 Promise、Generator、async/await</li></ul><h3 id="执行顺序"><a href="#执行顺序" class="headerlink" title="执行顺序"></a>执行顺序</h3><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20210517_1431.png" alt="img"></p><p>可以看到异步任务要在主线程执行完同步任务之后再进行（不管它本身需要等待多久）</p><h1 id="Ajax"><a href="#Ajax" class="headerlink" title="Ajax"></a>Ajax</h1><p>在浏览器中，我们可以在不刷新页面的情况下，通过 Ajax 的方式去获取一些新的内容。</p><p>Ajax：Asynchronous Javascript And XML（异步 JavaScript 和 XML）。它并不是凭空出现的新技术，而是对于现有技术的结合。Ajax 的核心是 js 对象：<strong>XMLHttpRequest</strong>。</p><p>发送 Ajax 请求的五个步骤：</p><p>（1）创建异步对象，即 XMLHttpRequest 对象。</p><p>（2）使用 open 方法设置请求参数。<code>open(method, url, async)</code>。参数解释：请求的方法、请求的 url、是否异步。第三个参数如果不写，则默认为 true。</p><p>（3）发送请求：<code>send()</code>。</p><p>（4）注册事件：注册 onreadystatechange 事件，状态改变时就会调用。</p><p>如果要在数据完整请求回来的时候才调用，我们需要手动写一些判断的逻辑。</p><p>（5）服务端响应，获取返回的数据。</p><h2 id="jQuery-中的-Ajax"><a href="#jQuery-中的-Ajax" class="headerlink" title="jQuery 中的 Ajax"></a>jQuery 中的 Ajax</h2><p>JQuery 作为最受欢迎的 js 框架之一，常见的 Ajax 已经帮助我们封装好了，只需要调用即可。更为详细的 api 文档可以查阅：<a href="http://www.w3school.com.cn/jquery/jquery_ref_ajax.asp">w3cSchool_JQueryAjax</a></p><p>格式举例：</p><pre><code class="javascript">$.ajax(&#123;    url: &#39;https://xxx.com/getUserInfo.php&#39;, // 接口的请求地址    data: &#39;name=fox&amp;age=18&#39;, // 请求参数    type: &#39;GET&#39;, //请求的方式    success: function (argument) &#123;        // 接口请求成功时调用        console.log(&#39;接口请求成功&#39;);    &#125;,    beforeSend: function (argument) &#123;&#125;, // 在发送请求之前调用,可以做一些验证之类的处理    error: function (argument) &#123;        // 接口请求失败时调用        console.log(&#39;接口请求失败&#39;);    &#125;,&#125;);</code></pre><h1 id="Promise"><a href="#Promise" class="headerlink" title="Promise"></a>Promise</h1><h1 id="宏任务-amp-微任务"><a href="#宏任务-amp-微任务" class="headerlink" title="宏任务&amp; 微任务"></a>宏任务&amp; 微任务</h1>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h1 id=&quot;服务器&quot;&gt;&lt;a href=&quot;#服务器&quot; class=&quot;headerlink&quot; title=&quot;服务器&quot;&gt;&lt;/a&gt;服务器&lt;/h1&gt;&lt;p&gt;C/S架构&lt;/p&gt;
&lt;p&gt;B/S架构&lt;/p&gt;
&lt;h2 id=&quot;使用-WampServer-搭建-HTTP服务&quot;&gt;&lt;a href=&quot;#使用-WampServer-搭建-HTTP服务&quot; class=&quot;headerlink&quot; title=&quot;使用 WampServer 搭建 HTTP服务&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://web.qianguyihao.com/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/00-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB%E5%8F%8APHP%E5%85%A5%E9%97%A8.html#wampserver-%E7%9A%84%E5%AE%89%E8%A3%85&quot;&gt;使用 WampServer 搭建 HTTP服务&lt;/a&gt;&lt;/h2&gt;&lt;h2 id=&quot;静态网站和动态网站&quot;&gt;&lt;a href=&quot;#静态网站和动态网站&quot; class=&quot;headerlink&quot; title=&quot;静态网站和动态网站&quot;&gt;&lt;/a&gt;静态网站和动态网站&lt;/h2&gt;&lt;p&gt;静态网站：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;访问的是实实在在保存在服务器上的文件。静态资源包括：html页面、css文件、js文件、图片等。&lt;/li&gt;
&lt;li&gt;当内容、图片、界面需要更新时，直接修改.html文件。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;动态网站：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;当用户访问网站时，根据&lt;code&gt;某些逻辑&lt;/code&gt;,动态生成对应的&lt;code&gt;HTML、CSS、JS&lt;/code&gt;代码给用户（这也就是web服务器开发的本质）。&lt;/li&gt;
&lt;li&gt;通过某种手段，当有新的消息时，&lt;strong&gt;自动&lt;/strong&gt;的完成网站的更新。&lt;/li&gt;
&lt;/ul&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
    <category term="Javascript" scheme="http://babytoast.shop/tags/Javascript/"/>
    
  </entry>
  
  <entry>
    <title>JS基础</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.13JS%E5%9F%BA%E7%A1%80/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.13JS%E5%9F%BA%E7%A1%80/</id>
    <published>2022-11-24T10:40:23.000Z</published>
    <updated>2022-11-26T08:04:24.418Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h1 id="基础部分"><a href="#基础部分" class="headerlink" title="基础部分"></a>基础部分</h1><h2 id="写在哪"><a href="#写在哪" class="headerlink" title="写在哪"></a>写在哪</h2><p>行内</p><pre><code class="javascript">&lt;input type=&quot;button&quot; value=&quot;点我点我&quot; onclick=&quot;alert(&#39;千古壹号 Hello 方式1&#39;)&quot; /&gt;</code></pre><p>内联</p><pre><code class="html">&lt;script type=&quot;text/javascript&quot;&gt;            // 在这里写 js 代码            alert(&#39;千古壹号 hello 方式2&#39;);            console.log(&#39;qianguyihao hello 方式2&#39;);        &lt;/script&gt;</code></pre><p><code>.js</code>文件中</p><pre><code class="html">&lt;body&gt;        &lt;!-- 外链式：引入外部的 js 文件：这个 utils.js 文件与当前的 html 文件，处于同一级目录 --&gt;        &lt;script src=&quot;utils.js&quot;&gt;&lt;/script&gt;    &lt;/body&gt;</code></pre><h2 id="区分大小写"><a href="#区分大小写" class="headerlink" title="区分大小写"></a>区分大小写</h2><h2 id="输出"><a href="#输出" class="headerlink" title="输出"></a>输出</h2><h3 id="弹窗"><a href="#弹窗" class="headerlink" title="弹窗"></a>弹窗</h3><pre><code class="html">&lt;script&gt;            alert(&#39;加载网页时显示&#39;);            var a = prompt(&quot;供用户输入用，多用于测试&quot;);            var res = confirm(&quot;用户需要点击确认或取消&quot;); //返回true或false        &lt;/script&gt;</code></pre><h3 id="输出至网页里"><a href="#输出至网页里" class="headerlink" title="输出至网页里"></a>输出至网页里</h3><pre><code class="javascript">document.write(&quot;HTML&quot;);</code></pre><h3 id="输出至控制台"><a href="#输出至控制台" class="headerlink" title="输出至控制台"></a>输出至控制台</h3><pre><code class="javascript">console.log();</code></pre><h2 id="变量"><a href="#变量" class="headerlink" title="变量"></a>变量</h2><p><button>ES5</button><code>var 变量名;</code></p><p><button>ES6</button><code>let 变量名;</code></p><h2 id="常量"><a href="#常量" class="headerlink" title="常量"></a>常量</h2><p><code>const 常量名 = 取值;</code></p><h2 id="代码块-只用来分组-在外部仍可访问内部变量"><a href="#代码块-只用来分组-在外部仍可访问内部变量" class="headerlink" title="代码块{}只用来分组 在外部仍可访问内部变量"></a>代码块{}只用来分组 在外部仍可访问内部变量</h2><h2 id="流程控制语句有if-有switch-有for-有while"><a href="#流程控制语句有if-有switch-有for-有while" class="headerlink" title="流程控制语句有if 有switch 有for 有while"></a>流程控制语句有if 有switch 有for 有while</h2><h2 id="面向对象"><a href="#面向对象" class="headerlink" title="面向对象"></a>面向对象</h2><p>==首先明确JS中的类型都可以看作是对象==【除<strong>基本数据类型（值类型）</strong>：String 字符串、Number 数值、Boolean 布尔值、Null 空值、Undefined 未定义】</p><pre><code class="javascript">var person = &#123;&#125;;person.name = &#39;王二&#39;;person.age = 35;person.sex = &#39;男&#39;;person.height = &#39;180&#39;;</code></pre><h3 id="创建对象"><a href="#创建对象" class="headerlink" title="创建对象"></a>创建对象</h3><pre><code class="javascript"> var obj = new Object();    obj.sayName = function () &#123;        console.log(&#39;smyhvae&#39;);    &#125;;</code></pre><pre><code class="javascript"> //创建对象 obj1    var obj1 = new Object();    obj1.test = undefined;    //创建对象 obj2    var obj2 = new Object();    obj2.name = &quot;smyhvae&quot;;    //将整个 obj2 对象，设置为 obj1 的属性    obj1.test = obj2;</code></pre><h3 id="内置对象"><a href="#内置对象" class="headerlink" title="内置对象"></a>内置对象</h3><p>除上面创建的自定义对象，还有内置对象和浏览器对象</p><table><thead><tr><th align="left">内置对象</th><th align="left">对象说明</th></tr></thead><tbody><tr><td align="left">Arguments</td><td align="left">函数参数集合</td></tr><tr><td align="left">Array</td><td align="left">数组</td></tr><tr><td align="left">Boolean</td><td align="left">布尔对象</td></tr><tr><td align="left">Math</td><td align="left">数学对象</td></tr><tr><td align="left">Date</td><td align="left">日期时间</td></tr><tr><td align="left">Error</td><td align="left">异常对象</td></tr><tr><td align="left">Function</td><td align="left">函数构造器</td></tr><tr><td align="left">Number</td><td align="left">数值对象</td></tr><tr><td align="left">Object</td><td align="left">基础对象</td></tr><tr><td align="left">RegExp</td><td align="left">正则表达式对象</td></tr><tr><td align="left">String</td><td align="left">字符串对象</td></tr></tbody></table><h4 id="常用方法"><a href="#常用方法" class="headerlink" title="常用方法"></a>常用方法</h4><p>==注意对字符串的修改都不是原地修改 会返回修改值==</p><p><code>indexOf()/lastIndexOf()：获取字符串中指定内容的索引</code></p><p><code>search()：获取字符串中指定内容的索引</code></p><p><code>includes()：字符串中是否包含指定的内容</code></p><p><code>startsWith()：字符串是否以指定的内容开头</code></p><p><code>endsWith()：字符串是否以指定的内容结尾</code></p><p><button>获取指定位置的字符</button></p><p>这里的 <code>str.charAt(index)</code>和<code>str[index]</code>的效果是一样的</p><p><button>字符串截取</button></p><pre><code class="javascript">新字符串 = str.slice(开始索引, 结束索引); //两个参数都是索引值。包左不包右。</code></pre><pre><code class="javascript">新字符串 = str.substring(开始索引, 结束索引); </code></pre><pre><code class="javascript">字符串 = str.substr(开始索引, 截取的长度);</code></pre><p><code>trim()</code>：去除字符串前后的空白。</p><p>字符串的方法估计不同语言有通用的 反正用到再查</p><h4 id="html-方法-用到查"><a href="#html-方法-用到查" class="headerlink" title="html 方法-用到查"></a>html 方法-用到查</h4><ul><li>anchor() 创建 a 链接</li><li>big()</li><li>sub()</li><li>sup()</li><li>link()</li><li>bold()</li></ul><p><button> Number.isInteger() 判断是否为整数</button></p><p><button>toFixed() 小数点后面保留多少位</button></p><p><button>内置Math的函数跟py差不多</button></p><p><code>Date对象</code></p><p>不传参返回当前时间对象</p><pre><code class="javascript">var date1 = new Date();console.log(date1);//Fri Nov 25 2022 14:11:11 GMT+0800 (中国标准时间)</code></pre><p>传参的情况</p><p>举例1：（参数是字符串）</p><pre><code class="js">const date11 = new Date(&#39;2020/02/17 21:00:00&#39;);console.log(date11); // Mon Feb 17 2020 21:00:00 GMT+0800 (中国标准时间)const date12 = new Date(&#39;2020/04/19&#39;); // 返回的就是四月console.log(date12); // Sun Apr 19 2020 00:00:00 GMT+0800 (中国标准时间)const date13 = new Date(&#39;2020-05-20&#39;);console.log(date13); // Wed May 20 2020 08:00:00 GMT+0800 (中国标准时间)const date14 = new Date(&#39;Wed Jan 27 2017 12:00:00 GMT+0800 (中国标准时间)&#39;);console.log(date14); // Fri Jan 27 2017 12:00:00 GMT+0800 (中国标准时间)</code></pre><p>举例2：（参数是多个数字）</p><pre><code class="js">const date21 = new Date(2020, 2, 18); // 注意，第二个参数返回的是三月，不是二月console.log(date21); // Wed Mar 18 2020 00:00:00 GMT+0800 (中国标准时间)const date22 = new Date(2020, 3, 18, 22, 59, 58);console.log(date22); // Sat Apr 18 2020 22:59:58 GMT+0800 (中国标准时间)const params = [2020, 06, 12, 16, 20, 59];const date23 = new Date(...params);console.log(date23); // Sun Jul 12 2020 16:20:59 GMT+0800 (中国标准时间)</code></pre><p>举例3：（参数是时间戳）</p><pre><code class="js">const date31 = new Date(1591950413388);console.log(date31); // Fri Jun 12 2020 16:26:53 GMT+0800 (中国标准时间)// 先把时间对象转换成时间戳，然后把时间戳转换成时间对象const timestamp = new Date().getTime();const date32 = new Date(timestamp);console.log(date32); // Fri Jun 12 2020 16:28:21 GMT+0800 (中国标准时间)</code></pre><p>日期格式化（用到自己查）</p><p>format():将时间对象转换为指定格式。</p><p><a href="https://www.cnblogs.com/tugenhua0707/p/3776808.html">参考链接</a></p><p>获取时间戳</p><pre><code class="js">// 方式一：获取 Date 对象的时间戳（最常用的写法）const timestamp1 = +new Date();console.log(timestamp1); // 打印结果举例：1589448165370// 方式二：获取 Date 对象的时间戳（较常用的写法）const timestamp2 = new Date().getTime();console.log(timestamp2); // 打印结果举例：1589448165370// 方式三：获取 Date 对象的时间戳const timestamp3 = new Date().valueOf();console.log(timestamp3); // 打印结果举例：1589448165370// 方式4：获取 Date 对象的时间戳const timestamp4 = new Date() * 1;console.log(timestamp4); // 打印结果举例：1589448165370// 方式5：获取 Date 对象的时间戳const timestamp5 = Number(new Date());console.log(timestamp5); // 打印结果举例：1589448165370</code></pre><p>上面这五种写法都可以获取任意 Date 对象的时间戳，最常见的写法是<strong>方式一</strong>，其次是方式二。</p><p>根据前面所讲的关于「时间戳」的概念，上方代码获取到的时间戳指的是：从 <code>1970年1月1日，0时0分0秒</code> 到现在所花费的总毫秒数。</p><h4 id="倒计时写法"><a href="#倒计时写法" class="headerlink" title="倒计时写法"></a>倒计时写法</h4><pre><code class="html">&lt;style&gt;    .countdown&#123;            width: 1210px;                margin: 200px auto;                color: red;                text-align: center;                font: 600 30px/30px &#39;simsun&#39;;        &#125;&lt;/style&gt;    &lt;div id=&quot;cd&quot; class=&quot;countdown&quot;&gt;&lt;/div&gt;            &lt;!-- 设置倒计时 --&gt;            &lt;!-- 设置一个定时器，每间隔1毫秒就自动刷新一次div的内容 --&gt;            &lt;!-- 核心算法：输入的时间戳减去当前的时间戳，就是剩余时间（即倒计时），然后转换成时分秒 --&gt;            &lt;script&gt;                var div = document.getElementById(&quot;cd&quot;);                var timer = setInterval(() =&gt; &#123;                    countDown(&#39;2022/11/25 21:00:00&#39;);                &#125;, 1);                function countDown(myTime) &#123;                    var nowTime = new Date();                    var future = new Date(myTime);                    var timeSum = future.getTime() - nowTime.getTime(); //获取时间差：发布会时间减去此刻的毫秒值                    var day = parseInt(timeSum / 1000 / 60 / 60 / 24); // 天                    var hour = parseInt((timeSum / 1000 / 60 / 60) % 24); // 时                    var minu = parseInt((timeSum / 1000 / 60) % 60); // 分                    var sec = parseInt((timeSum / 1000) % 60); // 秒                    var millsec = parseInt(timeSum % 1000); // 毫秒                    //细节处理：所有的时间小于10的时候，在前面自动补0，毫秒值要补双0（比如如，把 8 秒改成 08 秒）                    day = day &lt; 10 ? &#39;0&#39; + day : day; //day小于10吗？如果小于，就补0；如果不小于，就是day本身                    hour = hour &lt; 10 ? &#39;0&#39; + hour : hour;                    minu = minu &lt; 10 ? &#39;0&#39; + minu : minu;                    sec = sec &lt; 10 ? &#39;0&#39; + sec : sec;                    if (millsec &lt; 10) &#123;                        millsec = &#39;00&#39; + millsec;                    &#125; else if (millsec &lt; 100) &#123;                        millsec = &#39;0&#39; + millsec;                    &#125;                    // 兜底处理                    if (timeSum &lt; 0) &#123;                        div.innerHTML = &#39;距离下班还有00天00小时00分00秒000毫秒&#39;;                        clearInterval(timer);                        return;                    &#125;                    // 前端要显示的文案                    div.innerHTML = &#39;距离下班还有&#39; + day + &#39;天&#39; + hour + &#39;小时&#39; + minu + &#39;分&#39; + sec + &#39;秒&#39; + millsec + &#39;毫秒&#39;;                &#125;            &lt;/script&gt;</code></pre><h4 id="Moment-js"><a href="#Moment-js" class="headerlink" title="Moment.js"></a>Moment.js</h4><p>Moment.js 是一个轻量级的JavaScript时间库，我们可以利用它很方便地进行时间操作，提升开发效率。</p><h3 id="函数"><a href="#函数" class="headerlink" title="函数"></a>函数</h3><h4 id="定义"><a href="#定义" class="headerlink" title="定义"></a>定义</h4><pre><code class="javascript">function 函数名([形参1,形参2...形参N])&#123;  // 备注：语法中的中括号，表示“可选”    // 函数体语句&#125;</code></pre><pre><code class="javascript">const 变量名  = function([形参1,形参2...形参N])&#123;    语句....&#125;</code></pre><h4 id="调用"><a href="#调用" class="headerlink" title="调用"></a>调用</h4><pre><code class="javascript">// 写法1（最常用）函数名();// 写法2函数名.call();</code></pre><pre><code class="javascript">var obj = &#123;    a: &#39;qianguyihao&#39;,    fn2: function() &#123;        console.log(&#39;小奶包包，穿越自由!&#39;);    &#125;,&#125;;obj.fn2(); // 调用函数</code></pre><p>立即执行</p><pre><code class="javascript">(function() &#123;    console.log(&#39;我是立即执行函数&#39;);&#125;)();</code></pre><h4 id="fn-和-fn-的区别【重要】"><a href="#fn-和-fn-的区别【重要】" class="headerlink" title="fn() 和 fn 的区别【重要】"></a>fn() 和 fn 的区别【重要】</h4><ul><li><code>fn()</code>：调用函数。调用之后，还获取了函数的返回值。</li><li><code>fn</code>：函数对象。相当于直接获取了整个函数对象。</li></ul><h3 id="拷贝"><a href="#拷贝" class="headerlink" title="拷贝"></a>拷贝</h3><pre><code class="js">// 语法1obj2 = Object.assgin(obj2, obj1);// 语法2Object.assign(目标对象, 源对象1, 源对象2...);</code></pre><p>将 obj1 的值追加到 obj2 中。如果对象里的属性名相同，会被覆盖。</p><h3 id="正则表达式"><a href="#正则表达式" class="headerlink" title="正则表达式"></a>正则表达式</h3><pre><code class="javascript">//判断是否为手机号var phoneStr = &quot;13067890123&quot;;    var phoneReg = /^1[3-9][0-9]&#123;9&#125;$/;    console.log(phoneReg.test(phoneStr));</code></pre><pre><code class="javascript">    str = str.replace(/^\s*/, &quot;&quot;); //去除开头的空格    str = str.replace(/\s*$/, &quot;&quot;); //去除结尾的空格</code></pre><pre><code class="javascript">// 是否为电子邮件var emailReg = /^\w&#123;3,&#125;(\.\w+)*@[A-z0-9]+(\.[A-z]&#123;2,5&#125;)&#123;1,2&#125;$/;    var email = &quot;abchello@163.com&quot;;    console.log(emailReg.test(email));</code></pre><h2 id="DOM操作"><a href="#DOM操作" class="headerlink" title="DOM操作"></a>DOM操作</h2><h4 id="获取元素"><a href="#获取元素" class="headerlink" title="获取元素"></a>获取元素</h4><pre><code class="javascript">document.getElementById(&quot;box1&quot;);//用这个document.getElementsByTagName(&quot;div&quot;)[0];document.getElementsByClassName(&quot;hehe&quot;)[0];</code></pre><h4 id="操作元素"><a href="#操作元素" class="headerlink" title="操作元素"></a>操作元素</h4><h5 id="新增"><a href="#新增" class="headerlink" title="新增"></a>新增</h5><pre><code class="javascript">var para = document.createElement(&quot;p&quot;);var node = document.createTextNode(&quot;这是新段落&quot;);para.appendChild(node);var ele = document.getElementById(&quot;div1&quot;);ele.appendChild(para);</code></pre><h5 id="删除"><a href="#删除" class="headerlink" title="删除"></a>删除</h5><pre><code class="javascript">var parent = document.getElementById(&quot;div1&quot;);var child = document.getElementById(&quot;p1&quot;);parent.removeChild(child);</code></pre><h4 id="改变HTML"><a href="#改变HTML" class="headerlink" title="改变HTML"></a>改变HTML</h4><pre><code class="javascript">document.write(Date());//直接向HYML输出流写内容 不好用，不能定位到元素里面</code></pre><pre><code class="javascript">document.getElementById(id).innerHTML = &quot;&lt;h1&gt;一段新的html&lt;/h1&gt;&quot;;</code></pre><pre><code class="javascript">document.getElementById(id).attribute = &quot;新值&quot;;</code></pre><h4 id="改变CSS"><a href="#改变CSS" class="headerlink" title="改变CSS"></a>改变CSS</h4><pre><code class="html">&lt;button type=&quot;button&quot; onclick=&quot;document.getElementById(id).style.color = &#39;red&#39;&quot;&gt;    单机这里&lt;/button&gt;</code></pre><h4 id="绑定事件"><a href="#绑定事件" class="headerlink" title="绑定事件"></a>绑定事件</h4><p>常见的事件如下：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20180126_1553.png" alt="img"></p><pre><code class="html">&lt;script type=&quot;text/javascript&quot;&gt;    var div1 = document.getElementById(&quot;box1&quot;);    //绑定事件的第一种方式    div1.onclick = function () &#123;        alert(&quot;我是弹出的内容&quot;);    &#125;&lt;/script&gt;</code></pre><pre><code class="javascript">var div1 = document.getElementById(&quot;box1&quot;);    //绑定事件的第二种方式    div1.onclick = fn;   //注意，这里是fn，不是fn()。fn()指的是返回值。    //单独定义函数    function fn() &#123;        alert(&quot;我是弹出的内容&quot;);    &#125;</code></pre><pre><code class="html">&lt;div id=&quot;box1&quot; onclick=&quot;fn()&quot;&gt;&lt;/div&gt;</code></pre><h4 id="onload-amp-unonload"><a href="#onload-amp-unonload" class="headerlink" title="onload&amp;unonload"></a>onload&amp;unonload</h4><p><strong>当页面加载（文本和图片）完毕的时候，触发onload事件。</strong></p><p>有一点我们要知道：<strong>js的加载是和html同步加载的</strong>。因此，如果使用元素在定义元素之前，容易报错。这个时候，onload事件就能派上用场了，我们可以把使用元素的代码放在onload里，就能保证这段代码是最后执行。</p><h2 id="定时器"><a href="#定时器" class="headerlink" title="定时器"></a>定时器</h2><ul><li>setInterval()：循环调用。将一段代码，<strong>每隔一段时间</strong>执行一次。（循环执行）</li><li>setTimeout()：延时调用。将一段代码，等待一段时间之后<strong>再执行</strong>。（只执行一次）</li></ul><h2 id="jQuery"><a href="#jQuery" class="headerlink" title="jQuery"></a>jQuery</h2><p>JS的一个库(框架)，利用==CSS选择器==访问DOM对象，简化DOM操作</p><h3 id="引包"><a href="#引包" class="headerlink" title="引包"></a>引包</h3><pre><code class="html">&lt;head&gt;    &lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt; &lt;!--本地下载放到相同目录下--&gt;    &lt;!--利用CDN--&gt;    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js&quot;&gt;&lt;/script&gt;&lt;/head&gt;</code></pre><p><a href="https://learn.microsoft.com/en-us/aspnet/ajax/cdn/overview#jQuery_Releases_on_the_CDN_0">microsoft提供的CDN</a></p><h3 id="插件"><a href="#插件" class="headerlink" title="插件"></a>插件</h3><p>注意引包时要在jq的下面</p><pre><code class="html">&lt;script src=&quot;jquery-1.11.1.js&quot;&gt;&lt;/script&gt;    &lt;!--懒加载的使用。第一步：导包(必须在jquery库的下方）--&gt;    &lt;script src=&quot;jquery.lazyload.js&quot;&gt;&lt;/script&gt;</code></pre><h3 id="语法"><a href="#语法" class="headerlink" title="语法"></a>语法</h3><p><code>$(选择器).action()</code></p><pre><code class="javascript">$(this).hide() //隐藏当前元素$(&quot;p&quot;).hide() //隐藏所有段落$(&quot;.test&quot;).hide() //隐藏所有class=&quot;test&quot;的元素$(&quot;#test&quot;).hide() //隐藏所有id=&quot;test&quot;的元素</code></pre><h3 id="jQuery选择器"><a href="#jQuery选择器" class="headerlink" title="jQuery选择器"></a>jQuery选择器</h3><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20180204_2122.png" alt="img"></p><p>去看之前的CSS选择器章节</p><h3 id="常见事件"><a href="#常见事件" class="headerlink" title="常见事件"></a>常见事件</h3><ul><li>click(handler) 单击事件。</li><li>blur(handler) 失去焦点事件。</li><li>mouseenter(handler) 鼠标进入事件。</li><li>mouseleave(handler) 鼠标离开事件。</li><li>dbclick(handler) 双击事件。</li><li>change(handler) 改变事件，如：文本框值改变，下拉列表值改变等。</li><li>focus(handler) 获得焦点事件。</li><li>keydown(handler) 键盘按下事件</li></ul><h3 id="获取-获取内容"><a href="#获取-获取内容" class="headerlink" title="获取|获取内容"></a>获取|获取内容</h3><p><code>text();</code> 设置或返回所选元素的文本内容</p><p><code>html(); </code>设置或返回所选元素的内容（包含html标记）</p><p><code>val();</code> 设置或返回表单元素的值</p><pre><code class="javascript">$(&quot;#btn1&quot;).click(function()&#123;    alert(&quot;Text:&quot; + $(&quot;#text1&quot;).text());&#125;);</code></pre><pre><code class="javascript">$(&quot;#btn1&quot;).click(function()&#123;    alert(&quot;Text:&quot; + $(&quot;#text1&quot;).html(&quot;&lt;b&gt;Hello world!&lt;/b&gt;&quot;));&#125;);</code></pre><h3 id="遍历"><a href="#遍历" class="headerlink" title="遍历"></a>遍历</h3><p><del>自己查</del><br><button>祖先</button><br><button>后代</button><br><button>两个之间</button><br><button>同胞</button><br><button>指定</button></p><h3 id="常见模板"><a href="#常见模板" class="headerlink" title="常见模板"></a>常见模板</h3><h4 id="鼠标悬停-弹出下拉菜单"><a href="#鼠标悬停-弹出下拉菜单" class="headerlink" title="鼠标悬停 弹出下拉菜单"></a><a href="https://web.qianguyihao.com/04-JavaScript%E5%9F%BA%E7%A1%80/47-jQuery%E7%9A%84%E4%BB%8B%E7%BB%8D%E5%92%8C%E9%80%89%E6%8B%A9%E5%99%A8.html#%E4%B8%BE%E4%BE%8B1%EF%BC%9A%E9%BC%A0%E6%A0%87%E6%82%AC%E5%81%9C%E6%97%B6%EF%BC%8C%E5%BC%B9%E5%87%BA%E4%B8%8B%E6%8B%89%E8%8F%9C%E5%8D%95[%E9%87%8D%E8%A6%81]">鼠标悬停 弹出下拉菜单</a></h4><h4 id="鼠标悬停变色"><a href="#鼠标悬停变色" class="headerlink" title="鼠标悬停变色"></a><a href="https://web.qianguyihao.com/04-JavaScript%E5%9F%BA%E7%A1%80/47-jQuery%E7%9A%84%E4%BB%8B%E7%BB%8D%E5%92%8C%E9%80%89%E6%8B%A9%E5%99%A8.html#%E4%B8%BE%E4%BE%8B2%EF%BC%9A%E9%BC%A0%E6%A0%87%E6%82%AC%E5%81%9C%E6%97%B6%E5%8F%98%E8%89%B2">鼠标悬停变色</a></h4><h4 id="突出显示"><a href="#突出显示" class="headerlink" title="突出显示"></a><a href="https://web.qianguyihao.com/04-JavaScript%E5%9F%BA%E7%A1%80/47-jQuery%E7%9A%84%E4%BB%8B%E7%BB%8D%E5%92%8C%E9%80%89%E6%8B%A9%E5%99%A8.html#%E4%B8%BE%E4%BE%8B3%EF%BC%9A%E7%AA%81%E5%87%BA%E6%98%BE%E7%A4%BA">突出显示</a></h4><h4 id="手风琴效果"><a href="#手风琴效果" class="headerlink" title="手风琴效果"></a><a href="https://web.qianguyihao.com/04-JavaScript%E5%9F%BA%E7%A1%80/47-jQuery%E7%9A%84%E4%BB%8B%E7%BB%8D%E5%92%8C%E9%80%89%E6%8B%A9%E5%99%A8.html#%E4%B8%BE%E4%BE%8B4%EF%BC%9A%E6%89%8B%E9%A3%8E%E7%90%B4%E6%95%88%E6%9E%9C">手风琴效果</a></h4><h1 id="ES6新增"><a href="#ES6新增" class="headerlink" title="ES6新增"></a>ES6新增</h1><h2 id="箭头函数"><a href="#箭头函数" class="headerlink" title="箭头函数"></a>箭头函数</h2><p><code>(参数1, 参数2 ...) =&gt; &#123; 函数体 &#125;</code></p><p>写法 1、定义和调用函数：（传统写法）</p><pre><code class="javascript">function fn1(a, b) &#123;    console.log(&#39;haha&#39;);    return a + b;&#125;console.log(fn1(1, 2)); //输出结果：3</code></pre><p>写法 2、定义和调用函数：（ES6 中的写法）</p><pre><code class="javascript">const fn2 = (a, b) =&gt; &#123;    console.log(&#39;haha&#39;);    return a + b;&#125;;console.log(fn2(1, 2)); //输出结果：3</code></pre>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h1 id=&quot;基础部分&quot;&gt;&lt;a href=&quot;#基础部分&quot; class=&quot;headerlink&quot; title=&quot;基础部分&quot;&gt;&lt;/a&gt;基础部分&lt;/h1&gt;&lt;h2 id=&quot;写在哪&quot;&gt;&lt;a href=&quot;#写在哪&quot; class=&quot;headerlink&quot; title=&quot;写在哪&quot;&gt;&lt;/a&gt;写在哪&lt;/h2&gt;&lt;p&gt;行内&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;点我点我&amp;quot; onclick=&amp;quot;alert(&amp;#39;千古壹号 Hello 方式1&amp;#39;)&amp;quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;内联&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
            // 在这里写 js 代码
            alert(&amp;#39;千古壹号 hello 方式2&amp;#39;);
            console.log(&amp;#39;qianguyihao hello 方式2&amp;#39;);
        &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;.js&lt;/code&gt;文件中&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;body&amp;gt;
        &amp;lt;!-- 外链式：引入外部的 js 文件：这个 utils.js 文件与当前的 html 文件，处于同一级目录 --&amp;gt;
        &amp;lt;script src=&amp;quot;utils.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;区分大小写&quot;&gt;&lt;a href=&quot;#区分大小写&quot; class=&quot;headerlink&quot; title=&quot;区分大小写&quot;&gt;&lt;/a&gt;区分大小写&lt;/h2&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
    <category term="Javascript" scheme="http://babytoast.shop/tags/Javascript/"/>
    
  </entry>
  
  <entry>
    <title>Flex布局</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.12flex%E5%B8%83%E5%B1%80/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.12flex%E5%B8%83%E5%B1%80/</id>
    <published>2022-11-23T13:24:23.000Z</published>
    <updated>2022-11-23T13:24:59.786Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/13-CSS3%E5%B1%9E%E6%80%A7%EF%BC%9AFlex%E5%B8%83%E5%B1%80%E5%9B%BE%E6%96%87%E8%AF%A6%E8%A7%A3.html#%E5%89%8D%E8%A8%80">13-CSS3属性：Flex布局图文详解 | 千古前端图文教程 (qianguyihao.com)</a></p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/13-CSS3%E5%B1%9E%E6%80%A7%EF%BC%9AFlex%E5%B8%83%E5%B1%80%E5%9B%BE%E6%96%87%E8%AF%A6%E8%A7%A3.html#%E5%89%8D%E8%A8%80&quot;&gt;13-CSS3属性：Flex布局图文详解 | 千古前端图文教程 (qianguyihao.com)&lt;/a&gt;&lt;/p&gt;
</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.11CSS3_属性</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.11CSS3%E5%B1%9E%E6%80%A7/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.11CSS3%E5%B1%9E%E6%80%A7/</id>
    <published>2022-11-23T12:13:14.000Z</published>
    <updated>2022-11-23T13:18:09.973Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h2 id="文字阴影"><a href="#文字阴影" class="headerlink" title="文字阴影"></a>文字阴影</h2><pre><code class="css">p&#123;    text-shadow: 20px 27px 22px pink;    /*水平位移 垂直位移 模糊程度 阴影颜色*/&#125;</code></pre><p>设置多个阴影实现凹凸效果</p><pre><code class="css">text-shadow: -1px -1px 1px #fff, 1px 1px 1px #000;/*凹*/text-shadow: -1px -1px 1px #000, 1px 1px 1px #fff;/*凸*/</code></pre><h2 id="盒子大小"><a href="#盒子大小" class="headerlink" title="盒子大小"></a>盒子大小</h2><p><code>box-sizing: content-box;</code></p><p>此时设置的 width 和 height 是<strong>内容区域</strong>的宽高。<code>盒子的实际宽度 = 设置的 width + padding + border</code>。此时改变 padding 和 border 的大小，也不会改变内容的宽高，而是盒子的总宽高发生变化</p><p><code>box-sizing: border-box;</code></p><p>此时设置的width和height是盒子的总宽高。盒子的实际宽度=设置的width。此时改变padding和border的大小，会改变内容的宽高，盒子的总宽高不变。</p><h2 id="边框"><a href="#边框" class="headerlink" title="边框"></a>边框</h2><p>用的时候自己搜</p><h3 id="边框圆角：border-radius"><a href="#边框圆角：border-radius" class="headerlink" title="边框圆角：border-radius"></a>边框圆角：<code>border-radius</code></h3><h3 id="边框阴影：box-shadow"><a href="#边框阴影：box-shadow" class="headerlink" title="边框阴影：box-shadow"></a>边框阴影：<code>box-shadow</code></h3><h2 id="动效"><a href="#动效" class="headerlink" title="动效"></a>动效</h2><p>过渡<code>transition</code></p><pre><code class="javascript">    transition: 让哪些属性进行过度 过渡的持续时间 运动曲线 延迟时间;    transition: all 3s linear 0s;</code></pre><p>2D转换<code>transform</code></p><pre><code class="javascript">transform: scale(2, 0.5);//水平方向*2 垂直方向*0.5</code></pre><pre><code class="javascript">transform: translate(50%, -50%);//水平方向向右移动自己宽度的一半 垂直方向向上移动一半</code></pre><pre><code class="javascript">transform: rotate(45deg);//顺时针旋转45°（负值逆时针）</code></pre><h2 id="3D-转换"><a href="#3D-转换" class="headerlink" title="3D 转换"></a>3D 转换</h2><p>知道有哪些就行 用的时候查</p><h3 id="1、旋转：rotateX、rotateY、rotateZ"><a href="#1、旋转：rotateX、rotateY、rotateZ" class="headerlink" title="1、旋转：rotateX、rotateY、rotateZ"></a>1、旋转：rotateX、rotateY、rotateZ</h3><h3 id="2、移动：translateX、translateY、translateZ"><a href="#2、移动：translateX、translateY、translateZ" class="headerlink" title="2、移动：translateX、translateY、translateZ"></a>2、移动：translateX、translateY、translateZ</h3><h3 id="3、透视：perspective"><a href="#3、透视：perspective" class="headerlink" title="3、透视：perspective"></a>3、透视：perspective</h3><h3 id="4、3D呈现（transform-style）"><a href="#4、3D呈现（transform-style）" class="headerlink" title="4、3D呈现（transform-style）"></a>4、3D呈现（transform-style）</h3><h2 id="动画"><a href="#动画" class="headerlink" title="动画"></a>动画</h2><h3 id="1、定义动画的步骤"><a href="#1、定义动画的步骤" class="headerlink" title="1、定义动画的步骤"></a>1、定义动画的步骤</h3><p>（1）通过@keyframes定义动画；</p><p>（2）将这段动画通过百分比，分割成多个节点；然后各节点中分别定义各属性；</p><p>（3）在指定元素里，通过 <code>animation</code> 属性调用动画。</p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h2 id=&quot;文字阴影&quot;&gt;&lt;a href=&quot;#文字阴影&quot; class=&quot;headerlink&quot; title=&quot;文字阴影&quot;&gt;&lt;/a&gt;文字阴影&lt;/h2&gt;&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;p&amp;#123;
    text-shadow: 20px 27px 22px pink;
    /*水平位移 垂直位移 模糊程度 阴影颜色*/
&amp;#125;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;设置多个阴影实现凹凸效果&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;text-shadow: -1px -1px 1px #fff, 1px 1px 1px #000;/*凹*/
text-shadow: -1px -1px 1px #000, 1px 1px 1px #fff;/*凸*/
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;盒子大小&quot;&gt;&lt;a href=&quot;#盒子大小&quot; class=&quot;headerlink&quot; title=&quot;盒子大小&quot;&gt;&lt;/a&gt;盒子大小&lt;/h2&gt;&lt;p&gt;&lt;code&gt;box-sizing: content-box;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;此时设置的 width 和 height 是&lt;strong&gt;内容区域&lt;/strong&gt;的宽高。&lt;code&gt;盒子的实际宽度 = 设置的 width + padding + border&lt;/code&gt;。此时改变 padding 和 border 的大小，也不会改变内容的宽高，而是盒子的总宽高发生变化&lt;/p&gt;
&lt;p&gt;&lt;code&gt;box-sizing: border-box;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;此时设置的width和height是盒子的总宽高。盒子的实际宽度=设置的width。此时改变padding和border的大小，会改变内容的宽高，盒子的总宽高不变。&lt;/p&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.10CSS3_选择器</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.10CSS3%E9%80%89%E6%8B%A9%E5%99%A8/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.10CSS3%E9%80%89%E6%8B%A9%E5%99%A8/</id>
    <published>2022-11-23T07:25:34.000Z</published>
    <updated>2022-11-23T12:11:50.118Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p>我看这个是最全的：直接查看就行</p><p><a href="https://www.runoob.com/cssref/css-selectors.html">CSS 选择器 | 菜鸟教程 (runoob.com)</a></p><table><thead><tr><th align="left">选择器</th><th align="left">示例</th><th align="left">示例说明</th><th align="left">CSS</th></tr></thead><tbody><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-class.html">.<em>class</em></a></td><td align="left">.intro</td><td align="left">选择所有class=”intro”的元素</td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-id.html">#<em>id</em></a></td><td align="left">#firstname</td><td align="left">选择所有id=”firstname”的元素</td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-all.html">*</a></td><td align="left">*</td><td align="left">选择所有元素</td><td align="left">2</td></tr><tr><td align="left"><em><a href="https://www.runoob.com/cssref/sel-element.html">element</a></em></td><td align="left">p</td><td align="left">选择所有<p>元素</p></td><td align="left">1</td></tr><tr><td align="left"><em><a href="https://www.runoob.com/cssref/sel-element-comma.html">element,element</a></em></td><td align="left">div,p</td><td align="left">选择所有<div>元素和<p>元素</p></div></td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-element-element.html"><em>element</em> <em>element</em></a></td><td align="left">div p</td><td align="left">选择<div>元素内的所有<p>元素</p></div></td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-element-gt.html"><em>element</em>&gt;<em>element</em></a></td><td align="left">div&gt;p</td><td align="left">选择所有父级是 <div> 元素的 <p> 元素</p></div></td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-element-pluss.html"><em>element</em>+<em>element</em></a></td><td align="left">div+p</td><td align="left">选择所有紧跟在 <div> 元素之后的第一个 <p> 元素</p></div></td><td align="left">2</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attribute.html"><em>attribute</em>]</a></td><td align="left">[target]</td><td align="left">选择所有带有target属性元素</td><td align="left">2</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attribute-value.html"><em>attribute</em>=<em>value</em>]</a></td><td align="left">[target=-blank]</td><td align="left">选择所有使用target=”-blank”的元素</td><td align="left">2</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attribute-value-contains.html"><em>attribute</em>~=<em>value</em>]</a></td><td align="left">[title~=flower]</td><td align="left">选择标题属性包含单词”flower”的所有元素</td><td align="left">2</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attribute-value-lang.html"><em>attribute</em>|=<em>language</em>]</a></td><td align="left">[lang|=en]</td><td align="left">选择 lang 属性等于 <strong>en</strong>，或者以 <strong>en-</strong> 为开头的所有元素</td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-link.html">:link</a></td><td align="left">a:link</td><td align="left">选择所有未访问链接</td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-visited.html">:visited</a></td><td align="left">a:visited</td><td align="left">选择所有访问过的链接</td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-active.html">:active</a></td><td align="left">a:active</td><td align="left">选择活动链接</td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-hover.html">:hover</a></td><td align="left">a:hover</td><td align="left">选择鼠标在链接上面时</td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-focus.html">:focus</a></td><td align="left">input:focus</td><td align="left">选择具有焦点的输入元素</td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-firstletter.html">:first-letter</a></td><td align="left">p:first-letter</td><td align="left">选择每一个<p>元素的第一个字母</p></td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-firstline.html">:first-line</a></td><td align="left">p:first-line</td><td align="left">选择每一个<p>元素的第一行</p></td><td align="left">1</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-firstchild.html">:first-child</a></td><td align="left">p:first-child</td><td align="left">指定只有当<p>元素是其父级的第一个子级的样式。</p></td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-before.html">:before</a></td><td align="left">p:before</td><td align="left">在每个<p>元素之前插入内容</p></td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-after.html">:after</a></td><td align="left">p:after</td><td align="left">在每个<p>元素之后插入内容</p></td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-lang.html">:lang(<em>language</em>)</a></td><td align="left">p:lang(it)</td><td align="left">选择一个lang属性的起始值=”it”的所有<p>元素</p></td><td align="left">2</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-gen-sibling.html"><em>element1</em>~<em>element2</em></a></td><td align="left">p~ul</td><td align="left">选择p元素之后的每一个ul元素</td><td align="left">3</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attr-begin.html"><em>attribute</em>^=<em>value</em>]</a></td><td align="left">a[src^=”https”]</td><td align="left">选择每一个src属性的值以”https”开头的元素</td><td align="left">3</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attr-end.html"><em>attribute</em>$=<em>value</em>]</a></td><td align="left">a[src$=”.pdf”]</td><td align="left">选择每一个src属性的值以”.pdf”结尾的元素</td><td align="left">3</td></tr><tr><td align="left">[<a href="https://www.runoob.com/cssref/sel-attr-contain.html"><em>attribute</em>*=<em>value</em>]</a></td><td align="left">a[src*=”runoob”]</td><td align="left">选择每一个src属性的值包含子字符串”runoob”的元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-first-of-type.html">:first-of-type</a></td><td align="left">p:first-of-type</td><td align="left">选择每个p元素是其父级的第一个p元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-last-of-type.html">:last-of-type</a></td><td align="left">p:last-of-type</td><td align="left">选择每个p元素是其父级的最后一个p元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-only-of-type.html">:only-of-type</a></td><td align="left">p:only-of-type</td><td align="left">选择每个p元素是其父级的唯一p元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-only-child.html">:only-child</a></td><td align="left">p:only-child</td><td align="left">选择每个p元素是其父级的唯一子元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-nth-child.html">:nth-child(<em>n</em>)</a></td><td align="left">p:nth-child(2)</td><td align="left">选择每个p元素是其父级的第二个子元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-nth-last-child.html">:nth-last-child(<em>n</em>)</a></td><td align="left">p:nth-last-child(2)</td><td align="left">选择每个p元素的是其父级的第二个子元素，从最后一个子项计数</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-nth-of-type.html">:nth-of-type(<em>n</em>)</a></td><td align="left">p:nth-of-type(2)</td><td align="left">选择每个p元素是其父级的第二个p元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-nth-last-of-type.html">:nth-last-of-type(<em>n</em>)</a></td><td align="left">p:nth-last-of-type(2)</td><td align="left">选择每个p元素的是其父级的第二个p元素，从最后一个子项计数</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-last-child.html">:last-child</a></td><td align="left">p:last-child</td><td align="left">选择每个p元素是其父级的最后一个子级。</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-root.html">:root</a></td><td align="left">:root</td><td align="left">选择文档的根元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-empty.html">:empty</a></td><td align="left">p:empty</td><td align="left">选择每个没有任何子级的p元素（包括文本节点）</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-target.html">:target</a></td><td align="left">#news:target</td><td align="left">选择当前活动的#news元素（包含该锚名称的点击的URL）</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-enabled.html">:enabled</a></td><td align="left">input:enabled</td><td align="left">选择每一个已启用的输入元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-disabled.html">:disabled</a></td><td align="left">input:disabled</td><td align="left">选择每一个禁用的输入元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-checked.html">:checked</a></td><td align="left">input:checked</td><td align="left">选择每个选中的输入元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-not.html">:not(<em>selector</em>)</a></td><td align="left">:not(p)</td><td align="left">选择每个并非p元素的元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-selection.html">::selection</a></td><td align="left">::selection</td><td align="left">匹配元素中被用户选中或处于高亮状态的部分</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-out-of-range.html">:out-of-range</a></td><td align="left">:out-of-range</td><td align="left">匹配值在指定区间之外的input元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-in-range.html">:in-range</a></td><td align="left">:in-range</td><td align="left">匹配值在指定区间之内的input元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-read-write.html">:read-write</a></td><td align="left">:read-write</td><td align="left">用于匹配可读及可写的元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-read-only.html">:read-only</a></td><td align="left">:read-only</td><td align="left">用于匹配设置 “readonly”（只读） 属性的元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-optional.html">:optional</a></td><td align="left">:optional</td><td align="left">用于匹配可选的输入元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-required.html">:required</a></td><td align="left">:required</td><td align="left">用于匹配设置了 “required” 属性的元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-valid.html">:valid</a></td><td align="left">:valid</td><td align="left">用于匹配输入值为合法的元素</td><td align="left">3</td></tr><tr><td align="left"><a href="https://www.runoob.com/cssref/sel-invalid.html">:invalid</a></td><td align="left">:invalid</td><td align="left">用于匹配输入值为非法的元素</td><td align="left">3</td></tr></tbody></table><h3 id="属性选择器"><a href="#属性选择器" class="headerlink" title="属性选择器"></a>属性选择器</h3><p>属性选择器的标志性符号是 <code>[]</code>。</p><p>匹配含义：</p><pre><code class="text">^：开头  $：结尾  *：包含</code></pre><p>格式：</p><ul><li><code>E[title]</code> 选中页面的E元素，并且E存在 title 属性即可。</li><li><code>E[title=&quot;abc&quot;]</code>选中页面的E元素，并且E需要带有title属性，且属性值<strong>完全等于</strong>abc。</li><li><code>E[attr~=val]</code> 选择具有 att 属性且属性值为：用空格分隔的字词列表，其中一个等于 val 的E元素。</li><li><code>E[attr|=val]</code> 表示要么是一个单独的属性值，要么这个属性值是以“-”分隔的。</li><li><code>E[title^=&quot;abc&quot;]</code> 选中页面的E元素，并且E需要带有 title 属性,属性值以 abc 开头。</li><li><code>E[title$=&quot;abc&quot;]</code> 选中页面的E元素，并且E需要带有 title 属性,属性值以 abc 结尾。</li><li><code>E[title*=&quot;abc&quot;]</code> 选中页面的E元素，并且E需要带有 title 属性,属性值任意位置包含abc。</li></ul><h3 id="结构伪类选择器"><a href="#结构伪类选择器" class="headerlink" title="结构伪类选择器"></a>结构伪类选择器</h3><p>伪类选择器的标志性符号是 <code>:</code>。</p><p>CSS中有一些伪类选择器，比如<code>:link</code>、<code>:visited</code>、<code>:hover</code>、<code>:active</code>、<code>:focus</code>。</p><p>CSS3又新增了其它的伪类选择器。这一小段，我们来学习CSS3中的<strong>结构伪类选择器</strong>：即通过<strong>结构</strong>来进行筛选。</p><p><strong>1、格式：（第一部分）</strong>（重要）</p><ul><li><code>E:first-child</code> 匹配父元素的第一个子元素E。</li><li><code>E:last-child</code> 匹配父元素的最后一个子元素E。</li><li><code>E:nth-child(n)</code> 匹配父元素的第n个子元素E。<strong>注意</strong>，盒子的编号是从<code>1</code>开始算起，不是从<code>0</code>开始算起。</li><li><code>E:nth-child(odd)</code> 匹配奇数</li><li><code>E:nth-child(even)</code> 匹配偶数</li><li><code>E:nth-last-child(n)</code> 匹配父元素的倒数第n个子元素E。</li></ul><p>另外，<code>E:nth-child(n)</code>这个属性也很有意思。比如，针对下面这样一组标签：</p><pre><code class="html">    &lt;ul&gt;        &lt;li&gt;1&lt;/li&gt;        &lt;li&gt;2&lt;/li&gt;        &lt;li&gt;3&lt;/li&gt;        &lt;li&gt;4&lt;/li&gt;        &lt;li&gt;5&lt;/li&gt;        &lt;li&gt;6&lt;/li&gt;        &lt;li&gt;7&lt;/li&gt;        &lt;li&gt;8&lt;/li&gt;        &lt;li&gt;9&lt;/li&gt;        &lt;li&gt;10&lt;/li&gt;    &lt;/ul&gt;</code></pre><p>上方代码中：</p><ul><li>如果选择器写成<code>li:nth-child(2)</code>，则表示第2个 <code>li</code>。</li><li>如果选择器写成<code>li:nth-child(n)</code>，则表示<strong>所有的</strong><code>li</code>。因为此时的 <code>n</code> 表示 0,1,2,3,4,5,6,7,8…..（当n小于1时无效，因为n = 0 也是不会选中的）</li></ul><p>只要记住： <code>n</code> 表示 0,1,2,3,4,5,6,7,8…..就很容易明白了</p><h3 id="伪元素选择器"><a href="#伪元素选择器" class="headerlink" title="伪元素选择器"></a>伪元素选择器</h3><p>伪元素选择器的标志性符号是 <code>::</code>。</p><p><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/10-CSS3%E9%80%89%E6%8B%A9%E5%99%A8%E8%AF%A6%E8%A7%A3.html#%E4%BC%AA%E5%85%83%E7%B4%A0%E9%80%89%E6%8B%A9%E5%99%A8">10-CSS3选择器详解 | 千古前端图文教程 (qianguyihao.com)</a></p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;我看这个是最全的：直接查看就行&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.runoob.com/cssref/css-selectors.html&quot;&gt;CSS 选择器 | 菜鸟教程 (runoob.com)&lt;/a&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th align=&quot;left&quot;&gt;选择器&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;示例&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;示例说明&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;CSS&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-class.html&quot;&gt;.&lt;em&gt;class&lt;/em&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;.intro&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有class=”intro”的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-id.html&quot;&gt;#&lt;em&gt;id&lt;/em&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;#firstname&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有id=”firstname”的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-all.html&quot;&gt;*&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;*&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;em&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-element.html&quot;&gt;element&lt;/a&gt;&lt;/em&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有&lt;p&gt;元素&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;em&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-element-comma.html&quot;&gt;element,element&lt;/a&gt;&lt;/em&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;div,p&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有&lt;div&gt;元素和&lt;p&gt;元素&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-element-element.html&quot;&gt;&lt;em&gt;element&lt;/em&gt; &lt;em&gt;element&lt;/em&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;div p&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择&lt;div&gt;元素内的所有&lt;p&gt;元素&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-element-gt.html&quot;&gt;&lt;em&gt;element&lt;/em&gt;&amp;gt;&lt;em&gt;element&lt;/em&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;div&amp;gt;p&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有父级是 &lt;div&gt; 元素的 &lt;p&gt; 元素&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-element-pluss.html&quot;&gt;&lt;em&gt;element&lt;/em&gt;+&lt;em&gt;element&lt;/em&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;div+p&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有紧跟在 &lt;div&gt; 元素之后的第一个 &lt;p&gt; 元素&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attribute.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;[target]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有带有target属性元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attribute-value.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;=&lt;em&gt;value&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;[target=-blank]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有使用target=”-blank”的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attribute-value-contains.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;~=&lt;em&gt;value&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;[title~=flower]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择标题属性包含单词”flower”的所有元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attribute-value-lang.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;|=&lt;em&gt;language&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;[lang|=en]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择 lang 属性等于 &lt;strong&gt;en&lt;/strong&gt;，或者以 &lt;strong&gt;en-&lt;/strong&gt; 为开头的所有元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-link.html&quot;&gt;:link&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a:link&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有未访问链接&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-visited.html&quot;&gt;:visited&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a:visited&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择所有访问过的链接&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-active.html&quot;&gt;:active&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a:active&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择活动链接&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-hover.html&quot;&gt;:hover&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a:hover&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择鼠标在链接上面时&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-focus.html&quot;&gt;:focus&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;input:focus&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择具有焦点的输入元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-firstletter.html&quot;&gt;:first-letter&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:first-letter&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个&lt;p&gt;元素的第一个字母&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-firstline.html&quot;&gt;:first-line&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:first-line&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个&lt;p&gt;元素的第一行&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-firstchild.html&quot;&gt;:first-child&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:first-child&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;指定只有当&lt;p&gt;元素是其父级的第一个子级的样式。&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-before.html&quot;&gt;:before&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:before&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;在每个&lt;p&gt;元素之前插入内容&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-after.html&quot;&gt;:after&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:after&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;在每个&lt;p&gt;元素之后插入内容&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-lang.html&quot;&gt;:lang(&lt;em&gt;language&lt;/em&gt;)&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:lang(it)&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择一个lang属性的起始值=”it”的所有&lt;p&gt;元素&lt;/p&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-gen-sibling.html&quot;&gt;&lt;em&gt;element1&lt;/em&gt;~&lt;em&gt;element2&lt;/em&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p~ul&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择p元素之后的每一个ul元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attr-begin.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;^=&lt;em&gt;value&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a[src^=”https”]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个src属性的值以”https”开头的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attr-end.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;$=&lt;em&gt;value&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a[src$=”.pdf”]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个src属性的值以”.pdf”结尾的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;[&lt;a href=&quot;https://www.runoob.com/cssref/sel-attr-contain.html&quot;&gt;&lt;em&gt;attribute&lt;/em&gt;*=&lt;em&gt;value&lt;/em&gt;]&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a[src*=”runoob”]&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个src属性的值包含子字符串”runoob”的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-first-of-type.html&quot;&gt;:first-of-type&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:first-of-type&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的第一个p元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-last-of-type.html&quot;&gt;:last-of-type&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:last-of-type&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的最后一个p元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-only-of-type.html&quot;&gt;:only-of-type&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:only-of-type&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的唯一p元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-only-child.html&quot;&gt;:only-child&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:only-child&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的唯一子元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-nth-child.html&quot;&gt;:nth-child(&lt;em&gt;n&lt;/em&gt;)&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:nth-child(2)&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的第二个子元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-nth-last-child.html&quot;&gt;:nth-last-child(&lt;em&gt;n&lt;/em&gt;)&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:nth-last-child(2)&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素的是其父级的第二个子元素，从最后一个子项计数&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-nth-of-type.html&quot;&gt;:nth-of-type(&lt;em&gt;n&lt;/em&gt;)&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:nth-of-type(2)&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的第二个p元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-nth-last-of-type.html&quot;&gt;:nth-last-of-type(&lt;em&gt;n&lt;/em&gt;)&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:nth-last-of-type(2)&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素的是其父级的第二个p元素，从最后一个子项计数&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-last-child.html&quot;&gt;:last-child&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:last-child&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个p元素是其父级的最后一个子级。&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-root.html&quot;&gt;:root&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:root&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择文档的根元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-empty.html&quot;&gt;:empty&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;p:empty&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个没有任何子级的p元素（包括文本节点）&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-target.html&quot;&gt;:target&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;#news:target&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择当前活动的#news元素（包含该锚名称的点击的URL）&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-enabled.html&quot;&gt;:enabled&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;input:enabled&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个已启用的输入元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-disabled.html&quot;&gt;:disabled&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;input:disabled&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每一个禁用的输入元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-checked.html&quot;&gt;:checked&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;input:checked&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个选中的输入元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-not.html&quot;&gt;:not(&lt;em&gt;selector&lt;/em&gt;)&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:not(p)&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;选择每个并非p元素的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-selection.html&quot;&gt;::selection&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;::selection&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;匹配元素中被用户选中或处于高亮状态的部分&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-out-of-range.html&quot;&gt;:out-of-range&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:out-of-range&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;匹配值在指定区间之外的input元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-in-range.html&quot;&gt;:in-range&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:in-range&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;匹配值在指定区间之内的input元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-read-write.html&quot;&gt;:read-write&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:read-write&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;用于匹配可读及可写的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-read-only.html&quot;&gt;:read-only&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:read-only&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;用于匹配设置 “readonly”（只读） 属性的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-optional.html&quot;&gt;:optional&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:optional&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;用于匹配可选的输入元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-required.html&quot;&gt;:required&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:required&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;用于匹配设置了 “required” 属性的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-valid.html&quot;&gt;:valid&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:valid&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;用于匹配输入值为合法的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;a href=&quot;https://www.runoob.com/cssref/sel-invalid.html&quot;&gt;:invalid&lt;/a&gt;&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;:invalid&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;用于匹配输入值为非法的元素&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;属性选择器&quot;&gt;&lt;a href=&quot;#属性选择器&quot; class=&quot;headerlink&quot; title=&quot;属性选择器&quot;&gt;&lt;/a&gt;属性选择器&lt;/h3&gt;&lt;p&gt;属性选择器的标志性符号是 &lt;code&gt;[]&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;匹配含义：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;^：开头  $：结尾  *：包含
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;格式：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;E[title]&lt;/code&gt; 选中页面的E元素，并且E存在 title 属性即可。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;E[title=&amp;quot;abc&amp;quot;]&lt;/code&gt;选中页面的E元素，并且E需要带有title属性，且属性值&lt;strong&gt;完全等于&lt;/strong&gt;abc。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;E[attr~=val]&lt;/code&gt; 选择具有 att 属性且属性值为：用空格分隔的字词列表，其中一个等于 val 的E元素。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;E[attr|=val]&lt;/code&gt; 表示要么是一个单独的属性值，要么这个属性值是以“-”分隔的。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;E[title^=&amp;quot;abc&amp;quot;]&lt;/code&gt; 选中页面的E元素，并且E需要带有 title 属性,属性值以 abc 开头。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;E[title$=&amp;quot;abc&amp;quot;]&lt;/code&gt; 选中页面的E元素，并且E需要带有 title 属性,属性值以 abc 结尾。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;E[title*=&amp;quot;abc&amp;quot;]&lt;/code&gt; 选中页面的E元素，并且E需要带有 title 属性,属性值任意位置包含abc。&lt;/li&gt;
&lt;/ul&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.9CSS_脱离标准流</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.9CSS/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.9CSS/</id>
    <published>2022-11-23T03:41:34.000Z</published>
    <updated>2022-11-23T07:04:59.108Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170729_1545.png" alt="img"></p><h3 id="行内元素和块级元素的相互转换"><a href="#行内元素和块级元素的相互转换" class="headerlink" title="行内元素和块级元素的相互转换"></a>行内元素和块级元素的相互转换</h3><p>我们可以通过<code>display</code>属性将块级元素和行内元素进行相互转换。display即“显示模式”。</p><h4 id="块级元素可以转换为行内元素："><a href="#块级元素可以转换为行内元素：" class="headerlink" title="块级元素可以转换为行内元素："></a>块级元素可以转换为行内元素：</h4><p>一旦，给一个块级元素（比如div）设置：</p><pre><code class="text">display: inline;</code></pre><p>那么，这个标签将立即变为行内元素，此时它和一个span无异。inline就是“行内”。也就是说：</p><ul><li>此时这个div不能设置宽度、高度；</li><li>此时这个div可以和别人并排了。</li></ul><h4 id="行内元素转换为块级元素："><a href="#行内元素转换为块级元素：" class="headerlink" title="行内元素转换为块级元素："></a>行内元素转换为块级元素：</h4><p>同样的道理，一旦给一个行内元素（比如span）设置：</p><pre><code class="text">display: block;</code></pre><p>那么，这个标签将立即变为块级元素，此时它和一个div无异。block”是“块”的意思。也就是说：</p><ul><li>此时这个span能够设置宽度、高度</li><li>此时这个span必须霸占一行了，别人无法和他并排</li><li>如果不设置宽度，将撑满父亲</li></ul><hr><p>标准流里面的限制非常多，导致很多页面效果无法实现。如果我们现在就要并排、并且就要设置宽高，那该怎么办呢？办法是：移民！<strong>脱离标准流</strong>！</p><p>css中一共有三种手段，使一个元素脱离标准文档流：</p><ul><li>（1）浮动</li><li>（2）绝对定位</li><li>（3）固定定位</li></ul><h2 id="浮动"><a href="#浮动" class="headerlink" title="浮动"></a>浮动</h2><p>使用属性<code>float</code>的元素性质：</p><blockquote><p>脱标：一旦一个元素浮动了，那么，将能够并排了，并且能够设置宽高了。无论它原来是个div还是个span。所有标签，浮动之后，已经不区分行内、块级了。</p></blockquote><blockquote><p>浮动的元素互相贴靠</p></blockquote><blockquote><p>浮动的元素有“字围”效果</p></blockquote><blockquote><p>收缩：一个浮动的元素，如果没有设置width，那么将自动收缩为内容的宽度（这点非常像行内元素）</p></blockquote><pre><code class="css">&lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;    &lt;meta charset=&quot;UTF-8&quot;&gt;    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;    &lt;meta name=&quot;viewport&quot; content=&quot;width=&lt;device-width&gt;, initial-scale=1.0&quot;&gt;    &lt;title&gt;Document&lt;/title&gt;    &lt;style type=&quot;text/css&quot;&gt;        .header&#123;            width: 970px;            height: 103px;            /* 居中的意思 */            margin: 0 auto;        &#125;        .header .hd1&#123;            width: 277px;            height: 103px;            background-color: red;            float: left;        &#125;        .header .hd2&#123;            width: 679px;            height: 46px;            background-color: greenyellow;            float: right;        &#125;        .header .hd3&#123;            width: 137px;            height: 49px;            background-color: rebeccapurple;            float: right;            margin-bottom: 8px;        &#125;        .content&#123;            width: 970px;            height: 435px;            margin: 0 auto;            margin-top: 10px;                        margin-bottom: 10px;                    &#125;        .content .cnt1&#123;            width: 310px;            height: 435px;            margin-right: 10px;            background-color: darkcyan;            float: left;        &#125;        .content .rightp&#123;            width: 650px;            height: 435px;            float: left;        &#125;        .content .rightp .cnt2&#123;            width: 450px;            height: 240px;            /* margin-right: 10px; */            background-color: salmon;            /* float: left; */            margin-bottom: 10px;        &#125;        .content .rightp .cnt3&#123;            width: 450px;            height: 110px;            /* margin-right: 10px; */            background-color: salmon;            /* float: left; */            margin-bottom: 10px;        &#125;        .content .rightp .cnt4&#123;            width: 450px;            height: 30px;            /* margin-right: 10px; */            background-color: salmon;            /* float: left; */            margin-bottom: 10px;        &#125;        .content .rightp .cnt6&#123;            width: 190px;            height: 400px;            /* margin-right: 10px; */            background-color: cornflowerblue;            float: right;            margin-left: 10px;        &#125;        .content .cnt5&#123;            width: 650px;            height: 25px;            /* margin-right: 10px; */            background-color: blue;            float: left;            margin-bottom: 10px;        &#125;        .footer&#123;            height: 35px;            width: 970px;            background-color: blueviolet;            margin: 0 auto        &#125;    &lt;/style&gt;&lt;/head&gt;&lt;body&gt;    &lt;div class=&quot;header&quot;&gt;        &lt;div class=&quot;hd1&quot;&gt;&lt;/div&gt;        &lt;div class=&quot;hd3&quot;&gt;&lt;/div&gt;        &lt;div class=&quot;hd2&quot;&gt;&lt;/div&gt;            &lt;/div&gt;    &lt;div class=&quot;content&quot;&gt;        &lt;div class=&quot;cnt1&quot;&gt;&lt;/div&gt;        &lt;div class=&quot;rightp&quot;&gt;            &lt;div class=&quot;cnt6&quot;&gt;&lt;/div&gt;            &lt;div class=&quot;cnt2&quot;&gt;&lt;/div&gt;            &lt;div class=&quot;cnt3&quot;&gt;&lt;/div&gt;            &lt;div class=&quot;cnt4&quot;&gt;&lt;/div&gt;            &lt;div class=&quot;cnt5&quot;&gt;&lt;/div&gt;        &lt;/div&gt;           &lt;/div&gt;    &lt;div class=&quot;footer&quot;&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</code></pre><h2 id="浮动的清除"><a href="#浮动的清除" class="headerlink" title="浮动的清除"></a>浮动的清除</h2><h3 id="方法1：给浮动元素的祖先元素加高度"><a href="#方法1：给浮动元素的祖先元素加高度" class="headerlink" title="方法1：给浮动元素的祖先元素加高度"></a>方法1：给浮动元素的祖先元素加高度</h3><p><strong>如果一个元素要浮动，那么它的祖先元素一定要有高度。</strong></p><p><strong>有高度的盒子，才能关住浮动</strong>。</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170801_2153.png" alt="img"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170801_2200.png" alt="img"></p><h3 id="方法2：clear-both"><a href="#方法2：clear-both" class="headerlink" title="方法2：clear:both;"></a>方法2：clear:both;</h3><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170801_2233.png" alt="img"></p><p>这种方法有一个非常大的、致命的问题，<strong>它所在的标签，margin属性失效了</strong>。读者可以试试看。</p><p>margin失效的本质原因是：上图中的box1和box2，高度为零</p><h3 id="方法3：隔墙法"><a href="#方法3：隔墙法" class="headerlink" title="方法3：隔墙法"></a>方法3：隔墙法</h3><p>上面这个例子中，为了防止第二个div贴靠到第二个div，我们可以在这两个div中间用一个新的div隔开，然后给这个新的div设置<code>clear: both;</code>属性；同时，既然这个新的div无法设置margin属性，我们可以给它设置height，以达到margin的效果（曲线救国）。这便是隔墙法</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170802_1109.png" alt="img"></p><h3 id="内墙法："><a href="#内墙法：" class="headerlink" title="** 内墙法：**"></a>** 内墙法：**</h3><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170802_1834.png" alt="img"></p><p>与外墙法相比，内墙法的优势（本质区别）在于：内墙法可以给它所在的家撑出宽度（让box1有高）。即：box1的高度可以自适应内容。</p><p>而外墙法，虽然一道墙可以把两个div隔开，但是这两个div没有高，也就是说，无法wrap_content</p><h3 id="方法4：overflow-hidden"><a href="#方法4：overflow-hidden" class="headerlink" title="方法4：overflow:hidden"></a>方法4：overflow:hidden</h3><p>这个属性的意思是“溢出隐藏”。顾名思义：所有溢出边框的内容，都要隐藏掉。</p><p>但是，前端开发工程师发现了，它能做偏方。如下：</p><p>一个父亲不能被自己浮动的儿子，撑出高度。但是，只要给父亲加上<code>overflow:hidden</code>; 那么，父亲就能被儿子撑出高了。这是一个偏方。</p><hr><h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><h3 id="1、加高法"><a href="#1、加高法" class="headerlink" title="1、加高法"></a>1、加高法</h3><p>工作上，我们绝对不会给所有的盒子加高度，这是因为麻烦，并且不能适应页面的快速变化。</p><pre><code class="html">&lt;div&gt;     //设置height    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;    //设置height    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;</code></pre><h3 id="2、clear-both-法"><a href="#2、clear-both-法" class="headerlink" title="#2、clear:both;法"></a><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/07-%E6%B5%AE%E5%8A%A8.html#_2%E3%80%81clear-both-%E6%B3%95">#</a>2、<code>clear:both;</code>法</h3><p>最简单的清除浮动的方法，就是给盒子增加clear:both；表示自己的内部元素，不受其他盒子的影响。</p><pre><code class="html">&lt;div&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;   //clear:both;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;</code></pre><p>浮动确实被清除了，不会互相影响了。但是有一个问题，就是margin失效。两个div之间，没有任何的间隙了。</p><h3 id="3、隔墙法"><a href="#3、隔墙法" class="headerlink" title="#3、隔墙法"></a><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/07-%E6%B5%AE%E5%8A%A8.html#_3%E3%80%81%E9%9A%94%E5%A2%99%E6%B3%95">#</a>3、隔墙法</h3><p>在两部分浮动元素中间，建一个墙。隔开两部分浮动，让后面的浮动元素，不去追前面的浮动元素。 墙用自己的身体当做了间隙。</p><pre><code class="html">&lt;div&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class=&quot;cl h10&quot;&gt;&lt;/div&gt;&lt;div&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;</code></pre><p>我们发现，隔墙法好用，但是第一个div，还是没有高度。如果我们现在想让第一个div，自动根据自己的儿子撑出高度，我们就要想一些“小伎俩”。</p><p>内墙法：</p><pre><code class="html">&lt;div&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;div class=&quot;cl h10&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;&lt;/div&gt;</code></pre><p>内墙法的优点就是，不仅仅能够让后部分的p不去追前部分的p了，并且能把第一个div撑出高度。这样，这个div的背景、边框就能够根据p的高度来撑开了。</p><h3 id="4、overflow-hidden"><a href="#4、overflow-hidden" class="headerlink" title="#4、overflow:hidden;"></a><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/07-%E6%B5%AE%E5%8A%A8.html#_4%E3%80%81overflow-hidden">#</a>4、<code>overflow:hidden;</code></h3><p>这个属性的本意，就是将所有溢出盒子的内容，隐藏掉。但是，我们发现这个东西能够用于浮动的清除。 我们知道，一个父亲，不能被自己浮动的儿子撑出高度，但是，如果这个父亲加上了overflow:hidden；那么这个父亲就能够被浮动的儿子撑出高度了。这个现象，不能解释，就是浏览器的偏方。 并且,overflow:hidden;能够让margin生效。</p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/20170729_1545.png&quot; alt=&quot;img&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;行内元素和块级元素的相互转换&quot;&gt;&lt;a href=&quot;#行内元素和块级元素的相互转换&quot; class=&quot;headerlink&quot; title=&quot;行内元素和块级元素的相互转换&quot;&gt;&lt;/a&gt;行内元素和块级元素的相互转换&lt;/h3&gt;&lt;p&gt;我们可以通过&lt;code&gt;display&lt;/code&gt;属性将块级元素和行内元素进行相互转换。display即“显示模式”。&lt;/p&gt;
&lt;h4 id=&quot;块级元素可以转换为行内元素：&quot;&gt;&lt;a href=&quot;#块级元素可以转换为行内元素：&quot; class=&quot;headerlink&quot; title=&quot;块级元素可以转换为行内元素：&quot;&gt;&lt;/a&gt;块级元素可以转换为行内元素：&lt;/h4&gt;&lt;p&gt;一旦，给一个块级元素（比如div）设置：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;display: inline;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;那么，这个标签将立即变为行内元素，此时它和一个span无异。inline就是“行内”。也就是说：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;此时这个div不能设置宽度、高度；&lt;/li&gt;
&lt;li&gt;此时这个div可以和别人并排了。&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;行内元素转换为块级元素：&quot;&gt;&lt;a href=&quot;#行内元素转换为块级元素：&quot; class=&quot;headerlink&quot; title=&quot;行内元素转换为块级元素：&quot;&gt;&lt;/a&gt;行内元素转换为块级元素：&lt;/h4&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.8CSS_盒模型</title>
    <link href="http://babytoast.shop/Learnweb3/1.0.8CSS/"/>
    <id>http://babytoast.shop/Learnweb3/1.0.8CSS/</id>
    <published>2022-11-23T03:12:34.000Z</published>
    <updated>2022-11-23T03:41:06.193Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h2 id="盒子模型"><a href="#盒子模型" class="headerlink" title="盒子模型"></a>盒子模型</h2><p>即box model。无论是div、span、还是a都是盒子。</p><p>但是，图片、表单元素一律看作是文本，它们并不是盒子。这个很好理解，比如说，一张图片里并不能放东西，它自己就是自己的内容。</p><p>一个盒子中主要的属性就5个：width、height、padding、border、margin。如下：</p><ul><li>width和height：==<strong>内容</strong>==的宽度、高度（不是盒子的宽度、高度）。</li><li>padding：内边距。</li><li>border：边框。</li><li>margin：外边距。</li></ul><p>真实占有宽度 = 左border + 左padding + width + 右padding + 右border</p><p><strong>如果想保持一个盒子的真实占有宽度不变，那么加width的时候就要减padding。加padding的时候就要减width</strong></p><h3 id="padding有四个方向"><a href="#padding有四个方向" class="headerlink" title="padding有四个方向"></a>padding有四个方向</h3><p>小属性的写法：</p><pre><code class="css">    padding-top: 30px;    padding-right: 20px;    padding-bottom: 40px;    padding-left: 100px;</code></pre><p>综合属性的写法：(上、右、下、左)（顺时针方向，用空格隔开。margin的道理也是一样的）</p><pre><code class="css">padding:30px 20px 40px 100px;</code></pre><p>如果只写了三个值，则顺序为：上、右和左、下。</p><p>如果只写了两个值，则顺序为：上和下、左和右。</p><p>比如说：</p><pre><code class="text">padding: 30px 40px;</code></pre><p>则顺序等价于：30px 40px 30px 40px;</p><p>要懂得，<strong>用小属性层叠大属性</strong>。比如：</p><pre><code class="text">padding: 20px;padding-left: 30px;</code></pre><p>上面的padding对应盒子模型为：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170728_1039.png" alt="img"></p><p>下面的写法：</p><pre><code class="text">padding-left: 30px;padding: 20px;</code></pre><p>第一行的小属性无效，因为被第二行的大属性层叠掉了。</p><h2 id="认识border"><a href="#认识border" class="headerlink" title="认识border"></a>认识border</h2><p>border就是边框。边框有三个要素：像素（粗细）、线型、颜色</p><p>border的所有的线型如下：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170728_1435.png" alt="img"></p><p>（1）按三要素拆：</p><pre><code class="css">border-width:10px;    //边框宽度border-style:solid;   //线型border-color:red;     //颜色。</code></pre><p>(2)按方向来拆：</p><pre><code class="css">border-top:10px solid red;border-right:10px solid red;border-bottom:10px solid red;border-left:10px solid red;</code></pre><p>（3）按三要素和方向来拆：(就是把每个方向的，每个要素拆开。3*4 = 12)</p><pre><code class="css">    border-top-width:10px;    border-top-style:solid;    border-top-color:red;    border-right-width:10px;    border-right-style:solid;    border-right-color:red;    border-bottom-width:10px;    border-bottom-style:solid;    border-bottom-color:red;    border-left-width:10px;    border-left-style:solid;    border-left-color:red;</code></pre><p><strong>一个border属性，是由三个小属性综合而成的</strong>。如果某一个小属性后面是空格隔开的多个值，那么就是上右下左的顺序。举例如下：</p><pre><code class="text">border-width:10px 20px;border-style:solid dashed dotted;border-color:red green blue yellow;</code></pre>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h2 id=&quot;盒子模型&quot;&gt;&lt;a href=&quot;#盒子模型&quot; class=&quot;headerlink&quot; title=&quot;盒子模型&quot;&gt;&lt;/a&gt;盒子模型&lt;/h2&gt;&lt;p&gt;即box model。无论是div、span、还是a都是盒子。&lt;/p&gt;
&lt;p&gt;但是，图片、表单元素一律看作是文本，它们并不是盒子。这个很好理解，比如说，一张图片里并不能放东西，它自己就是自己的内容。&lt;/p&gt;
&lt;p&gt;一个盒子中主要的属性就5个：width、height、padding、border、margin。如下：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;width和height：==&lt;strong&gt;内容&lt;/strong&gt;==的宽度、高度（不是盒子的宽度、高度）。&lt;/li&gt;
&lt;li&gt;padding：内边距。&lt;/li&gt;
&lt;li&gt;border：边框。&lt;/li&gt;
&lt;li&gt;margin：外边距。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;真实占有宽度 = 左border + 左padding + width + 右padding + 右border&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;如果想保持一个盒子的真实占有宽度不变，那么加width的时候就要减padding。加padding的时候就要减width&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;padding有四个方向&quot;&gt;&lt;a href=&quot;#padding有四个方向&quot; class=&quot;headerlink&quot; title=&quot;padding有四个方向&quot;&gt;&lt;/a&gt;padding有四个方向&lt;/h3&gt;&lt;p&gt;小属性的写法：&lt;/p&gt;</summary>
    
    
    
    <category term="Learnweb3" scheme="http://babytoast.shop/categories/Learnweb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.5CSS_2.0</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.5CSS/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.5CSS/</id>
    <published>2022-11-22T06:07:31.000Z</published>
    <updated>2023-05-17T07:08:58.434Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h2 id="background-的常见背景属性"><a href="#background-的常见背景属性" class="headerlink" title="background 的常见背景属性"></a>background 的常见背景属性</h2><p><strong>css2.1</strong> 中，常见的背景属性有以下几种：（经常用到，要记住）</p><ul><li><code>background-color:#ff99ff;</code> 设置元素的背景颜色。</li><li><code>background-image:url(images/2.gif);</code> 将图像设置为背景。</li><li><code>background-repeat: no-repeat;</code> 设置背景图片是否重复及如何重复，默认平铺满。（重要）<ul><li><code>no-repeat</code>不要平铺；</li><li><code>repeat-x</code>横向平铺；</li><li><code>repeat-y</code>纵向平铺。</li></ul></li><li><code>background-position:center top;</code> 设置背景图片在当前容器中的位置。</li><li><code>background-attachment:scroll;</code> 设置背景图片是否跟着滚动条一起移动。 属性值可以是：<code>scroll</code>（与fixed属性相反，默认属性）、<code>fixed</code>（背景就会被固定住，不会被滚动条滚走）。</li><li>另外还有一个综合属性叫做<code>background</code>，它的作用是：将上面的多个属性写在一个声明中。</li></ul><p><strong>CSS3</strong> 中，新增了一些background属性：</p><ul><li>background-origin</li><li>background-clip 背景裁切</li><li>background-size 调整尺寸</li><li>多重背景</li></ul><h3 id="RGBA-表示法"><a href="#RGBA-表示法" class="headerlink" title="RGBA 表示法"></a>RGBA 表示法</h3><pre><code class="javascript">    background-color: rgba(0, 0, 255, 0.3);    border: 30px solid rgba(0, 255, 0, 0.3);</code></pre><p><strong>代码解释</strong>：</p><ul><li>RGBA 即：Red 红、Green 绿、Blue 蓝、Alpha 透明度。</li><li>R、G、B 的取值范围是：0<del>255；透明度的取值范围是 0</del>1。</li></ul><p><strong>关于设置透明度的其他方式：</strong></p><p>（1）<code>opacity: 0.3;</code> 会将整个盒子及子盒子设置透明度。也就是说，当盒子设置半透明的时候，会影响里面的子盒子。</p><p>（2）<code>background: transparent;</code> 可以单独设置透明度，但设置的是完全透明（不可调节透明度）。</p><h3 id="十六进制表示法"><a href="#十六进制表示法" class="headerlink" title="十六进制表示法"></a>十六进制表示法</h3><p>比如红色：</p><pre><code class="text">background-color: #ff0000;</code></pre><h3 id="RGB-表示法"><a href="#RGB-表示法" class="headerlink" title="RGB 表示法"></a>RGB 表示法</h3><pre><code class="css">background-color: rgb(255,0,0);</code></pre><h2 id="clip-path：裁剪出元素的部分区域做展示"><a href="#clip-path：裁剪出元素的部分区域做展示" class="headerlink" title="clip-path：裁剪出元素的部分区域做展示"></a>clip-path：裁剪出元素的部分区域做展示</h2><p><code>clip-path</code>属性可以创建一个只有元素的部分区域可以显示的剪切区域。区域内的部分显示，区域外的隐藏。</p><p>虽然<code>clip-path</code>不是背景属性，但这个属性非常强大，但往往会结合背景属性一起使用，达到一些效果。</p><p>举例：（鼠标悬停时，放大裁剪的区域）</p><pre><code class="css">    .div1 &#123;        width: 320px;        height: 320px;        border: 1px solid red;        background: url(http://img.smyhvae.com/20191006_1410.png) no-repeat;        background-size: cover;        /* 裁剪出圆形区域 */        clip-path: circle(50px at 100px 100px);        transition: clip-path .4s;    &#125;    .div1:hover&#123;        /* 鼠标悬停时，裁剪出更大的圆形 */        clip-path: circle(80px at 100px 100px);    &#125;</code></pre><p><code>clip-path</code>属性的好处是，即使做了任何裁剪，<strong>容器的占位大小是不变的</strong>。比如上方代码中，容器的占位大小一直都是 320px * 320px。这样的话，也方便我们做一些动画效果。</p><pre><code class="css">&lt;style type=&quot;text/css&quot;&gt;        .clip &#123;        width: 1000px;        height: 320px;        border: 1px solid red;        background: url(http://img.smyhvae.com/20191006_1410.png) no-repeat;        background-position: center;        background-size: 25%;        /* 裁剪出圆形区域 */        clip-path: circle(60px at 500px 150px);        transition: clip-path .2s;    &#125;    .clip:hover&#123;        /* 鼠标悬停时，裁剪出更大的圆形 */        clip-path: circle(80px at 500px 150px);    &#125;&lt;/style&gt;</code></pre>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h2 id=&quot;background-的常见背景属性&quot;&gt;&lt;a href=&quot;#background-的常见背景属性&quot; class=&quot;headerlink&quot; title=&quot;background 的常见背景属性&quot;&gt;&lt;/a&gt;background 的常见背景属性&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;css2.1&lt;/strong&gt; 中，常见的背景属性有以下几种：（经常用到，要记住）&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;background-color:#ff99ff;&lt;/code&gt; 设置元素的背景颜色。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;background-image:url(images/2.gif);&lt;/code&gt; 将图像设置为背景。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;background-repeat: no-repeat;&lt;/code&gt; 设置背景图片是否重复及如何重复，默认平铺满。（重要）&lt;ul&gt;
&lt;li&gt;&lt;code&gt;no-repeat&lt;/code&gt;不要平铺；&lt;/li&gt;
&lt;li&gt;&lt;code&gt;repeat-x&lt;/code&gt;横向平铺；&lt;/li&gt;
&lt;li&gt;&lt;code&gt;repeat-y&lt;/code&gt;纵向平铺。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;background-position:center top;&lt;/code&gt; 设置背景图片在当前容器中的位置。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;background-attachment:scroll;&lt;/code&gt; 设置背景图片是否跟着滚动条一起移动。 属性值可以是：&lt;code&gt;scroll&lt;/code&gt;（与fixed属性相反，默认属性）、&lt;code&gt;fixed&lt;/code&gt;（背景就会被固定住，不会被滚动条滚走）。&lt;/li&gt;
&lt;li&gt;另外还有一个综合属性叫做&lt;code&gt;background&lt;/code&gt;，它的作用是：将上面的多个属性写在一个声明中。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;CSS3&lt;/strong&gt; 中，新增了一些background属性：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;background-origin&lt;/li&gt;
&lt;li&gt;background-clip 背景裁切&lt;/li&gt;
&lt;li&gt;background-size 调整尺寸&lt;/li&gt;
&lt;li&gt;多重背景&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;RGBA-表示法&quot;&gt;&lt;a href=&quot;#RGBA-表示法&quot; class=&quot;headerlink&quot; title=&quot;RGBA 表示法&quot;&gt;&lt;/a&gt;RGBA 表示法&lt;/h3&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;    background-color: rgba(0, 0, 255, 0.3);

    border: 30px solid rgba(0, 255, 0, 0.3);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;代码解释&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;RGBA 即：Red 红、Green 绿、Blue 蓝、Alpha 透明度。&lt;/li&gt;
&lt;li&gt;R、G、B 的取值范围是：0&lt;del&gt;255；透明度的取值范围是 0&lt;/del&gt;1。&lt;/li&gt;
&lt;/ul&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.4CSS_字体与文本属性</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.4CSS/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.4CSS/</id>
    <published>2022-11-22T06:02:31.000Z</published>
    <updated>2022-11-22T06:02:51.740Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/01-CSS%E5%B1%9E%E6%80%A7%EF%BC%9A%E5%AD%97%E4%BD%93%E5%B1%9E%E6%80%A7%E5%92%8C%E6%96%87%E6%9C%AC%E5%B1%9E%E6%80%A7.html#%E6%9C%AC%E6%96%87%E9%87%8D%E8%A6%81%E5%86%85%E5%AE%B9">01-CSS属性：字体属性和文本属性 | 千古前端图文教程 (qianguyihao.com)</a></p><h2 id="CSS的单位"><a href="#CSS的单位" class="headerlink" title="CSS的单位"></a>CSS的单位</h2><p>html中的单位只有一种，那就是像素px，所以单位是可以省略的，但是在CSS中不一样。 <strong>CSS中的单位是必须要写的</strong>，因为它没有默认单位。</p><h3 id="绝对单位"><a href="#绝对单位" class="headerlink" title="绝对单位"></a>绝对单位</h3><p>1 <code>in</code>=2.54<code>cm</code>=25.4<code>mm</code>=72<code>pt</code>=6<code>pc</code></p><h3 id="相对单位"><a href="#相对单位" class="headerlink" title="相对单位"></a>相对单位</h3><p><code>px</code>：像素 <code>em</code>：印刷单位相当于12个点 <code>%</code>：百分比，相对周围的文字的大小</p><h2 id="font-字体属性"><a href="#font-字体属性" class="headerlink" title="font 字体属性"></a>font 字体属性</h2><p>CSS中，有很多<strong>非布局样式</strong>（与布局无关），包括：字体、行高、颜色、大小、背景、边框、滚动、换行、装饰性属性（粗体、斜体、下划线）等。</p><p>这一段，我们先来讲一下字体属性。</p><p>css样式中，常见的字体属性有以下几种：</p><pre><code class="css">p&#123;    font-size: 50px;         /*字体大小*/    line-height: 30px;      /*行高*/    font-family: 幼圆,黑体;     /*字体类型：如果没有幼圆就显示黑体，没有黑体就显示默认*/    font-style: italic ;        /*italic表示斜体，normal表示不倾斜*/    font-weight: bold;    /*粗体*/    font-variant: small-caps;  /*小写变大写*/&#125;</code></pre><p>前三个可以连写成：</p><pre><code class="css">font: 400 14px/24px &quot;宋体&quot;;font: 加粗 字号/行高/ 字体</code></pre><p>PS：400是nomal，700是bold。</p><p>我们须将英语字体放在最前面，这样所有的中文，就不能匹配英语字体，就自动的变为后面的中文字体：</p><pre><code class="text">    font-family: &quot;Times New Roman&quot;,&quot;微软雅黑&quot;,&quot;宋体&quot;;</code></pre><p>上方代码的意思是，英文会采用Times New Roman字体，而中文会采用微软雅黑字体</p><p>所有的中文字体，都有英语别名。</p><p>微软雅黑的英语别名：</p><pre><code class="text">    font-family: &quot;Microsoft YaHei&quot;;</code></pre><p>宋体的英语别名：</p><pre><code class="text">    font-family: &quot;SimSun&quot;;</code></pre><p>于是，当我们把字号、行高、字体这三个属性合二为一时，也可以写成：</p><pre><code class="text">    font:12px/30px  &quot;Times New Roman&quot;,&quot;Microsoft YaHei&quot;,&quot;SimSun&quot;;</code></pre><h3 id="字体加粗属性"><a href="#字体加粗属性" class="headerlink" title="字体加粗属性"></a>字体加粗属性</h3><pre><code class="css">.div &#123;    font-weight: normal; /*正常*/    font-weight: bold;  /*加粗*/    font-weight: 100;    font-weight: 200;    font-weight: 900;&#125;</code></pre><p>在设置字体是否加粗时，属性值既可以填写<code>normal</code>、<code>bold</code>这样的加粗字体，也可以直接填写 100至900 这样的数字。<code>normal</code>的值相当于400，<code>bold</code>的值相当于700。</p><h3 id="行高"><a href="#行高" class="headerlink" title="行高"></a>行高</h3><p>CSS中，所有的行，都有行高。盒子模型的padding，绝对不是直接作用在文字上的，而是作用在“行”上的。</p><p>垂直方向来看，文字在自己的行里是居中的。比如，文字是14px，行高是24px，那么padding就是5px：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170808_2220.png" alt="img"></p><p>为了严格保证字在行里面居中，我们的工程师有一个约定： <strong>行高、字号，一般都是偶数</strong>。这样可以保证，它们的差一定偶数，就能够被2整除。</p><p>行高可以用百分比，表示字号的百分之多少。</p><p>一般来说，百分比都是大于100%的，因为行高一定要大于字号。</p><p>比如说， <code>font:12px/200% “宋体”</code>等价于<code>font:12px/24px “宋体”</code>。<code>200%</code>可以理解成word里面的2倍行高。</p><h3 id="如何让单行文本垂直居中"><a href="#如何让单行文本垂直居中" class="headerlink" title="如何让单行文本垂直居中"></a>如何让单行文本垂直居中</h3><p>小技巧：如果一段文本只有一行，如果此时设置<strong>行高 = 盒子高</strong>，就可以保证单行文本垂直居中。这个很好理解。</p><p>上面这个小技巧，只适用于单行文本垂直居中，不适用于多行。如果想让多行文本垂直居中，还需要计算盒子的padding。计算方式如下：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170808_2240.png" alt="img"></p><h3 id="vertical-align-middle-属性"><a href="#vertical-align-middle-属性" class="headerlink" title="vertical-align: middle; 属性"></a><code>vertical-align: middle;</code> 属性</h3><p><code>vertical-align</code>属性可用于指定<strong>行内元素</strong>（inline）、<strong>行内块元素</strong>（inline-block）、<strong>表格的单元格</strong>（table-cell）的垂直对齐方式。主要是用于图片、表格、文本的对齐。</p><p>代码举例：</p><pre><code class="css">vertical-align: middle; /*指定行级元素的垂直对齐方式。*/</code></pre><h2 id="文本属性"><a href="#文本属性" class="headerlink" title="文本属性"></a>文本属性</h2><p>CSS样式中，常见的文本属性有以下几种：</p><ul><li><code>letter-spacing: 0.5cm ;</code> 单个字母之间的间距</li><li><code>word-spacing: 1cm;</code> 单词之间的间距</li><li><code>text-decoration: none;</code> 字体修饰：none 去掉下划线、<strong>underline 下划线</strong>、line-through 中划线、overline 上划线</li><li><code>color:red;</code> 字体颜色</li><li><code>text-align: center;</code> 在当前容器中的对齐方式。属性值可以是：left、right、center（<strong>在当前容器的中间</strong>）、justify</li><li><code>text-transform: lowercase;</code> 单词的字体大小写。属性值可以是：<code>uppercase</code>（单词大写）、<code>lowercase</code>（单词小写）、<code>capitalize</code>（每个单词的首字母大写）</li></ul><h2 id="列表属性"><a href="#列表属性" class="headerlink" title="列表属性"></a>列表属性</h2><pre><code class="css">ul li&#123;    list-style-image:url(images/2.gif) ;  /*列表项前设置为图片*/    margin-left:80px;  /*公有属性*/&#125;</code></pre><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/2015-10-03-css-26.png" alt="img"></p><h2 id="overflow属性：超出范围的内容要怎么处理"><a href="#overflow属性：超出范围的内容要怎么处理" class="headerlink" title="overflow属性：超出范围的内容要怎么处理"></a>overflow属性：超出范围的内容要怎么处理</h2><p><code>overflow</code>属性的属性值可以是：</p><ul><li><code>visible</code>：默认值。多余的内容不剪切也不添加滚动条，会全部显示出来。</li><li><code>hidden</code>：不显示超过对象尺寸的内容。</li><li><code>auto</code>：如果内容不超出，则不显示滚动条；如果内容超出，则显示滚动条。</li><li><code>scroll</code>：Windows 平台下，无论内容是否超出，总是显示滚动条。Mac 平台下，和 <code>auto</code> 属性相同。</li></ul><h2 id="鼠标的属性-cursor"><a href="#鼠标的属性-cursor" class="headerlink" title="鼠标的属性 cursor"></a>鼠标的属性 cursor</h2><p>鼠标的属性<code>cursor</code>有以下几个属性值：</p><ul><li><code>auto</code>：默认值。浏览器根据当前情况自动确定鼠标光标类型。</li><li><code>pointer</code>：IE6.0，竖起一只手指的手形光标。就像通常用户将光标移到超链接上时那样。</li><li><code>hand</code>：和<code>pointer</code>的作用一样：竖起一只手指的手形光标。就像通常用户将光标移到超链接上时那样。</li></ul><p>比如说，我想让鼠标放在那个标签上时，光标显示手状，代码如下：</p><pre><code class="html">p:hover&#123;    cursor: pointer;&#125;</code></pre><h2 id="滤镜"><a href="#滤镜" class="headerlink" title="滤镜"></a>滤镜</h2><p>这里只举一个滤镜的例子吧。比如说让图片变成灰度图的效果，可以这样设置滤镜：</p><pre><code class="html">    &lt;img src=&quot;3.jpg&quot; style=&quot;filter:gray()&quot;&gt;</code></pre>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/01-CSS%E5%B1%9E%E6%80%A7%EF%BC%9A%E5%AD%97%E4%BD%93%E5%B1%9E%E6%80%A7%E5%92%8C%E6%96%87%E6%9C%AC%E5%B1%9E%E6%80%A7.html#%E6%9C%AC%E6%96%87%E9%87%8D%E8%A6%81%E5%86%85%E5%AE%B9&quot;&gt;01-CSS属性：字体属性和文本属性 | 千古前端图文教程 (qianguyihao.com)&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;CSS的单位&quot;&gt;&lt;a href=&quot;#CSS的单位&quot; class=&quot;headerlink&quot; title=&quot;CSS的单位&quot;&gt;&lt;/a&gt;CSS的单位&lt;/h2&gt;&lt;p&gt;html中的单位只有一种，那就是像素px，所以单位是可以省略的，但是在CSS中不一样。 &lt;strong&gt;CSS中的单位是必须要写的&lt;/strong&gt;，因为它没有默认单位。&lt;/p&gt;
&lt;h3 id=&quot;绝对单位&quot;&gt;&lt;a href=&quot;#绝对单位&quot; class=&quot;headerlink&quot; title=&quot;绝对单位&quot;&gt;&lt;/a&gt;绝对单位&lt;/h3&gt;&lt;p&gt;1 &lt;code&gt;in&lt;/code&gt;=2.54&lt;code&gt;cm&lt;/code&gt;=25.4&lt;code&gt;mm&lt;/code&gt;=72&lt;code&gt;pt&lt;/code&gt;=6&lt;code&gt;pc&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&quot;相对单位&quot;&gt;&lt;a href=&quot;#相对单位&quot; class=&quot;headerlink&quot; title=&quot;相对单位&quot;&gt;&lt;/a&gt;相对单位&lt;/h3&gt;&lt;p&gt;&lt;code&gt;px&lt;/code&gt;：像素 &lt;code&gt;em&lt;/code&gt;：印刷单位相当于12个点 &lt;code&gt;%&lt;/code&gt;：百分比，相对周围的文字的大小&lt;/p&gt;
&lt;h2 id=&quot;font-字体属性&quot;&gt;&lt;a href=&quot;#font-字体属性&quot; class=&quot;headerlink&quot; title=&quot;font 字体属性&quot;&gt;&lt;/a&gt;font 字体属性&lt;/h2&gt;&lt;p&gt;CSS中，有很多&lt;strong&gt;非布局样式&lt;/strong&gt;（与布局无关），包括：字体、行高、颜色、大小、背景、边框、滚动、换行、装饰性属性（粗体、斜体、下划线）等。&lt;/p&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.7CSS_继承 层叠</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.7CSS/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.7CSS/</id>
    <published>2022-11-22T03:19:31.000Z</published>
    <updated>2023-05-17T07:09:10.133Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/05-CSS%E6%A0%B7%E5%BC%8F%E8%A1%A8%E7%9A%84%E7%BB%A7%E6%89%BF%E6%80%A7%E5%92%8C%E5%B1%82%E5%8F%A0%E6%80%A7.html#%E9%A2%98%E7%9B%AE%E6%BC%94%E7%A4%BA">05-CSS样式表的继承性和层叠性 | 千古前端图文教程 (qianguyihao.com)</a></p><h2 id="继承性"><a href="#继承性" class="headerlink" title="继承性"></a>继承性</h2><p>我们给div加了一个border，但是发现只有div具备了border属性，而p标签却没有border属性。于是我们可以得出结论：</p><ul><li>关于文字样式的属性，都具有继承性。这些属性包括：color、 text-开头的、line-开头的、font-开头的。</li><li>关于盒子、定位、布局的属性，都不能继承。</li></ul><h2 id="层叠性：处理冲突的能力（计算权重）"><a href="#层叠性：处理冲突的能力（计算权重）" class="headerlink" title="层叠性：处理冲突的能力（计算权重）"></a>层叠性：处理冲突的能力（计算权重）</h2><p>当多个选择器，选择上了某个元素的时候，要按照如下顺序统计权重：</p><ul><li>id 选择器</li><li>类选择器、属性选择器、伪类选择器</li><li>标签选择器、伪元素选择器</li></ul><h4 id="举例1：计算权重"><a href="#举例1：计算权重" class="headerlink" title="举例1：计算权重"></a>举例1：计算权重</h4><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170725_2138.png" alt="img"></p><p>如上图所示，统计各个选择器的数量，优先级高的胜出。文字的颜色为红色。</p><h4 id="举例2：权重相同时"><a href="#举例2：权重相同时" class="headerlink" title="举例2：权重相同时"></a>举例2：权重相同时</h4><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170725_2250.png" alt="img"></p><p>上图可以看到，第一个样式和第二个样式的权重相同。但第二个样式的书写顺序靠后，因此以第二个样式为准（就近原则）。</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170727_2050.png" alt="img"></p><p>上面这个图非常重要，我们针对这个图做一个文字描述：</p><ul><li>选择上了，数权重，(id的数量，类的数量，标签的数量)。如果权重一样，谁写在后面听谁的。</li><li>没有选择上，通过继承影响的，就近原则，谁描述的近听谁的。如果描述的一样近，比如选择器权重，如果权重再一样重，谁写在后面听谁的</li></ul><h3 id="CSS样式表的冲突的总结"><a href="#CSS样式表的冲突的总结" class="headerlink" title="CSS样式表的冲突的总结"></a>CSS样式表的冲突的总结</h3><ul><li>1、对于相同的选择器（比如同样都是类选择器），其样式表排序：行级样式 &gt; 内嵌样式表 &gt; 外部样式表（就近原则）</li><li>2、对于相同类型的样式表（比如同样都是内部样式表），其选择器排序：ID选择器 &gt; 类选择器 &gt; 标签选择器</li><li>3、外部样式表的ID选择器 &gt; 内嵌样式表的标签选择器</li></ul>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/05-CSS%E6%A0%B7%E5%BC%8F%E8%A1%A8%E7%9A%84%E7%BB%A7%E6%89%BF%E6%80%A7%E5%92%8C%E5%B1%82%E5%8F%A0%E6%80%A7.html#%E9%A2%98%E7%9B%AE%E6%BC%94%E7%A4%BA&quot;&gt;05-CSS样式表的继承性和层叠性 | 千古前端图文教程 (qianguyihao.com)&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;继承性&quot;&gt;&lt;a href=&quot;#继承性&quot; class=&quot;headerlink&quot; title=&quot;继承性&quot;&gt;&lt;/a&gt;继承性&lt;/h2&gt;&lt;p&gt;我们给div加了一个border，但是发现只有div具备了border属性，而p标签却没有border属性。于是我们可以得出结论：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;关于文字样式的属性，都具有继承性。这些属性包括：color、 text-开头的、line-开头的、font-开头的。&lt;/li&gt;
&lt;li&gt;关于盒子、定位、布局的属性，都不能继承。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;层叠性：处理冲突的能力（计算权重）&quot;&gt;&lt;a href=&quot;#层叠性：处理冲突的能力（计算权重）&quot; class=&quot;headerlink&quot; title=&quot;层叠性：处理冲突的能力（计算权重）&quot;&gt;&lt;/a&gt;层叠性：处理冲突的能力（计算权重）&lt;/h2&gt;&lt;p&gt;当多个选择器，选择上了某个元素的时候，要按照如下顺序统计权重：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;id 选择器&lt;/li&gt;
&lt;li&gt;类选择器、属性选择器、伪类选择器&lt;/li&gt;
&lt;li&gt;标签选择器、伪元素选择器&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;举例1：计算权重&quot;&gt;&lt;a href=&quot;#举例1：计算权重&quot; class=&quot;headerlink&quot; title=&quot;举例1：计算权重&quot;&gt;&lt;/a&gt;举例1：计算权重&lt;/h4&gt;&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/20170725_2138.png&quot; alt=&quot;img&quot;&gt;&lt;/p&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.6CSS_概览 样式表</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.6CSS/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.6CSS/</id>
    <published>2022-11-21T16:54:31.000Z</published>
    <updated>2022-11-22T09:14:32.422Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h1 id="概要"><a href="#概要" class="headerlink" title="概要"></a>概要</h1><ul><li>CSS 和 HTML 结合的三种方式：<code>行内样式表</code>、<code>内嵌样式表</code>、<code>外部样式表</code><blockquote><p>行内样式：</p><p><code>&lt;p style=&quot;color:white;background-color:red&quot;&gt;小奶包包&lt;/p&gt;</code><br>内嵌样式表：</p><pre><code class="html">&lt;style type=&quot;text/css&quot;&gt; p &#123;     font-weight: bold;     font-style: italic;     color: red; &#125;&lt;/style&gt;&lt;body&gt; &lt;p&gt;金曲大赏&lt;/p&gt; &lt;p style=&quot;color:blue&quot;&gt;b50&lt;/p&gt;&lt;/body&gt;</code></pre></blockquote></li></ul><blockquote><pre><code class="html"> &lt;link rel = &quot;stylesheet&quot; type = &quot;text/css&quot; href = &quot;a.css&quot;&gt;&lt;/link&gt;&lt;!-- 候选的样式表 --&gt;&lt;link rel = &quot;alternate stylesheet&quot; type = &quot;text/css&quot; href = &quot;b.css&quot; title=&quot;第二种样式&quot;&gt;&lt;/link&gt;  &lt;link rel = &quot;alternate stylesheet&quot; type = &quot;text/css&quot; href = &quot;c.css&quot; title=&quot;第三种样式&quot;&gt;&lt;/link&gt;</code></pre></blockquote><blockquote><p>@import url(a.css);</p><!-- 必须写在`<style>`标签中，并且必须是第一句 --></blockquote><ul><li>CSS 四种基本选择器：<code>标签选择器</code>、<code>类选择器</code>、<code>ID选择器</code>、<code>通用选择器</code></li><li>CSS 几种扩展选择器：<code>后代选择器</code>、<code>交集选择器</code>、<code>并集选择器</code></li></ul><p>语法：</p><h2 id="CSS-语法"><a href="#CSS-语法" class="headerlink" title="CSS 语法"></a>CSS 语法</h2><p><strong>语法格式：</strong>（其实就是键值对）</p><pre><code class="html">选择器&#123; 属性名: 属性值; 属性名: 属性值; &#125;</code></pre><p>或者可以写成：</p><pre><code class="css">选择器 &#123;    k: v;    k: v;    k: v;    k: v;&#125;选择器 &#123;    k: v;    k: v;    k: v;    k: v;&#125;</code></pre><p>如果一个属性有多个值的话，那么多个值用<strong>空格</strong>隔开</p><p>CSS 只有<code>/* */</code>这种注释，没有<code>//</code>这种注释。而且注释要写在<code>&lt;style&gt;</code>标签里面才算生效哦</p><h2 id="CSS-的书写方式"><a href="#CSS-的书写方式" class="headerlink" title="CSS 的书写方式"></a>CSS 的书写方式</h2><p>CSS 的书写方式，实就是问你 CSS 的代码放在哪个位置。CSS 代码理论上的位置是任意的，<strong>但通常写在<code>&lt;style&gt;</code>标签里</strong>。</p><p>CSS 的书写方式有三种：</p><ol><li><strong>行内样式</strong>：在某个特定的标签里采用 style <strong>属性</strong>。范围只针对此标签。</li><li><strong>内嵌样式</strong>（内联样式）：在页面的 head 标签里里采用<code>&lt;style&gt;</code><strong>标签</strong>。范围针对此页面。</li><li><strong>外链样式</strong>：引入外部样式表 CSS <strong>文件</strong>。这种引入方式又分为两种：<ul><li>3.1 采用<code>&lt;link&gt;</code>标签。例如：<code>&lt;link rel = &quot;stylesheet&quot; type = &quot;text/css&quot; href = &quot;a.css&quot;&gt;&lt;/link&gt;</code></li><li>3.2 采用 import 导入，必须写在<code>&lt;style&gt;</code>标签中。然后用类似于<code>@import url(a.css) ;</code>这种方式导入。</li></ul></li></ol><h2 id="CSS-的四种基本选择器"><a href="#CSS-的四种基本选择器" class="headerlink" title="CSS 的四种基本选择器"></a>CSS 的四种基本选择器</h2><p>CSS 选择器：就是指定 CSS 要作用的标签，那个标签的名称就是选择器。意为：选择哪个容器。</p><p>CSS 的选择器分为两大类：基本选择器和扩展选择器。</p><p><strong>基本选择器：</strong></p><ul><li>标签选择器：针对<strong>一类</strong>标签</li><li>ID 选择器：针对某<strong>一个</strong>特定的标签使用</li><li>类选择器：针对<strong>你想要的所有</strong>标签使用</li><li>通用选择器（通配符）：针对所有的标签都适用（不建议使用）</li></ul><h3 id="1-选择某种标签（对应标签都会被选上）"><a href="#1-选择某种标签（对应标签都会被选上）" class="headerlink" title="1-选择某种标签（对应标签都会被选上）"></a>1-选择某种标签（对应标签都会被选上）</h3><pre><code class="css">p&#123; font-size:14px; &#125;</code></pre><h3 id="2-按ID选择："><a href="#2-按ID选择：" class="headerlink" title="2-按ID选择：#"></a>2-按ID选择：#</h3><pre><code class="css">#mytitle&#123; border:3px dashed green; &#125;</code></pre><p>任何的 HTML 标签都可以有 id 属性。表示这个标签的名字。这个标签的名字，可以任取，但是：</p><ul><li>（1）只能有字母、数字、下划线。</li><li>（2）必须以字母开头。</li><li>（3）不能和标签同名。比如 id 不能叫做 body、img、a。</li></ul><p>另外，特别强调的是：<strong>HTML 页面，不能出现相同的 id，哪怕他们不是一个类型</strong>。比如页面上有一个 id 为 pp 的 p，一个 id 为 pp 的 div，是非法的！</p><h3 id="3-按class选择："><a href="#3-按class选择：" class="headerlink" title="3-按class选择：."></a>3-按class选择：.</h3><pre><code class="css">.one&#123; width:800px; &#125;</code></pre><p>一个标签可以有多个class，用空格隔开</p><hr><p>类选择器的使用，能够决定一个人的 css 水平。</p><p>比如，我们现在要做下面这样一个页面：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170711_1639.png" alt="img"></p><p>正确的思路，就是用所谓“公共类”的思路，就是我们类就是提供“公共服务”，比如有绿、大、线，一旦携带这个类名，就有相应的样式变化。对应 css 里的代码如下：</p><pre><code class="html">&lt;style type=&quot;text/css&quot;&gt;    .lv &#123;        color: green;    &#125;    .da &#123;        font-size: 30px;    &#125;    .underline &#123;        text-decoration: underline;    &#125;&lt;/style&gt;</code></pre><p>然后让每个标签去选取自己想要用的类选择器：</p><pre><code class="html">&lt;p class=&quot;lv da&quot;&gt;段落1&lt;/p&gt;&lt;p class=&quot;lv xian&quot;&gt;段落2&lt;/p&gt;&lt;p class=&quot;da xian&quot;&gt;段落3&lt;/p&gt;</code></pre><p>也就是说：</p><p>（1）不要去试图用一个类名，把某个标签的所有样式写完。这个标签要多携带几个类，共同完成这个标签的样式。</p><p>（2）每一个类要尽可能小，有“公共”的概念，能够让更多的标签使用。</p><p>问题：到底用 id 还是用 class？</p><p>答案：尽可能的用 class，除非极特殊的情况可以用 id。</p><p>原因：id 是 js 用的。也就是说，js 要通过 id 属性得到标签，所以 css 层面尽量不用 id，要不然 js 就很别扭。另一层面，我们会认为一个有 id 的元素，有动态效果。</p><p>举例如下：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/20170711_1706.png" alt="img"></p><p>上图所示，css 和 js 都在用同一个 id，会出现不好沟通的情况。</p><p>我们记住这句话：<strong>类上样式，id 上行为</strong>。意思是说，<code>class</code>属性交给 css 使用，<code>id</code>属性交给 js 使用。</p><h3 id="4-使用通配符进行匹配-不建议"><a href="#4-使用通配符进行匹配-不建议" class="headerlink" title="4-使用通配符进行匹配-不建议"></a>4-使用通配符进行匹配-不建议</h3><hr><h2 id="CSS-的几种高级选择器"><a href="#CSS-的几种高级选择器" class="headerlink" title="CSS 的几种高级选择器"></a>CSS 的几种高级选择器</h2><p><strong>高级选择器：</strong></p><h3 id="1、后代选择器-定义的时候用空格隔开"><a href="#1、后代选择器-定义的时候用空格隔开" class="headerlink" title="1、后代选择器: 定义的时候用空格隔开"></a>1、后代选择器: 定义的时候用空格隔开</h3><p>举例 1：</p><pre><code class="html">&lt;style type=&quot;text/css&quot;&gt;    .div1 p &#123;        color: red;    &#125;&lt;/style&gt;</code></pre><p>表示后代。<code>.div1 p</code> 表示<code>.div1</code>的后代所有的<code>p</code></p><p>举例 2：</p><pre><code class="html">&lt;style type=&quot;text/css&quot;&gt;    h3 b .one &#123;        color: red;    &#125;&lt;/style&gt;</code></pre><p>只要保持一个后代的关联即可.[因此直接写<code>h3 .one&#123;&#125;</code>也可]</p><p>讲到这里，我们再提一个 VS Code 的快捷键：</p><p>在 VS Code 中输入<code>p#haha</code>，按 tab 键后，会生成<code>&lt;p id=&quot;haha&quot;&gt;&lt;/p&gt;</code>。</p><p>在 VS Code 中输入<code>p.haha</code>，按 tab 键后，会生成<code>&lt;p class=&quot;haha&quot;&gt;&lt;/p&gt;</code>。</p><h3 id="2、交集选择器：定义的时候紧密相连"><a href="#2、交集选择器：定义的时候紧密相连" class="headerlink" title="2、交集选择器：定义的时候紧密相连"></a>2、交集选择器：定义的时候紧密相连</h3><p>如果后一个选择器是类选择器，则写为<code>div.special</code>；如果后一个选择器 id 选择器，则写为<code>div#special</code></p><pre><code class="css">h3.special &#123;    color: red;&#125;</code></pre><p>选择的元素要求同时满足两个条件：必须是 h3 标签，然后必须是 special 标签。</p><p>==没有空格的<code>div.red</code>（交集选择器）和有空格的<code>div .red</code>（后代选择器）不是一个意思==</p><h3 id="3、并集选择器：定义的时候用逗号隔开"><a href="#3、并集选择器：定义的时候用逗号隔开" class="headerlink" title="3、并集选择器：定义的时候用逗号隔开"></a>3、并集选择器：定义的时候用逗号隔开</h3><pre><code class="css">p,h1,.title1,#one &#123;    color: red;&#125;</code></pre><hr><h3 id="伪类（选择器"><a href="#伪类（选择器" class="headerlink" title="伪类（选择器"></a><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/04-CSS%E9%80%89%E6%8B%A9%E5%99%A8%EF%BC%9A%E4%BC%AA%E7%B1%BB.html#%E4%BC%AA%E7%B1%BB%EF%BC%88%E4%BC%AA%E7%B1%BB%E9%80%89%E6%8B%A9%E5%99%A8%EF%BC%89">伪类（选择器</a></h3><p><strong>伪类</strong>：同一个标签，根据其<strong>不同的种状态，有不同的样式</strong>。这就叫做“伪类”。伪类用冒号来表示。</p><p>比如div是属于box类，这一点很明确，就是属于box类。但是a属于什么类？不明确。因为需要看用户点击前是什么状态，点击后是什么状态。所以，就叫做“伪类”。</p><p>伪类选择器分为两种。</p><p>（1）<strong>静态伪类</strong>：只能用于<strong>超链接</strong>的样式。如下：</p><ul><li><code>:link</code> 超链接点击之前</li><li><code>:visited</code> 链接被访问过之后</li></ul><p>PS：以上两种样式，只能用于超链接。</p><p>（2）<strong>动态伪类</strong>：针对<strong>所有标签</strong>都适用的样式。如下：</p><ul><li><code>:hover</code> “悬停”：鼠标放到标签上的时候</li><li><code>:active</code> “激活”： 鼠标点击标签，但是不松手时。</li><li><code>:focus</code> 是某个标签获得焦点时的样式（比如某个输入框获得焦点）</li></ul><h2 id="超链接a标签"><a href="#超链接a标签" class="headerlink" title="超链接a标签"></a>超链接a标签</h2><h3 id="超链接的四种状态"><a href="#超链接的四种状态" class="headerlink" title="#超链接的四种状态"></a><a href="https://web.qianguyihao.com/02-CSS%E5%9F%BA%E7%A1%80/04-CSS%E9%80%89%E6%8B%A9%E5%99%A8%EF%BC%9A%E4%BC%AA%E7%B1%BB.html#%E8%B6%85%E9%93%BE%E6%8E%A5%E7%9A%84%E5%9B%9B%E7%A7%8D%E7%8A%B6%E6%80%81">#</a>超链接的四种状态</h3><p>a标签有4种伪类（即对应四种状态），要求背诵。如下：</p><ul><li><code>:link</code> “链接”：超链接点击之前</li><li><code>:visited</code> “访问过的”：链接被访问过之后</li><li><code>:hover</code> “悬停”：鼠标放到标签上的时候</li><li><code>:active</code> “激活”： 鼠标点击标签，但是不松手时。</li></ul><p>对应的代码如下：</p><pre><code class="html">&lt;style type=&quot;text/css&quot;&gt;    /*让超链接点击之前是红色*/    a:link&#123;        color:red;    &#125;    /*让超链接点击之后是绿色*/    a:visited&#123;        color:orange;    &#125;    /*鼠标悬停，放到标签上的时候*/    a:hover&#123;        color:green;    &#125;    /*鼠标点击链接，但是不松手的时候*/    a:active&#123;        color:black;    &#125;&lt;/style&gt;</code></pre><p>记住，在css中，这四种状态<strong>必须按照固定的顺序写</strong>：</p><blockquote><p>a:link 、a:visited 、a:hover 、a:active</p></blockquote><p>如果不按照顺序，那么将失效。“爱恨准则”：love hate</p><p><strong><code>a&#123;&#125;</code>和<code>a:link&#123;&#125;</code>的区别：</strong></p><ul><li><code>a&#123;&#125;</code>定义的样式针对所有的超链接(包括锚点)</li><li><code>a:link&#123;&#125;</code>定义的样式针对所有写了href属性的超链接(不包括锚点)</li></ul><p>在大量的实践中，发现不写link、visited也挺兼容。写法是：</p><blockquote><p>a:link、a:visited都是可以省略的，简写在a标签里面。也就是说，a标签涵盖了link、visited的状态（前提是都具有了相同的属性）。写法如下：</p></blockquote><pre><code class="css">        .nav ul li a&#123;            display: block;            width: 120px;            height: 50px;            text-decoration: none;            background-color: purple;            color:white;        &#125;        .nav ul li a:hover&#123;            background-color: orange;        &#125;</code></pre><p>当然了，在写<code>a:link</code>、<code>a:visited</code>这两个伪类的时候，要么同时写，要么同时不写。如果只写<code>a</code>属性和<code>a:link</code>属性，不规范。</p><h2 id="CSS3选择器"><a href="#CSS3选择器" class="headerlink" title="CSS3选择器"></a>CSS3选择器</h2><p>（单独写在后面的内容中）</p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h1 id=&quot;概要&quot;&gt;&lt;a href=&quot;#概要&quot; class=&quot;headerlink&quot; title=&quot;概要&quot;&gt;&lt;/a&gt;概要&lt;/h1&gt;&lt;ul&gt;
&lt;li&gt;CSS 和 HTML 结合的三种方式：&lt;code&gt;行内样式表&lt;/code&gt;、&lt;code&gt;内嵌样式表&lt;/code&gt;、&lt;code&gt;外部样式表&lt;/code&gt;&lt;blockquote&gt;
&lt;p&gt;行内样式：&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;p style=&amp;quot;color:white;background-color:red&amp;quot;&amp;gt;小奶包包&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;br&gt;内嵌样式表：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
 p &amp;#123;
     font-weight: bold;
     font-style: italic;
     color: red;
 &amp;#125;
&amp;lt;/style&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;p&amp;gt;金曲大赏&amp;lt;/p&amp;gt;
 &amp;lt;p style=&amp;quot;color:blue&amp;quot;&amp;gt;b50&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt; &amp;lt;link rel = &amp;quot;stylesheet&amp;quot; type = &amp;quot;text/css&amp;quot; href = &amp;quot;a.css&amp;quot;&amp;gt;&amp;lt;/link&amp;gt;
&amp;lt;!-- 候选的样式表 --&amp;gt;
&amp;lt;link rel = &amp;quot;alternate stylesheet&amp;quot; type = &amp;quot;text/css&amp;quot; href = &amp;quot;b.css&amp;quot; title=&amp;quot;第二种样式&amp;quot;&amp;gt;&amp;lt;/link&amp;gt;
  &amp;lt;link rel = &amp;quot;alternate stylesheet&amp;quot; type = &amp;quot;text/css&amp;quot; href = &amp;quot;c.css&amp;quot; title=&amp;quot;第三种样式&amp;quot;&amp;gt;&amp;lt;/link&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;@import url(a.css);&lt;/p&gt;
&lt;!-- 必须写在`&lt;style&gt;`标签中，并且必须是第一句 --&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;CSS 四种基本选择器：&lt;code&gt;标签选择器&lt;/code&gt;、&lt;code&gt;类选择器&lt;/code&gt;、&lt;code&gt;ID选择器&lt;/code&gt;、&lt;code&gt;通用选择器&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;CSS 几种扩展选择器：&lt;code&gt;后代选择器&lt;/code&gt;、&lt;code&gt;交集选择器&lt;/code&gt;、&lt;code&gt;并集选择器&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;语法：&lt;/p&gt;
&lt;h2 id=&quot;CSS-语法&quot;&gt;&lt;a href=&quot;#CSS-语法&quot; class=&quot;headerlink&quot; title=&quot;CSS 语法&quot;&gt;&lt;/a&gt;CSS 语法&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;语法格式：&lt;/strong&gt;（其实就是键值对）&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;选择器&amp;#123; 属性名: 属性值; 属性名: 属性值; &amp;#125;
&lt;/code&gt;&lt;/pre&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="CSS" scheme="http://babytoast.shop/tags/CSS/"/>
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
  </entry>
  
  <entry>
    <title>1.0.3HTML_总结</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.3html/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.3html/</id>
    <published>2022-11-19T03:19:31.000Z</published>
    <updated>2023-05-17T07:08:43.368Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h2 id="html-的常见元素"><a href="#html-的常见元素" class="headerlink" title="html 的常见元素"></a>html 的常见元素</h2><p>html 的常见元素主要分为两类：head 区域的元素、body 区域的元素。</p><h3 id="1、head-区域的-html-元素"><a href="#1、head-区域的-html-元素" class="headerlink" title="1、head 区域的 html 元素"></a>1、head 区域的 html 元素</h3><blockquote><p>head 区域的 html 元素，不会在页面上留下直接的内容。</p></blockquote><pre><code class="html">&lt;base href=&quot;/&quot;&gt;</code></pre><p>base 标签用于指定基础的路径。指定之后，所有的 a 链接都是以这个路径为基准</p><ul><li>meta</li><li>title</li><li>style</li><li>link</li><li>script</li><li>base</li></ul><h3 id="2、html-元素（body-区域）"><a href="#2、html-元素（body-区域）" class="headerlink" title="2、html 元素（body 区域）"></a>2、html 元素（body 区域）</h3><blockquote><p>body 区域的 html 元素，会直接出现在页面上。</p></blockquote><ul><li>div、section、article、aside、header、footer</li><li>p</li><li>span、em、strong</li><li>表格元素：table、thead、tbody、tr、td</li><li>列表元素：ul、ol、dl、dt、dd</li><li>a</li><li>表单元素：form、input、select、textarea、button</li></ul><p>div 是最常见的元素，大多数场景下，都可以用div（实在不行就多包几层div）。可见，<strong>div 是比较通用的元素，这也决定了 div 的的语义并不是很明确</strong>。</p><p><strong>常见标签的重要属性</strong>：</p><ul><li>a[href,target]</li><li>img[src,alt]</li><li>table td[colspan,rowspan]。设置当前单元格占据几行几列。在合并单元格时，会用到。</li><li>form[action,method,enctype]</li><li>input[type,value]</li><li>button[type]</li><li>selection&gt;option[value]</li><li>label[for]</li></ul><h3 id="html-文档的大纲"><a href="#html-文档的大纲" class="headerlink" title="html 文档的大纲"></a>html 文档的大纲</h3><p>我们平时在写论文或者其他文档的时候，一般会先列出大纲，然后再写具体的内容。</p><p>同样，html 网页也可以看成是一种文档，也有属于它的大纲。</p><p>一个常见的html文档，它的结构可以是：</p><pre><code class="html">    &lt;section&gt;        &lt;h1&gt;一级标题&lt;/h1&gt;        &lt;section&gt;            &lt;h2&gt;二级标题&lt;/h2&gt;            &lt;p&gt;段落内容&lt;/p&gt;        &lt;/section&gt;        &lt;section&gt;            &lt;h2&gt;二级标题&lt;/h2&gt;            &lt;p&gt;段落内容&lt;/p&gt;        &lt;/section&gt;        &lt;aside&gt;            &lt;p&gt;广告内容&lt;/p&gt;        &lt;/aside&gt;    &lt;/section&gt;    &lt;footer&gt;        &lt;p&gt;某某公司出品&lt;/p&gt;    &lt;/footer&gt;</code></pre><h3 id="查看网页大纲的工具"><a href="#查看网页大纲的工具" class="headerlink" title="查看网页大纲的工具"></a>查看网页大纲的工具</h3><p>我们可以通过 <a href="http://h5o.github.io/">http://h5o.github.io/</a> 这个工具查看一个网页的大纲。</p><p><strong>使用方法</strong>：</p><p>（1）将网址 <a href="http://h5o.github.io/">http://h5o.github.io/</a> 保存到书签栏</p><p>（2）去目标网页，点击书签栏的网址，即可查看该网页的大纲。</p><p>这个工具非常好用，既可以查看网页的大纲，也可以查看 markdown 在线文档的结构。</p><h2 id="html-元素的默认样式和-CSS-Reset"><a href="#html-元素的默认样式和-CSS-Reset" class="headerlink" title="html 元素的默认样式和 CSS Reset"></a>html 元素的默认样式和 CSS Reset</h2><p>比如下拉框这种比较复杂的元素，是自带默认样式的。如果没有这个默认样式，则该元素在页面上不会有任何表现，则必然增加一些工作量。</p><p>同时，默认样式也会带来一些问题：比如，有些默认样式我们是不需要的；有些默认样式甚至无法去掉。</p><p>如果我们不需要默认的样式，这里就需要引入一个概念：<strong>CSS Reset</strong>。</p><h3 id="常见的-CSS-Reset-方案"><a href="#常见的-CSS-Reset-方案" class="headerlink" title="#常见的 CSS Reset 方案"></a><a href="https://web.qianguyihao.com/01-HTML/12-HTML%E5%9F%BA%E7%A1%80%E5%9B%9E%E9%A1%BE.html#%E5%B8%B8%E8%A7%81%E7%9A%84-css-reset-%E6%96%B9%E6%A1%88">#</a>常见的 CSS Reset 方案</h3><p><strong>方案一</strong>：</p><p>CSS Tools: Reset CSS。链接：<a href="https://meyerweb.com/eric/tools/css/reset/">https://meyerweb.com/eric/tools/css/reset/</a></p><p><strong>方案二</strong>：</p><p>雅虎的 CSS Reset。链接：<a href="https://yuilibrary.com/yui/docs/cssreset/">https://yuilibrary.com/yui/docs/cssreset/</a></p><p>我们可以直接通过 CDN 的方式引入：</p><pre><code class="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css&quot;&gt;</code></pre><p><strong>方式三</strong>：（比较有争议）</p><pre><code class="css">*&#123;    margin: 0;    padding: 0;&#125;</code></pre><p>上面何种写法，比较简洁，但也有争议。有争议的地方在于，可能会导致 css 选择器的性能问题。</p><h3 id="Normalize-css"><a href="#Normalize-css" class="headerlink" title="Normalize.css"></a>Normalize.css</h3><p>上面的几种 css reset 的解决思路是：将所有的默认样式清零。</p><p>但是，<a href="https://necolas.github.io/normalize.css/">Normalize.css</a> 的思路是：既然浏览器提供了这些默认样式，那它就是有意义的。<strong>既然不同浏览器的默认样式不一致，那么，<code>Normalize.css</code>就将这些默认样式设置为一致</strong>。</p><h3 id="哪些元素可以自闭合"><a href="#哪些元素可以自闭合" class="headerlink" title="哪些元素可以自闭合"></a>哪些元素可以自闭合</h3><blockquote><p>自闭合的元素中不能再嵌入别的元素。且 HTML5 中要求加斜杠。</p></blockquote><ul><li>表单元素 input</li><li>图片 img</li><li>br、hr</li><li>meta、link</li></ul><h3 id="form-表单的作用"><a href="#form-表单的作用" class="headerlink" title="form 表单的作用"></a>form 表单的作用</h3><ul><li>直接提交表单</li><li>使用 submit / reset 按钮</li><li>便于浏览器保存表单</li><li>第三方库（比如 jQuery）可以整体获取值</li><li>第三方库可以进行表单验证</li></ul><p>所以，如果我们是通过 Ajax 提交表单数据，也建议加上 form。</p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h2 id=&quot;html-的常见元素&quot;&gt;&lt;a href=&quot;#html-的常见元素&quot; class=&quot;headerlink&quot; title=&quot;html 的常见元素&quot;&gt;&lt;/a&gt;html 的常见元素&lt;/h2&gt;&lt;p&gt;html 的常见元素主要分为两类：head 区域的元素、body 区域的元素。&lt;/p&gt;
&lt;h3 id=&quot;1、head-区域的-html-元素&quot;&gt;&lt;a href=&quot;#1、head-区域的-html-元素&quot; class=&quot;headerlink&quot; title=&quot;1、head 区域的 html 元素&quot;&gt;&lt;/a&gt;1、head 区域的 html 元素&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;head 区域的 html 元素，不会在页面上留下直接的内容。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;base href=&amp;quot;/&amp;quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;base 标签用于指定基础的路径。指定之后，所有的 a 链接都是以这个路径为基准&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;meta&lt;/li&gt;
&lt;li&gt;title&lt;/li&gt;
&lt;li&gt;style&lt;/li&gt;
&lt;li&gt;link&lt;/li&gt;
&lt;li&gt;script&lt;/li&gt;
&lt;li&gt;base&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;2、html-元素（body-区域）&quot;&gt;&lt;a href=&quot;#2、html-元素（body-区域）&quot; class=&quot;headerlink&quot; title=&quot;2、html 元素（body 区域）&quot;&gt;&lt;/a&gt;2、html 元素（body 区域）&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;body 区域的 html 元素，会直接出现在页面上。&lt;/p&gt;
&lt;/blockquote&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
    <category term="HTML5" scheme="http://babytoast.shop/tags/HTML5/"/>
    
  </entry>
  
  <entry>
    <title>1.0.2HTML_存储 缓存 网络状态</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.2html/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.2html/</id>
    <published>2022-11-18T13:34:31.000Z</published>
    <updated>2023-05-17T07:05:09.144Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><h2 id="Web-存储"><a href="#Web-存储" class="headerlink" title="Web 存储"></a>Web 存储</h2><h3 id="H5-中有两种存储的方式"><a href="#H5-中有两种存储的方式" class="headerlink" title="H5 中有两种存储的方式"></a>H5 中有两种存储的方式</h3><p>1、**<code>window.sessionStorage</code> 会话存储：**</p><ul><li>保存在内存中。</li><li><strong>生命周期</strong>为关闭浏览器窗口。也就是说，当窗口关闭时数据销毁。</li><li>在同一个窗口下数据可以共享。</li></ul><blockquote><p>在应用程序-存储-会话存储里可以看到</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221118152613329.png" alt="image-20221118152613329"></p></blockquote><p>2、**<code>window.localStorage</code> 本地存储**：</p><ul><li>有可能保存在浏览器内存里，有可能在硬盘里。</li><li>永久生效，除非手动删除（比如清理垃圾的时候）。</li><li>可以多窗口共享。</li></ul><h3 id="Web-存储的特性"><a href="#Web-存储的特性" class="headerlink" title="Web 存储的特性"></a>Web 存储的特性</h3><p>（1）设置、读取方便。</p><p>（2）容量较大，sessionStorage 约5M、localStorage 约20M。</p><p>（3）只能存储字符串，可以将对象 JSON.stringify() 编码后存储。</p><h2 id="网络状态"><a href="#网络状态" class="headerlink" title="网络状态"></a>网络状态</h2><p>我们可以通过 <code>window.onLine</code> 来检测用户当前的网络状况，返回一个布尔值。另外：</p><ul><li>window.online：用户网络连接时被调用。</li><li>window.offline：用户网络断开时被调用（拔掉网线或者禁用以太网）。</li></ul><h2 id="应用缓存"><a href="#应用缓存" class="headerlink" title="应用缓存"></a>应用缓存</h2><p>HTML5中我们可以轻松的构建一个离线（无网络状态）应用，只需要创建一个 <code>cache manifest</code> 缓存清单文件。</p><h3 id="优势"><a href="#优势" class="headerlink" title="#优势"></a><a href="https://web.qianguyihao.com/01-HTML/11-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%B8%89%EF%BC%89.html#%E4%BC%98%E5%8A%BF">#</a>优势</h3><p>1、可配置需要缓存的资源；</p><p>2、网络无连接应用仍可用；</p><p>3、本地读取缓存资源，提升访问速度，增强用户体验；</p><p>4、减少请求，缓解服务器负担。</p><h3 id="cache-manifest-缓存清单文件"><a href="#cache-manifest-缓存清单文件" class="headerlink" title="#cache manifest 缓存清单文件"></a><a href="https://web.qianguyihao.com/01-HTML/11-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%B8%89%EF%BC%89.html#cache-manifest-%E7%BC%93%E5%AD%98%E6%B8%85%E5%8D%95%E6%96%87%E4%BB%B6">#</a><code>cache manifest</code> 缓存清单文件</h3><p>缓存清单文件中列出了浏览器应缓存，以供离线访问的资源。推荐使用 <code>.appcache</code>作为后缀名，另外还要添加MIME类型。</p><p><strong>缓存清单文件里的内容怎样写：</strong></p><p>（1）顶行写CACHE MANIFEST。</p><p>（2）CACHE: 换行 指定我们需要缓存的静态资源，如.css、image、js等。</p><p>（3）NETWORK: 换行 指定需要在线访问的资源，可使用通配符（也就是：不需要缓存的、必须在网络下面才能访问的资源）。</p><p>（4）FALLBACK: 换行 当被缓存的文件找不到时的备用资源（当访问不到某个资源时，自动由另外一个资源替换）。</p><p><strong>缓存清单文件怎么用：</strong></p><p>（1）例如我们创建一个名为 <code>demo.appcache</code>的文件。例如：</p><p>demo.appcache：</p><pre><code class="bash">CACHE MANIFEST# 注释以#开头#下面是要缓存的文件CACHE:    http://img.smyhvae.com/2016040101.jpg</code></pre><p>（2）在需要应用缓存在页面的根元素(html)里，添加属性manifest=”demo.appcache”。路径要保证正确。例如：</p><pre><code class="html">&lt;!DOCTYPE html&gt;&lt;html manifest=&quot;demo.appcache&quot;&gt;&lt;head lang=&quot;en&quot;&gt;    &lt;meta charset=&quot;UTF-8&quot;&gt;    &lt;title&gt;&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;img src=&quot;http://img.smyhvae.com/2016040101.jpg&quot; alt=&quot;&quot;/&gt;&lt;/body&gt;&lt;/html&gt;</code></pre><hr><h1 id="代码部分"><a href="#代码部分" class="headerlink" title="代码部分"></a>代码部分</h1><pre><code class="html">&lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot; manifest=&quot;demo.appcache&quot;&gt;&lt;head&gt;    &lt;meta charset=&quot;UTF-8&quot;&gt;    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;    &lt;title&gt;Document&lt;/title&gt;&lt;/head&gt;&lt;body&gt;    &lt;input type=&quot;text&quot;/&gt;    &lt;button&gt;session存储&lt;/button&gt;    &lt;button&gt;session获取&lt;/button&gt;    &lt;button&gt;session更新&lt;/button&gt;    &lt;button&gt;session删除&lt;/button&gt;    &lt;button&gt;session清除&lt;/button&gt;    &lt;script&gt;     //在h5中提供两种web存储方式        // sessionStorage  session（会话，会议） 5M  当窗口关闭是数据销毁  内存        // localStorage    20M 永久生效 ，除非手动删除  清理垃圾  硬盘上        // 注意按标签查找和按属性值查找格式有区别        var txt = document.querySelector(&#39;input&#39;);        var btns = document.querySelectorAll(&#39;button&#39;);        //        sessionStorage存储数据        btns[0].onclick = function () &#123;            // 新增或者更新一个item            window.sessionStorage.setItem(&#39;userName&#39;, txt.value);            window.sessionStorage.setItem(&#39;pwd&#39;, &#39;123456&#39;);            window.sessionStorage.setItem(&#39;age&#39;, 18);        &#125;        //        sessionStorage获取数据        btns[1].onclick = function () &#123;            txt.value = window.sessionStorage.getItem(&#39;userName&#39;);        &#125;        //        sessionStorage更新数据        btns[2].onclick = function () &#123;            window.sessionStorage.setItem(&#39;userName&#39;, txt.value);        &#125;        //        sessionStorage删除数据        btns[3].onclick = function () &#123;            window.sessionStorage.removeItem(&#39;userName&#39;);        &#125;        //        sessionStorage清空数据        btns[4].onclick = function () &#123;            window.sessionStorage.clear();        &#125;    &lt;/script&gt;    &lt;pre&gt;    &lt;/pre&gt;    &lt;div&gt;        &lt;input class=&quot;local&quot; /&gt;        &lt;button&gt;local存储&lt;/button&gt;        &lt;button&gt;local获取&lt;/button&gt;        &lt;button&gt;local删除&lt;/button&gt;    &lt;/div&gt;        &lt;script&gt;        var text = document.querySelector(&quot;.local&quot;);        var btt = document.querySelectorAll(&quot;button&quot;);        btt[5].onclick = function()&#123;            window.localStorage.setItem(&#39;userName&#39;, text.value);            console.log(&#39;点击了第5个按钮&#39;);        &#125;        btt[6].onclick = function () &#123;            text.value = window.localStorage.getItem(&#39;userName&#39;);            console.log(&quot;点击了第6个按钮&quot;);            &#125;        btt[7].onclick = function()&#123;            window.localStorage.removeItem(&#39;userName&#39;);            console.log(&quot;点击了第7个按钮&quot;);        &#125;    &lt;/script&gt;    &lt;h2&gt;记住用户名和密码&lt;/h2&gt;    &lt;div class=&quot;login&quot;&gt;        用户名：&lt;input class=&quot;username_&quot;/&gt;        &lt;br/&gt;&lt;br/&gt;        密码：&lt;input class=&quot;password&quot;/&gt;        &lt;br/&gt;&lt;br/&gt;        &lt;input type=&quot;checkbox&quot; class=&quot;check&quot;/&gt;记住密码        &lt;br/&gt;&lt;br/&gt;        &lt;button class=&quot;login_bt&quot;&gt;登录&lt;/button&gt;    &lt;/div&gt;    &lt;script&gt;        var u_txt = document.querySelector(&quot;.username_&quot;);        var k_txt = document.querySelector(&quot;.password&quot;);        var chk = document.querySelector(&#39;.check&#39;);        var btn = document.querySelector(&#39;.login_bt&#39;);        // 当点击登录时，如果勾选记住密码，就存储密码，否则清除密码        btn.onclick = function()&#123;            if(chk.checked)&#123;                // 记住数据                window.localStorage.setItem(&quot;un&quot;, u_txt.value);                window.localStorage.setItem(&quot;pw&quot;,k_txt.value);            &#125;            else&#123;                // 清除数据                window.localStorage.removeItem(&quot;un&quot;);                window.localStorage.removeItem(&quot;pw&quot;);            &#125;        &#125;        // 下次登陆，如果有记录的数据，就直接填充        window.onload = function()&#123;            u_txt.value = window.localStorage.getItem(&quot;un&quot;);            k_txt.value = window.localStorage.getItem(&quot;pw&quot;);        &#125;    &lt;/script&gt;    &lt;h2&gt;网络状态监听&lt;/h2&gt;    &lt;script&gt;        window.addEventListener(&#39;online&#39;, function () &#123;            alert(&#39;网络连接建立！&#39;);        &#125;);        window.addEventListener(&#39;offline&#39;, function () &#123;            alert(&#39;网络连接断开！&#39;);        &#125;)    &lt;/script&gt;    &lt;h2&gt;应用缓存&lt;/h2&gt;    &lt;P&gt;缓存文件保存为.appcache&lt;/P&gt;    &lt;img src=&quot;http://img.smyhvae.com/2016040101.jpg&quot; alt=&quot;&quot; /&gt;&lt;/body&gt;&lt;/html&gt;</code></pre>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;h2 id=&quot;Web-存储&quot;&gt;&lt;a href=&quot;#Web-存储&quot; class=&quot;headerlink&quot; title=&quot;Web 存储&quot;&gt;&lt;/a&gt;Web 存储&lt;/h2&gt;&lt;h3 id=&quot;H5-中有两种存储的方式&quot;&gt;&lt;a href=&quot;#H5-中有两种存储的方式&quot; class=&quot;headerlink&quot; title=&quot;H5 中有两种存储的方式&quot;&gt;&lt;/a&gt;H5 中有两种存储的方式&lt;/h3&gt;&lt;p&gt;1、**&lt;code&gt;window.sessionStorage&lt;/code&gt; 会话存储：**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;保存在内存中。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;生命周期&lt;/strong&gt;为关闭浏览器窗口。也就是说，当窗口关闭时数据销毁。&lt;/li&gt;
&lt;li&gt;在同一个窗口下数据可以共享。&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;在应用程序-存储-会话存储里可以看到&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221118152613329.png&quot; alt=&quot;image-20221118152613329&quot;&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;2、**&lt;code&gt;window.localStorage&lt;/code&gt; 本地存储**：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;有可能保存在浏览器内存里，有可能在硬盘里。&lt;/li&gt;
&lt;li&gt;永久生效，除非手动删除（比如清理垃圾的时候）。&lt;/li&gt;
&lt;li&gt;可以多窗口共享。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;Web-存储的特性&quot;&gt;&lt;a href=&quot;#Web-存储的特性&quot; class=&quot;headerlink&quot; title=&quot;Web 存储的特性&quot;&gt;&lt;/a&gt;Web 存储的特性&lt;/h3&gt;&lt;p&gt;（1）设置、读取方便。&lt;/p&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
    <category term="HTML5" scheme="http://babytoast.shop/tags/HTML5/"/>
    
  </entry>
  
  <entry>
    <title>1.0.1HTML_1.0</title>
    <link href="http://babytoast.shop/LearnWeb3/1.0.1html/"/>
    <id>http://babytoast.shop/LearnWeb3/1.0.1html/</id>
    <published>2022-11-17T02:02:31.000Z</published>
    <updated>2023-05-17T07:39:45.172Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><strong>Web前端分三层</strong>：</p><ul><li>HTML（HyperText Markup Language）：超文本标记语言。从<strong>语义</strong>的角度描述页面的<strong>结构</strong>。相当于人的身体组织结构。</li><li>CSS（Cascading Style Sheets）：层叠样式表。从<strong>审美</strong>的角度美化页面的<strong>样式</strong>。相当于人的衣服和打扮。</li><li>JS：JavaScript。从<strong>交互</strong>的角度描述页面的<strong>行为</strong>。相当于人的动作，让人有生命力。</li></ul><h1 id="HTML"><a href="#HTML" class="headerlink" title="HTML"></a>HTML</h1><p>HTML标签是分等级的，HTML将所有的标签分为两种：</p><ul><li><strong>文本级标签</strong>：p、span、a、b、i、u、em。文本级标签里只能放<strong>文字、图片、表单元素</strong>。（a标签里不能放a和input）</li><li><strong>容器级标签</strong>：div、h系列、li、dt、dd。容器级标签里可以放置任何东西。</li></ul><p>从学习p的第一天开始，就要牢牢记住：<strong>p标签是一个文本级标签，p里面只能放文字、图片、表单元素</strong>。其他的一律不能放。</p><hr><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116145955120.png" alt="image-20221116145955120"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116152640350.png" alt="image-20221116152640350"></p><ul>    <li>无序标签</li>    <li>无序标签</li>    <li>无序标签</li>    <li>无序标签</li></ul><ol>    <li>有序标签</li>    <li>有序标签</li>    <li>有序标签</li></ol><p>标签实际应用场景：</p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116154121109.png" alt="image-20221116154121109"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116154135741.png" alt="image-20221116154135741"></p><p>声明：ul的儿子，只能是li。但是li是一个容器级标签，<strong>li里面什么都能放，甚至可以再放一个ul</strong>。</p><p>标准的div+css页面，只会用到种类很少的标签：</p><pre><code class="text">div  p  h1  span   a   img   ul   ol    dl    input</code></pre><hr><h1 id="HTML5"><a href="#HTML5" class="headerlink" title="HTML5"></a>HTML5</h1><h2 id="H5中新增的语义标签"><a href="#H5中新增的语义标签" class="headerlink" title="#H5中新增的语义标签"></a><a href="https://web.qianguyihao.com/01-HTML/08-HTML5%E8%AF%A6%E8%A7%A3.html#h5%E4%B8%AD%E6%96%B0%E5%A2%9E%E7%9A%84%E8%AF%AD%E4%B9%89%E6%A0%87%E7%AD%BE">#</a>H5中新增的语义标签</h2><ul><li><code>&lt;section&gt;</code> 表示区块</li><li><code>&lt;article&gt;</code> 表示文章。如文章、评论、帖子、博客</li><li><code>&lt;header&gt;</code> 表示页眉</li><li><code>&lt;footer&gt;</code> 表示页脚</li><li><code>&lt;nav&gt;</code> 表示导航</li><li><code>&lt;aside&gt;</code> 表示侧边栏。如文章的侧栏</li><li><figure> 表示媒介内容分组。</figure></li><li><code>&lt;mark&gt;</code> 表示标记 (用得少)</li><li><code>&lt;progress&gt;</code> 表示进度 (用得少)</li><li><code>&lt;time&gt;</code> 表示日期</li></ul><h3 id="H5中新增的表单类型"><a href="#H5中新增的表单类型" class="headerlink" title="H5中新增的表单类型"></a>H5中新增的表单类型</h3><ul><li><code>email</code> 只能输入email格式。自动带有验证功能。</li><li><code>tel</code> 手机号码。</li><li><code>url</code> 只能输入url格式。</li><li><code>number</code> 只能输入数字。</li><li><code>search</code> 搜索框</li><li><code>range</code> 滑动条</li><li><code>color</code> 拾色器</li><li><code>time</code> 时间</li><li><code>date</code> 日期</li><li><code>datetime</code> 时间日期</li><li><code>month</code> 月份</li><li><code>week</code> 星期</li></ul><h2 id="DOM-操作"><a href="#DOM-操作" class="headerlink" title="DOM 操作"></a>DOM 操作</h2><h3 id="获取元素"><a href="#获取元素" class="headerlink" title="#获取元素"></a><a href="https://web.qianguyihao.com/01-HTML/08-HTML5%E8%AF%A6%E8%A7%A3.html#%E8%8E%B7%E5%8F%96%E5%85%83%E7%B4%A0">#</a>获取元素</h3><ul><li>document.querySelector(“selector”) 通过CSS选择器获取符合条件的第一个元素。</li><li>document.querySelectorAll(“selector”) 通过CSS选择器获取符合条件的所有元素，以类数组形式存在。</li></ul><h3 id="类名操作"><a href="#类名操作" class="headerlink" title="#类名操作"></a><a href="https://web.qianguyihao.com/01-HTML/08-HTML5%E8%AF%A6%E8%A7%A3.html#%E7%B1%BB%E5%90%8D%E6%93%8D%E4%BD%9C">#</a>类名操作</h3><ul><li>Node.classList.add(“class”) 添加class</li><li>Node.classList.remove(“class”) 移除class</li><li>Node.classList.toggle(“class”) 切换class，有则移除，无则添加</li><li>Node.classList.contains(“class”) 检测是否存在class</li></ul><h3 id="自定义属性"><a href="#自定义属性" class="headerlink" title="#自定义属性"></a><a href="https://web.qianguyihao.com/01-HTML/08-HTML5%E8%AF%A6%E8%A7%A3.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B1%9E%E6%80%A7">#</a>自定义属性</h3><p>js 里可以通过 <code>box1.index=100;</code> <code>box1.title</code> 来自定义属性和获取属性。</p><p>H5可以直接在标签里添加自定义属性，<strong>但必须以 <code>data-</code> 开头</strong>。</p><h3 id="拖拽元素"><a href="#拖拽元素" class="headerlink" title="拖拽元素"></a>拖拽元素</h3><p>页面中设置了 <code>draggable=&quot;true&quot;</code> 属性的元素。</p><p><strong>拖拽元素的事件监听</strong>：（应用于拖拽元素）</p><ul><li><code>ondragstart</code>当拖拽开始时调用</li><li><code>ondragleave</code> 当<strong>鼠标离开拖拽元素时</strong>调用</li><li><code>ondragend</code> 当拖拽结束时调用</li><li><code>ondrag</code> 整个拖拽过程都会调用</li></ul><h3 id="目标元素"><a href="#目标元素" class="headerlink" title="目标元素"></a>目标元素</h3><p>比如说，你想把元素A拖拽到元素B里，那么元素B就是目标元素。</p><p>页面中任何一个元素都可以成为目标元素。</p><p><strong>目标元素的事件监听</strong>：（应用于目标元素）</p><ul><li><code>ondragenter</code> 当拖拽元素进入时调用</li><li><code>ondragover</code> 当拖拽元素停留在目标元素上时，就会连续一直触发（不管拖拽元素此时是移动还是不动的状态）</li><li><code>ondrop</code> 当在目标元素上松开鼠标时调用</li><li><code>ondragleave</code> 当鼠标离开目标元素时调用</li></ul><h2 id="历史"><a href="#历史" class="headerlink" title="历史"></a>历史</h2><p>界面上的所有JS操作不会被浏览器记住，就无法回到之前的状态。</p><p>在HTML5中可以通过 <code>window.history</code> 操作访问历史状态，让一个页面可以有多个历史状态</p><p><code>window.history</code>对象可以让我们管理历史记录，可用于单页面应用，Single Page Application，可以无刷新改变网页内容。</p><ul><li>window.history.forward(); // 前进</li><li>window.history.back(); // 后退</li><li>window.history.go(); // 刷新</li><li>window.history.go(n); //n=1 表示前进；n=-1 后退；n=0s 刷新。如果移动的位置超出了访问历史的边界，会静默失败，但不会报错。</li><li>通过JS可以加入一个访问状态</li><li>history.pushState; //放入历史中的状态数据, 设置title(现在浏览器不支持改变历史状态)</li></ul><h2 id="地理定位"><a href="#地理定位" class="headerlink" title="#地理定位"></a><a href="https://web.qianguyihao.com/01-HTML/10-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%BA%8C%EF%BC%89.html#%E5%9C%B0%E7%90%86%E5%AE%9A%E4%BD%8D">#</a>地理定位</h2><h3 id="获取地理信息的方式"><a href="#获取地理信息的方式" class="headerlink" title="获取地理信息的方式"></a>获取地理信息的方式</h3><h4 id="1、IP地址"><a href="#1、IP地址" class="headerlink" title="#1、IP地址"></a><a href="https://web.qianguyihao.com/01-HTML/10-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%BA%8C%EF%BC%89.html#_1%E3%80%81ip%E5%9C%B0%E5%9D%80">#</a>1、IP地址</h4><h4 id="2、三维坐标："><a href="#2、三维坐标：" class="headerlink" title="#2、三维坐标："></a><a href="https://web.qianguyihao.com/01-HTML/10-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%BA%8C%EF%BC%89.html#_2%E3%80%81%E4%B8%89%E7%BB%B4%E5%9D%90%E6%A0%87%EF%BC%9A">#</a>2、三维坐标：</h4><p>（1）<strong>GPS</strong>（Global Positioning System，全球定位系统）。</p><p>目前世界上在用或在建的第2代全球卫星导航系统（GNSS）有：</p><ul><li>1.美国 Global Positioning System （全球定位系统） 简称GPS；</li><li>2.苏联/俄罗斯 GLOBAL NAVIGATION SATELLITE SYSTEM （全球卫星导航系统）简称GLONASS（格洛纳斯）；</li><li>3.欧盟（欧洲是不准确的说法，包括中国在内的诸多国家也参与其中）Galileo satellite navigation system（伽利略卫星导航系统） 简称GALILEO（伽利略）；</li><li>4.中国 BeiDou(COMPASS) Navigation Satellite System（北斗卫星导航系统）简称 BDS ；</li><li>5.日本 Quasi-Zenith Satellite System （准天顶卫星系统） 简称QZSS ；</li><li>6.印度 India Regional Navigation Satellite System（印度区域卫星导航系统）简称IRNSS。</li></ul><p>以上6个系统中国都能使用。</p><p>（2）<strong>Wi-Fi</strong>定位：仅限于室内。</p><p>（3）<strong>手机信号</strong>定位：通过运营商的信号塔定位。</p><h3 id="API详解"><a href="#API详解" class="headerlink" title="API详解"></a>API详解</h3><ul><li>navigator.getCurrentPosition(successCallback, errorCallback, options) 获取当前地理信息</li><li>navigator.watchPosition(successCallback, errorCallback, options) 重复获取当前地理信息</li></ul><p>1、当成功获取地理信息后，会调用succssCallback，并返回一个包含位置信息的对象position：（Coords即坐标）</p><ul><li>position.coords.latitude纬度</li><li>position.coords.longitude经度</li></ul><p>2、当获取地理信息失败后，会调用errorCallback，并返回错误信息error。</p><p>3、可选参数 options 对象可以调整位置信息数据收集方式</p><h2 id="全屏"><a href="#全屏" class="headerlink" title="全屏"></a>全屏</h2><blockquote><p>HTML5规范允许用户自定义网页上<strong>任一元素</strong>全屏显示。</p></blockquote><h3 id="开启-关闭全屏显示"><a href="#开启-关闭全屏显示" class="headerlink" title="#开启/关闭全屏显示"></a><a href="https://web.qianguyihao.com/01-HTML/10-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%BA%8C%EF%BC%89.html#%E5%BC%80%E5%90%AF-%E5%85%B3%E9%97%AD%E5%85%A8%E5%B1%8F%E6%98%BE%E7%A4%BA">#</a>开启/关闭全屏显示</h3><p>方法如下：（注意 screen 是小写）</p><pre><code class="javascript">requestFullscreen()   //让元素开启全屏显示    cancleFullscreen()    //让元素关闭全屏显示</code></pre><p>为考虑兼容性问题，不同的浏览器需要<strong>在此基础之上</strong>，添加私有前缀，比如：（注意 screen 是大写）</p><pre><code class="javascript">    webkitRequestFullScreen     webkitCancleFullScreen    mozRequestFullScreen    mozCancleFullScreen</code></pre><h3 id="检测当前是否处于全屏状态"><a href="#检测当前是否处于全屏状态" class="headerlink" title="检测当前是否处于全屏状态"></a>检测当前是否处于全屏状态</h3><p>方法如下：</p><pre><code class="javascript">    document.fullScreen</code></pre><p>不同浏览器需要加私有前缀，比如：</p><pre><code class="javascript">     document.webkitIsFullScreen     document.mozFullScreen</code></pre><h3 id="全屏的伪类"><a href="#全屏的伪类" class="headerlink" title="#全屏的伪类"></a><a href="https://web.qianguyihao.com/01-HTML/10-HTML5%E8%AF%A6%E8%A7%A3%EF%BC%88%E4%BA%8C%EF%BC%89.html#%E5%85%A8%E5%B1%8F%E7%9A%84%E4%BC%AA%E7%B1%BB">#</a>全屏的伪类</h3><ul><li>:full-screen .box {}</li><li>:-webkit-full-screen {}</li><li>:moz-full-screen {}</li></ul><p>比如说，当元素处于全屏状态时，改变它的样式。这时就可以用到伪类。</p><h1 id="代碼部分"><a href="#代碼部分" class="headerlink" title="代碼部分"></a>代碼部分</h1><pre><code class="html">&lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;    &lt;meta charset=&quot;UTF-8&quot;&gt;    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;    &lt;!-- 3秒之后，自动跳转到百度页面 --&gt;    &lt;!-- &lt;meta http-equiv=&quot;refresh&quot; content=&quot;3;http://www.baidu.com&quot;&gt; --&gt;    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;    &lt;title&gt;Document&lt;/title&gt;&lt;/head&gt;&lt;body&gt;    &lt;h1&gt;H1: 小奶包包穿越自由&lt;/h1&gt;    &lt;h2&gt;H1: 小奶包包穿越自由&lt;/h2&gt;    &lt;h3&gt;H1: 小奶包包穿越自由&lt;/h3&gt;    &lt;h4&gt;H1: 小奶包包穿越自由&lt;/h4&gt;    &lt;p align=&quot;center&quot;&gt;This is a paragraph&lt;/p&gt;    &lt;!-- 水平分割线 --&gt;    &lt;hr size=&quot;5&quot; color=&quot;#F087434&quot;/&gt;    this&lt;br/&gt;is a para&lt;br/&gt;graph with line breaks    在html文本里手动换行或者空格都只会被显示为一个空格而已    &lt;p&gt;This is another paragraph&lt;/p&gt;    &lt;hr/&gt;    &lt;div&gt;        div分割的区块会单独占据一行        &lt;h3&gt;这种容器型标签可以放其他标签元素&lt;/h3&gt;    &lt;/div&gt;    测试语句    &lt;span&gt;span跟div的区别是不会换行另起 也只是文本级标签 只能放置文字 图片 表单        &lt;br/&gt;        &lt;a href=&quot;&#39;&quot;&gt;购买信息&lt;/a&gt;&lt;br/&gt;        &lt;a href=&quot;&#39;&quot;&gt;购买&lt;/a&gt;    &lt;/span&gt;    &lt;hr/&gt;    这种模式叫做“div+css” div标签负责布局、结构、分块, css负责样式    &lt;div class=&quot;header&quot;&gt;        &lt;div class=&quot;logo&quot;&gt;&lt;/div&gt;        &lt;div class=&quot;nav&quot;&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;div class=&quot;content&quot;&gt;        &lt;div class=&quot;guanggao&quot;&gt;&lt;/div&gt;        &lt;div class=&quot;dongxi&quot;&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;div class=&quot;footer&quot;&gt;&lt;/div&gt;    &lt;pre&gt;            pre标签内会保留所有空白字符(空格 换行符)但是真正排网页的过程中几乎用不着    &lt;/pre&gt;    &lt;hr/&gt;    &lt;h1&gt;字体标签和超链接&lt;/h1&gt;    &lt;p&gt;常见的转义字符：空格&amp;nbsp;小于号&amp;lt; 大于号&amp;gt; &lt;i&gt;斜体&lt;/i&gt; 或 &lt;em&gt;这样&lt;/em&gt;&lt;/p&gt;     &lt;span&gt;形如&lt;button&gt;&amp;amp;xx;&lt;/button&gt;的就是&lt;/span&gt;    &lt;br/&gt;&lt;a herf=&quot;https://www.bilibili.com/&quot;&gt;这是一个超链接跳转到外部文件&lt;/a&gt;    &lt;br/&gt;&lt;a name=&quot;anchor1&quot;&gt;&lt;u&gt;这里设置一个锚点用于从本页面其他位置跳转过来&lt;/u&gt;&lt;/a&gt;    &lt;pre&gt;    &lt;/pre&gt;    &lt;a href=&quot;#anchor1&quot;&gt;在这里的href写上#+之前设置的锚点名(用name或者id属性)就可以跳转过去&lt;/a&gt;&lt;br/&gt;    &lt;a href=&quot;mailto:shuangqinwei@gmail.com&quot;&gt;点击可以打开outlook&lt;/a&gt;    &lt;br/&gt;&lt;br/&gt;    &lt;hr/ size=&quot;4&quot; color=&quot;#6495ED&quot;&gt;    &lt;h2&gt;图片标签&lt;/h2&gt;    &lt;div&gt;        &lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116152640350.png&quot; alt=&quot;图片不可用时显示的文字&quot; title=&quot;title属性表示悬停文字&quot;&gt;        &lt;br/&gt;想要保证图片等比例缩放就只能设置width和height其中一个    &lt;/div&gt;    &lt;h2&gt;标签&lt;/h2&gt;    &lt;ul&gt;        &lt;li&gt;默认1&lt;/li&gt;        &lt;li&gt;默认2&lt;/li&gt;        &lt;li&gt;默认3&lt;/li&gt;    &lt;/ul&gt;    &lt;dl&gt;        &lt;dt&gt;dt標簽是列表的標題 必須有 容器型標簽&lt;/dt&gt;        &lt;dd&gt;dd是列表項 可以沒有 容器型標簽&lt;/dd&gt;    &lt;/dl&gt;    &lt;dl&gt;        &lt;dt&gt;金曲大賞&lt;/dt&gt;        &lt;dd&gt;            &lt;a href=&quot;#&quot;&gt;黑與白&lt;/a&gt;&lt;br&gt;            &lt;a href=&quot;#&quot;&gt;寒夜&lt;/a&gt;&lt;br&gt;            &lt;a href=&quot;#&quot;&gt;説喜歡&lt;/a&gt;&lt;br&gt;        &lt;/dd&gt;    &lt;/dl&gt;    &lt;hr size=&quot;4&quot; color=&quot;red&quot;&gt;    &lt;h2&gt;表格&lt;/h2&gt;    &lt;table border=&quot;1&quot;&gt;        &lt;tr&gt;            &lt;td&gt;line1&lt;/td&gt;            &lt;td&gt;line2&lt;/td&gt;            &lt;td rowspan=&quot;2&quot;&gt;line3&lt;/td&gt;        &lt;/tr&gt;        &lt;tr&gt;            &lt;td&gt;line1&lt;/td&gt;            &lt;td&gt;line2&lt;/td&gt;            &lt;!-- &lt;td&gt;line3&lt;/td&gt; --&gt;        &lt;/tr&gt;    &lt;/table&gt;    &lt;hr size=&quot;4&quot; color=&quot;red&quot;&gt;    &lt;h2&gt;内嵌框架&lt;/h2&gt;    &lt;a href=&quot;show1.html&quot; target=&quot;myframe&quot;&gt;默認顯示&lt;/a&gt;&lt;br&gt;    &lt;a href=&quot;show2.html&quot; target=&quot;myframe&quot;&gt;默認顯示&lt;/a&gt;&lt;br&gt;    &lt;a href=&quot;show3.html&quot; target=&quot;myframe&quot;&gt;默認顯示&lt;/a&gt;&lt;br&gt;    可以用這種方式讓上面的内容展示在下面的框中&lt;br&gt;    &lt;iframe src=&quot;show1.html&quot; name=&quot;myframe&quot; width=&quot;600&quot;&gt;&lt;/iframe&gt;    &lt;hr size=&quot;4&quot; color=&quot;red&quot;&gt;    &lt;h2&gt;表單&lt;/h2&gt;    &lt;p&gt;interact with users&lt;/p&gt;    &lt;!-- &lt;dl&gt;        &lt;dt&gt;輸入框&lt;/dt&gt;        &lt;dd&gt;&lt;input type=&quot;text&quot; value=&quot;default value&quot; /&gt;&lt;/dd&gt;        &lt;dd&gt;&lt;input type=&quot;text&quot; value=&quot;default value&quot; /&gt;&lt;/dd&gt;    &lt;/dl&gt; --&gt;    &lt;form&gt;    &lt;input type=&quot;text&quot; value=&quot;default value&quot;/&gt;&lt;br&gt;    &lt;input type=&quot;password&quot; value=&quot;1234&quot;/&gt;&lt;br&gt;    &lt;p&gt;名稱相同的radio可以組成互斥按鈕&lt;/p&gt;    &lt;input type=&quot;radio&quot; name=&quot;radio1&quot; /&gt;&lt;input type=&quot;radio&quot; name=&quot;radio1&quot; /&gt;&lt;br&gt;    &lt;p&gt;名稱相同的多選框作爲一組進行選擇&lt;/p&gt;    &lt;input type=&quot;checkbox&quot; name=&quot;cb1&quot; /&gt;&lt;input type=&quot;checkbox&quot; name=&quot;cb1&quot; /&gt;&lt;input type=&quot;checkbox&quot; name=&quot;cb1&quot; /&gt;&lt;br&gt;    &lt;input type=&quot;button&quot; value=&quot;按鈕顯示内容&quot; /&gt;&lt;br&gt;    &lt;input type=&quot;submit&quot; /&gt;&lt;br&gt;    &lt;input type=&quot;reset&quot;/&gt;&lt;br&gt;    &lt;input type=&quot;image&quot; value=&quot;圖片按鈕&quot;/&gt;&lt;br&gt;    &lt;input type=&quot;image&quot; src=&quot;img.jpg&quot; width=&quot;100&quot; value=&quot;圖片按鈕&quot;/&gt;&lt;br&gt;    &lt;input type=&quot;file&quot; value=&quot;文本選擇框&quot;/&gt;&lt;br&gt;    &lt;select&gt;        &lt;option&gt;選項1&lt;/option&gt;        &lt;option&gt;選項2&lt;/option&gt;        &lt;option&gt;選項3&lt;/option&gt;        &lt;option selected=&quot;&quot;&gt;選項4&lt;/option&gt;    &lt;/select&gt;    &lt;br&gt;&lt;br&gt;    &lt;select size=&quot;4&quot;&gt;        &lt;option&gt;op1&lt;/option&gt;        &lt;option&gt;op2&lt;/option&gt;        &lt;option&gt;op3&lt;/option&gt;        &lt;option selected=&quot;&quot;&gt;op4&lt;/option&gt;    &lt;/select&gt;    &lt;br&gt;&lt;br&gt;    &lt;textarea name=&quot;ta1&quot; rows=&quot;4&quot; cols=&quot;20&quot;&gt;多行文本輸入框&lt;/textarea&gt;    &lt;p&gt;&lt;u&gt;&lt;b&gt;這裏提一下常見的標簽label作用:讓表單元素旁邊的文字于其產生關係&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;    &lt;input type=&quot;radio&quot;/&gt;侄女(這樣點擊文字是不會選中的)&lt;br&gt;    &lt;input type=&quot;radio&quot; id=&quot;rd1&quot; /&gt;&lt;label for=&quot;rd1&quot;&gt;侄女&lt;/label&gt;    &lt;/form&gt;    &lt;h2&gt;多媒體標簽&lt;/h2&gt;    &lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;        codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0&quot; width=&quot;778&quot;        height=&quot;202&quot;&gt;        &lt;param name=&quot;movie&quot; value=&quot;images/banner.swf&quot;&gt;        &lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;        &lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;        &lt;embed src=&quot;images/banner.swf&quot; width=&quot;778&quot; height=&quot;202&quot; quality=&quot;high&quot;            pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot;            wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;    &lt;/object&gt;        &lt;/form&gt;    &lt;h2&gt;H5中新增内容&lt;/h2&gt;    &lt;p&gt;对输入框内容进行提示&lt;/p&gt;    &lt;input type=&quot;text&quot; list=&quot;data&quot;&gt;    &lt;datalist id=&quot;data&quot;&gt;        &lt;option&gt;本科&lt;/option&gt;        &lt;option&gt;研究生&lt;/option&gt;        &lt;option&gt;不明&lt;/option&gt;    &lt;/datalist&gt;    &lt;p&gt;DOM操作&lt;/p&gt;    &lt;/body&gt;&lt;/html&gt;</code></pre><pre><code class="html">&lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;    &lt;meta charset=&quot;UTF-8&quot;&gt;    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;    &lt;title&gt;Document&lt;/title&gt;    &lt;style&gt;        .box &#123;            width: 200px;            height: 200px;            background-color: green;        &#125;    &lt;/style&gt;    &lt;style&gt;        .one &#123;            width: 100px;            height: 100px;            border: 1px solid #000;            background-color: green;        &#125;            .two &#123;            position: relative;            width: 200px;            height: 200px;            left: 300px;            top: 100px;            border: 1px solid #000;            background-color: red;        &#125;    &lt;/style&gt;    &lt;style&gt;        .show &#123;            width: 250px;            height: 250px;            background-color: green;            margin: 100px auto;            border-radius: 50%;        &#125;        /*全屏伪类：当元素处于全屏时，改变元素的背景色*/        .show:-webkit-full-screen&#123;            background-color: red;        &#125;    &lt;/style&gt;&lt;/head&gt;&lt;body&gt;    &lt;h2&gt;DOM操作&lt;/h2&gt;    &lt;!-- 给标签添加自定义属性 必须以data-开头 --&gt;    &lt;div class=&quot;bb&quot; title=&quot;盒子&quot; data-my-n-ame=&quot;smyhvae&quot; data-content=&quot;我是一个div&quot;&gt;div&lt;/div&gt;    &lt;script&gt;        // LL：属性值前要加个点        // 返回的是符合条件的第一个【元素】 也就是&lt;div&gt;..&lt;/div&gt;这个完整的        var box = document.querySelector(&#39;.bb&#39;);        //自定义的属性 需要通过 dateset[]方式来获取        console.log(box.dataset[&quot;content&quot;]);  //打印结果：我是一个div        // 这里注意：对于有-的自定义属性需要大写每个开头字母（直接写-不行）        console.log(box.dataset[&quot;myNAme&quot;]);    //打印结果：smyhvae        //设置自定义属性的值        var num = 100;        num.index = 10;        // LL:在js里自定义元素属性值        box.index = 100;        box.dataset[&quot;content&quot;] = &quot;aaaa&quot;;    &lt;/script&gt;    &lt;h2&gt;拖拽&lt;/h2&gt;    &lt;input draggable=&quot;true&quot;/&gt;&lt;br&gt;&lt;br&gt;    &lt;div class=&quot;box&quot; draggable=&quot;true&quot;&gt;&lt;/div&gt;    &lt;p&gt;拖拽后监听事件&lt;/p&gt;    &lt;script&gt;        var box = document.querySelector(&quot;.box&quot;)    //  绑定拖拽事件        //  拖拽开始        box.ondragstart = function () &#123;            console.log(&#39;拖拽开始.&#39;);        &#125;        //  拖拽离开：鼠标拖拽时离开被拖拽的元素时触发        box.ondragleave = function () &#123;            console.log(&#39;拖拽离开..&#39;);        &#125;        //  拖拽结束        box.ondragend = function () &#123;            console.log(&#39;拖拽结束...&#39;);            console.log(&quot;---------------&quot;);        &#125;        box.ondrag = function () &#123;            console.log(&#39;拖拽&#39;);        &#125;    &lt;/script&gt;    &lt;div class=&quot;one&quot; draggable=&quot;true&quot;&gt;&lt;/div&gt;    &lt;div class=&quot;two&quot;&gt;&lt;/div&gt;&lt;script&gt;    var two = document.querySelector(&#39;.two&#39;);    //目标元素的拖拽事件    // 当被拖拽元素进入时触发    two.ondragenter = function () &#123;        console.log(&quot;来了.&quot;);    &#125;    // 当被拖拽元素离开时触发    two.ondragleave = function () &#123;        console.log(&quot;走了..&quot;);    &#125;    // 当拖拽元素在 目标元素上时，连续触发    two.ondragover = function (e) &#123;        //阻止拖拽事件的默认行为        // LL:实际上如果要在元素里操作点事情就需要加这个（其他地方鼠标会显示🚫）        e.preventDefault(); //【重要】一定要加这一行代码，否则，后面的方法 ondrop() 无法触发。        console.log(&quot;over...&quot;);    &#125;    // 当在目标元素上松开鼠标是触发    two.ondrop = function () &#123;        console.log(&quot;松开鼠标了....&quot;);    &#125;&lt;/script&gt;    &lt;h2&gt;历史&lt;/h2&gt;    &lt;!-- 看markdown文档 --&gt;    &lt;h2&gt;地理位置&lt;/h2&gt;    &lt;script&gt;        /*navigator 导航*/        //geolocation: 地理定位        //        window.navigator.geolocation        //        兼容处理        if (navigator.geolocation) &#123;            //       如果支持，获取用户地理信息            //            successCallback 当获取用户位置成功的回调函数            //            errorCallback 当获取用户位置失败的回调函数            navigator.geolocation.getCurrentPosition(successCallback, errorCallback);        &#125; else &#123;            console.log(&#39;sorry,你的浏览器不支持地理定位&#39;);        &#125;        // 获取地理位置成功的回调函数        function successCallback(position) &#123;            //            获取用户当前的经纬度            //            coords坐标            //            纬度latitude            var wd = position.coords.latitude;            //            经度longitude            var jd = position.coords.longitude;            console.log(&quot;获取用户位置成功！&quot;);            console.log(wd + &#39;----------------&#39; + jd);            //          40.05867366972477----------------116.33668634275229            //            谷歌地图：40.0601398850,116.3434224706            //            百度地图：40.0658210000,116.3500430000            //            腾讯高德：40.0601486487,116.3434373643        &#125;        // 获取地理位置失败的回调函数        function errorCallback(error) &#123;            console.log(error);            console.log(&#39;获取用户位置失败！&#39;)        &#125;    &lt;/script&gt;    &lt;h2&gt;全屏&lt;/h2&gt;    &lt;div class=&quot;show&quot; &gt;点击全屏&lt;/div&gt;    &lt;script&gt;        var box = document.querySelector(&#39;.show&#39;);        // box.requestFullscreen();   //直接这样写是没有效果的。之所以无效，应该是浏览器的机制，必须要点一下才可以实现全屏功能。        document.querySelector(&#39;.show&#39;).onclick = function () &#123;            // 开启全屏显示的兼容写法            if (box.requestFullscreen) &#123;  //如果支持全屏，那就让元素全屏                box.requestFullscreen();            &#125; else if (box.webkitRequestFullScreen) &#123;                box.webkitRequestFullScreen();            &#125; else if (box.mozRequestFullScreen) &#123;                box.mozRequestFullScreen();            &#125;        &#125;    &lt;/script&gt;&lt;/body&gt;&lt;/html&gt;</code></pre>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;strong&gt;Web前端分三层&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTML（HyperText Markup Language）：超文本标记语言。从&lt;strong&gt;语义&lt;/strong&gt;的角度描述页面的&lt;strong&gt;结构&lt;/strong&gt;。相当于人的身体组织结构。&lt;/li&gt;
&lt;li&gt;CSS（Cascading Style Sheets）：层叠样式表。从&lt;strong&gt;审美&lt;/strong&gt;的角度美化页面的&lt;strong&gt;样式&lt;/strong&gt;。相当于人的衣服和打扮。&lt;/li&gt;
&lt;li&gt;JS：JavaScript。从&lt;strong&gt;交互&lt;/strong&gt;的角度描述页面的&lt;strong&gt;行为&lt;/strong&gt;。相当于人的动作，让人有生命力。&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;HTML&quot;&gt;&lt;a href=&quot;#HTML&quot; class=&quot;headerlink&quot; title=&quot;HTML&quot;&gt;&lt;/a&gt;HTML&lt;/h1&gt;&lt;p&gt;HTML标签是分等级的，HTML将所有的标签分为两种：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;文本级标签&lt;/strong&gt;：p、span、a、b、i、u、em。文本级标签里只能放&lt;strong&gt;文字、图片、表单元素&lt;/strong&gt;。（a标签里不能放a和input）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;容器级标签&lt;/strong&gt;：div、h系列、li、dt、dd。容器级标签里可以放置任何东西。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;从学习p的第一天开始，就要牢牢记住：&lt;strong&gt;p标签是一个文本级标签，p里面只能放文字、图片、表单元素&lt;/strong&gt;。其他的一律不能放。&lt;/p&gt;
&lt;hr&gt;

&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116145955120.png&quot; alt=&quot;image-20221116145955120&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image-20221116152640350.png&quot; alt=&quot;image-20221116152640350&quot;&gt;&lt;/p&gt;</summary>
    
    
    
    <category term="LearnWeb3" scheme="http://babytoast.shop/categories/LearnWeb3/"/>
    
    
    <category term="前端" scheme="http://babytoast.shop/tags/%E5%89%8D%E7%AB%AF/"/>
    
    <category term="HTML5" scheme="http://babytoast.shop/tags/HTML5/"/>
    
  </entry>
  
  <entry>
    <title>博士联培项目</title>
    <link href="http://babytoast.shop/%E6%9D%82%E8%AE%B0/%E5%8D%9A%E5%A3%AB%E8%81%94%E5%9F%B9/"/>
    <id>http://babytoast.shop/%E6%9D%82%E8%AE%B0/%E5%8D%9A%E5%A3%AB%E8%81%94%E5%9F%B9/</id>
    <published>2022-11-08T01:35:01.000Z</published>
    <updated>2023-04-23T06:00:18.745Z</updated>
    
    <content type="html"><![CDATA[<link rel="stylesheet" type="text&#x2F;css" href="https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css"><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image1-19.png" alt="image1"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image2-13.png" alt="image2"><br>Data science<br><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image3-10.png" alt="image3"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image4-9.png" alt="image4"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image5-8.png" alt="image5"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image6-6.png" alt="image6"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image7-6.png" alt="image7"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image8-6.png" alt="image8"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image9-5.png" alt="image9"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image10-5.png" alt="image10"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image11-4.png" alt="image11"></p><p><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image12-4.png" alt="image12"><br><img src="https://gitee.com/Heimdall/pic-bed/raw/master/img/image13-3.png" alt="image13"></p>]]></content>
    
    
    <summary type="html">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&amp;#x2F;css&quot; href=&quot;https://cdn.jsdelivr.net/npm/hexo-tag-hint@0.3.1/dist/hexo-tag-hint.min.css&quot;&gt;&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image1-19.png&quot; alt=&quot;image1&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image2-13.png&quot; alt=&quot;image2&quot;&gt;&lt;br&gt;Data science&lt;br&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image3-10.png&quot; alt=&quot;image3&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image4-9.png&quot; alt=&quot;image4&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image5-8.png&quot; alt=&quot;image5&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image6-6.png&quot; alt=&quot;image6&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image7-6.png&quot; alt=&quot;image7&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image8-6.png&quot; alt=&quot;image8&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image9-5.png&quot; alt=&quot;image9&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://gitee.com/Heimdall/pic-bed/raw/master/img/image10-5.png&quot; alt=&quot;image10&quot;&gt;&lt;/p&gt;</summary>
    
    
    
    <category term="杂记" scheme="http://babytoast.shop/categories/%E6%9D%82%E8%AE%B0/"/>
    
    
  </entry>
  
</feed>
