<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://kangrb.github.io/atom.xml" rel="self" type="application/atom+xml" /><link href="https://kangrb.github.io/" rel="alternate" type="text/html" /><updated>2020-04-16T05:10:35+00:00</updated><id>https://kangrb.github.io/atom.xml</id><title type="html">My Blog</title><subtitle>Don't be the same,be better!</subtitle><author><name>Kang Ruibo</name><email>835794414@qq.com</email></author><entry><title type="html">CSS3学习笔记</title><link href="https://kangrb.github.io/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/CSS3%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" rel="alternate" type="text/html" title="CSS3学习笔记" /><published>2018-04-16T00:00:00+00:00</published><updated>2018-04-16T00:00:00+00:00</updated><id>https://kangrb.github.io/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/CSS3%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0</id><content type="html" xml:base="https://kangrb.github.io/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/CSS3%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">&lt;h1 align=&quot;center&quot;&gt;css3--笔记&lt;/h1&gt;

&lt;h2 id=&quot;目录&quot;&gt;目录&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;#属性选择器&quot;&gt;属性选择器&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#伪类选择器&quot;&gt;伪类选择器&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#颜色&quot;&gt;颜色&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#文字&quot;&gt;文字&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#边框圆角&quot;&gt;边框圆角&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#边框阴影&quot;&gt;边框阴影&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#背景&quot;&gt;背景&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#flex布局&quot;&gt;Flex布局&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#过度&quot;&gt;过度&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#动画&quot;&gt;动画&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#判断鼠标进入容器方向&quot;&gt;判断鼠标进入容器方向&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;属性选择器&quot;&gt;属性选择器&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;E[attr=val]&lt;/strong&gt;  eg. inoput[type=”text”]&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E[attr~=val]&lt;/strong&gt; 表示一个单独的属性值，这个属性值是以空格分隔的&lt;/li&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;**E[attr&lt;/td&gt;
          &lt;td&gt;=val]** 要么表示一个单独的属性值，要么这个属性值是以’-‘隔的&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E[attr*=val]&lt;/strong&gt; 表示的属性值里包含val字符并且在任意位置&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E[attr^=val]&lt;/strong&gt; 表示的属性值里包含val字符并且在开始位置&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E[attr$=val]&lt;/strong&gt; 表示的属性值里包含val字符并且在结束位置&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;伪类选择器&quot;&gt;伪类选择器&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;E:first-child&lt;/strong&gt; //相对于E元素的父级作参考，“所有”子元素的最后一个子元素,并且位置要对应&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:last-child&lt;/strong&gt; //相对于E元素的父级作参考，“所有”子元素的第一个子元素,并且位置要对应&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:first-of-type&lt;/strong&gt; //相对于E元素父级作参考，“特定类型元素E”的第一个子元素&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:last-of-type&lt;/strong&gt; //相对于E元素父级作参考，“特定类型元素E”的最后一个子元素&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:nth-of-type(n)&lt;/strong&gt; //选中第n个(n&amp;gt;=1,当n作为系数时n的取值可以为0)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:nth-last-child(n)&lt;/strong&gt; //以最后一个元素为起点,规定属于其父元素的第二个子元素的每个 p 元素
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;关于n的取值范围：
1. 当n作为一个独立的值时，n取值为&amp;gt;=1,例如nth-child(n)
2. 当n做一个系数时，n取值为n&amp;gt;=0或者n&amp;lt;0，例如nth-child(2n+1)、nth-child(-n+5)此处需要理解2n+1或者-n+5作为一个整体不嫩小于1;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:only-child&lt;/strong&gt; //选择的是父元素中只有一个子元素，而且只有唯一的一个子元素。也就是说，匹配的元素的父元素中仅有一个子元素，而且是一个&lt;strong&gt;唯一的子元素&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:only-of-type&lt;/strong&gt; //是表示一个元素他有很多个子元素，而其中只有一种类型的子元素是唯一的，使用“:only-of-type”选择器就可以选中这个元素中的唯一一个类型子元素&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:empty&lt;/strong&gt; //匹配没有任何子元素（包括text节点）的元素E&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:target&lt;/strong&gt; //URL后面跟锚点#，指向文档内某个具体的元素。这个被链接的元素就是目标元素(target element)，:target选择器用于选取当前活动的目标元素&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:before/E:after&lt;/strong&gt; //在每个 &amp;lt;p&amp;gt; 元素的内容之前/之后插入新内容(content:””; //必须要加！！)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:selection&lt;/strong&gt; //能定义被选择时的background-color，color及text-shadow样式&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;E:placeholder&lt;/strong&gt; //用于控制表单输入框占位符的外观，它允许开发者/设计师改变文字占位符的样式，默认的文字占位符为浅灰色&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;颜色&quot;&gt;颜色&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;opacity:1&lt;/strong&gt; //透明度（子元素会继承父元素的透明度）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;background:transparent&lt;/strong&gt; //完全透明&lt;/li&gt;
  &lt;li&gt;rgba(0,0,0,0.3) //rgb加透明度&lt;/li&gt;
  &lt;li&gt;hsla(0~360,0~100%,0~100%,0~1);&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;文字&quot;&gt;文字&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;text-shadow:h-shadow v-shadow blur color&lt;/strong&gt; //基础的文本阴影效果
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;h-shadow	必需。水平阴影的位置。允许负值
v-shadow	必需。垂直阴影的位置。允许负值
blur	可选。模糊的距离
color	可选。阴影的颜色。参阅 CSS 颜色值
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;text-overflow: ellipsis&lt;/strong&gt; //单行文本溢出,需要配合&lt;strong&gt;overflow: hidden&lt;/strong&gt;;&lt;strong&gt;white-space: nowrap&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;边框圆角&quot;&gt;边框圆角&lt;/h1&gt;
&lt;h3 id=&quot;做重合圆环时第二个圆环的位置需绝对定位left-top值需设置成圆环border-width的值的负数以便完美重合&quot;&gt;做重合圆环时，第二个圆环的位置需绝对定位，left top值需设置成圆环border-width的值的负数，以便完美重合&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;border-radius&lt;/strong&gt; 可分别设置长（纵轴）、短（横轴1）半径，以“/”进行分隔，遵循“1，2，3，4”规则&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;border-color&lt;/strong&gt; 4个值也可以分别设置&lt;/li&gt;
  &lt;li&gt;表格运用圆角需要&lt;strong&gt;border-collapse:separate&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;当圆角半径小于或等于边框宽度时，元素內解是直角&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;边框阴影&quot;&gt;边框阴影&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;box-shadow:h-shadow v-shadow blur (扩展量) color&lt;/strong&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//水平偏移量：正值向右，负值向左，垂直：正值向下，负值向上
//偏移量和扩展是可以数学运算的（扩展量是扩展4个方向上的）
h-shadow	必需。水平阴影的位置。允许负值
v-shadow	必需。垂直阴影的位置。允许负值
blur	可选。模糊的距离//从一个颜色值在一定距离内进行一个渐变至透明的过程
color	可选。阴影的颜色。参阅 CSS 颜色值
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;box-shadow:inset h-shadow v-shadow blur (扩展量) color&lt;/strong&gt;
//内阴影&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;背景&quot;&gt;背景&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;background-clip: content-box;//默认的背景填充区域，只填充内容&lt;/li&gt;
  &lt;li&gt;background-clip: padding-box;//从padding处开始填充背景&lt;/li&gt;
  &lt;li&gt;background-clip: border-box;//从border处开始填充背景&lt;/li&gt;
  &lt;li&gt;background-origin: content-box;//背景填充定位原点&lt;/li&gt;
  &lt;li&gt;background-size: 100% auto;//背景图片大小&lt;/li&gt;
  &lt;li&gt;background-repeat: no-repeat;//不平铺&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;flex布局&quot;&gt;Flex布局&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;flex是flexible-box的缩写意为弹性布局用来为盒装模型提供最大的灵活性&quot;&gt;Flex是Flexible Box的缩写，意为“弹性布局”，用来为盒装模型提供最大的灵活性&lt;/h3&gt;
    &lt;ul&gt;
      &lt;li&gt;任何一个容器都可以指定为Flex布局
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.box&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;行内元素也可以使用Flex布局
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.box&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inline-flex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;&lt;strong&gt;注意：设为Flex布局以后，子元素的float、clear和vertical-align属性将失效&lt;/strong&gt;&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;采用Flex布局的元素，称为Flex容器（flex container），简称“容器”。它的所有子元素自动成为容器成员，成为Flex项目（Flex item），简称“项目。&lt;br /&gt;
&lt;img src=&quot;/images/flex/1.png&quot; /&gt;&lt;br /&gt;
    &lt;ul&gt;
      &lt;li&gt;容器默认存在两根轴：&lt;strong&gt;水平的主轴（main axis）&lt;/strong&gt;和&lt;strong&gt;垂直的交叉轴（cross axis）&lt;/strong&gt;。主轴的开始位置（与边框的交叉点）叫做&lt;strong&gt;main start&lt;/strong&gt;，结束位置叫做&lt;strong&gt;main end&lt;/strong&gt;；交叉轴的开始位置叫做&lt;strong&gt;cross start&lt;/strong&gt;，结束位置叫做&lt;strong&gt;cross end&lt;/strong&gt;。&lt;/li&gt;
      &lt;li&gt;项目默认沿主轴排列。单个项目占据的主轴空间叫做&lt;strong&gt;main size&lt;/strong&gt;，占据的交叉轴空间叫做&lt;strong&gt;cross size&lt;/strong&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;容器属性
    &lt;ul&gt;
      &lt;li&gt;flex-direction&lt;/li&gt;
      &lt;li&gt;flex-wrap&lt;/li&gt;
      &lt;li&gt;flex-flow&lt;/li&gt;
      &lt;li&gt;justify-content&lt;/li&gt;
      &lt;li&gt;align-items&lt;/li&gt;
      &lt;li&gt;align-content&lt;/li&gt;
    &lt;/ul&gt;

    &lt;ol&gt;
      &lt;li&gt;
        &lt;h3 id=&quot;flex-direction属性&quot;&gt;flex-direction属性&lt;/h3&gt;
        &lt;p&gt;   #### flex-direction属性决定主轴的方向（即项目的排列方向）&lt;/p&gt;
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;nc&quot;&gt;.box-direction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;nl&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row-reverse&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;column&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;column-reverse&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;   &lt;img src=&quot;/images/flex/2.png&quot; /&gt;&lt;br /&gt;&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;   其属性值为：&lt;/p&gt;

&lt;p&gt;   + row（默认值）：主轴为水平方向，起点在左端。
    + row-reverse：主轴为水平方向，起点在右端。
    + column：主轴为垂直方向，起点在上沿。
    + column-reverse：主轴为垂直方向，起点在下沿。&lt;/p&gt;

&lt;p&gt;   2. flex-wrap属性
    #### 默认情况下，项目都排在一条线（又称“轴线”）上。flex-wrap属性定义，如果一条轴线排不下，如何换行。
    &lt;img src=&quot;/images/flex/3.png&quot; /&gt;&lt;br /&gt;
    &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;css
    .box{
      flex-wrap: nowrap: nowrap | wrap | wrap-reverse;
    }
    &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;       1. nowrap(默认):不换行
        &lt;img src=&quot;/images/flex/4.png&quot; /&gt;&lt;br /&gt;
        2. wrap: 换行，第一行在上方
        &lt;img src=&quot;/images/flex/5.jpg&quot; /&gt;&lt;br /&gt;
        3. wrap:-reverse:换行，第一行在下方
        &lt;img src=&quot;/images/flex/6.jpg&quot; /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;3. flex-flow
#### flex-flow属性是flex-direction属性和flex-wrap属性的简写形式，默认值为row nowrap。     ```css
.box {
  flex-flow: &amp;lt;flex-direction&amp;gt; || &amp;lt;flex-wrap&amp;gt;;
}
```

4. justify-content属性
#### justify-content属性定义了项目在主轴上的对齐方式。
```css
.box {
  justify-content: flex-start | flex-end | center | space-between | space-around;
}
```
&amp;lt;img src=&quot;/images/flex/7.png&quot;&amp;gt;&amp;lt;br&amp;gt;

它可能取5个值，具体对齐方式与轴的方向有关。下面假设主轴为从左到右:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;   + flex-start（默认值）：左对齐
    + flex-end：右对齐
    + center： 居中
    + space-between：两端对齐，项目之间的间隔都相等。
    + space-around：每个项目两侧的间隔相等。所以，项目之间的间隔比项目与边框的间隔大一倍。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;5. align-items属性
#### align-items属性定义项目在交叉轴上如何对齐。
```css
.box {
  align-items: flex-start | flex-end | center | baseline | stretch;
}
```
&amp;lt;img src=&quot;/images/flex/8.png&quot;&amp;gt;&amp;lt;br&amp;gt;

它可能取5个值。具体的对齐方式与交叉轴的方向有关，下面假设交叉轴从上到下:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;   + flex-start：交叉轴的起点对齐。
    + flex-end：交叉轴的终点对齐。
    + center：交叉轴的中点对齐。
    + baseline: 项目的第一行文字的基线对齐。
    + stretch（默认值）：如果项目未设置高度或设为auto，将占满整个容器的高度。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;6. align-content属性
#### align-content属性定义了多根轴线的对齐方式。如果项目只有一根轴线，该属性不起作用。
```css
.box {
  align-content: flex-start | flex-end | center | space-between | space-around | stretch;
}
```
&amp;lt;img src=&quot;/images/flex/9.png&quot;&amp;gt;&amp;lt;br&amp;gt;

该属性可能取6个值:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;   + flex-start：与交叉轴的起点对齐。
    + flex-end：与交叉轴的终点对齐。
    + center：与交叉轴的中点对齐。
    + space-between：与交叉轴两端对齐，轴线之间的间隔平均分布。
    + space-around：每根轴线两侧的间隔都相等。所以，轴线之间的间隔比轴线与边框的间隔大一倍。
    + stretch（默认值）：轴线占满整个交叉轴。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;项目的属性
    &lt;h4 id=&quot;以下6个属性设置在项目上&quot;&gt;以下6个属性设置在项目上。&lt;/h4&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;order&lt;/li&gt;
  &lt;li&gt;flex-grow&lt;/li&gt;
  &lt;li&gt;flex-shrink&lt;/li&gt;
  &lt;li&gt;flex-basis&lt;/li&gt;
  &lt;li&gt;flex&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;align-self&lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;order属性
  #### order属性定义项目的排列顺序。数值越小，排列越靠前，默认为0。
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nc&quot;&gt;.item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;&lt;img src=&quot;/images/flex/10.png&quot; /&gt;&lt;br /&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;flex-grow属性
  #### flex-grow属性定义项目的放大比例，默认为0，即如果存在剩余空间，也不放大。
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nc&quot;&gt;.item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;flex-grow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* default 0 */&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;&lt;img src=&quot;/images/flex/11.png&quot; /&gt;&lt;br /&gt;
  如果所有项目的flex-grow属性都为1，则它们将等分剩余空间（如果有的话）。如果一个项目的flex-grow属性为2，其他项目都为1，则前者占据的剩余空间将比其     他项多一倍。&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;flex-shrink属性
  #### flex-shrink属性定义了项目的缩小比例，默认为1，即如果空间不足，该项目将缩小。
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nc&quot;&gt;.item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;flex-shrink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;/* default 1 */&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;&lt;img src=&quot;/images/flex/12.jpg&quot; /&gt;&lt;br /&gt;
  如果所有项目的flex-shrink属性都为1，当空间不足时，都将等比例缩小。如果一个项目的flex-shrink属性为0，其他项目都为1，则空间不足时，前者不缩小。
  负值对该属性无效。&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;flex-basis属性
  #### flex-basis属性定义了在分配多余空间之前，项目占据的主轴空间（main size）。浏览器根据这个属性，计算主轴是否有多余空间。它的默认值为auto，即项目       的本来大小。
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nc&quot;&gt;.item&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;flex-basis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* default auto */&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;它可以设为跟width或height属性一样的值（比如350px），则项目将占据固定空间。&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;flex属性
  #### flex属性是flex-grow, flex-shrink 和 flex-basis的简写，默认值为0 1 auto。后两个属性可选。
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nc&quot;&gt;.item&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;flex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'flex-grow'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'flex-shrink'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;?&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'flex-basis'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;ul&gt;
          &lt;li&gt;该属性有两个快捷值：auto (1 1 auto) 和 none (0 0 auto)。&lt;/li&gt;
          &lt;li&gt;建议优先使用这个属性，而不是单独写三个分离的属性，因为浏览器会推算相关值。&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;align-self属性
  #### align-self属性允许单个项目有与其他项目不一样的对齐方式，可覆盖align-items属性。默认值为auto，表示继承父元素的align-items属性，如果没有父元       素，则等同于stretch。
        &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nc&quot;&gt;.item&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;align-self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;auto&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flex-start&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flex-end&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;center&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;baseline&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stretch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;p&gt;&lt;img src=&quot;/images/flex/13.png&quot; /&gt;&lt;br /&gt;
  该属性可能取6个值，除了auto，其他都与align-items属性完全一致。&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;过渡&quot;&gt;过渡&lt;/h1&gt;
&lt;h3 id=&quot;transition-property-duration-timing-function-delay&quot;&gt;transition: property duration timing-function delay&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;transition-property //规定设置过度效果的CSS属性的名称&lt;/li&gt;
  &lt;li&gt;transition-duration //规定完成过度效果需要多少秒或毫秒&lt;/li&gt;
  &lt;li&gt;transition-timing-function //规定速度效果的速度曲线
    &lt;ol&gt;
      &lt;li&gt;linear 规定以相同速度开始至结束的过渡效果（等于 cubic-bezier(0,0,1,1)）&lt;/li&gt;
      &lt;li&gt;ease 规定慢速开始，然后变快，然后慢速结束的过渡效果（cubic-bezier(0.25,0.1,0.25,1)）&lt;/li&gt;
      &lt;li&gt;ease-in	规定以慢速开始的过渡效果（等于 cubic-bezier(0.42,0,1,1))&lt;/li&gt;
      &lt;li&gt;ease-out 规定以慢速结束的过渡效果（等于 cubic-bezier(0,0,0.58,1)）&lt;/li&gt;
      &lt;li&gt;ease-in-out 规定以慢速开始和结束的过渡效果（等于 cubic-bezier(0.42,0,0.58,1)）&lt;/li&gt;
      &lt;li&gt;cubic-bezier(n,n,n,n) 在 cubic-bezier 函数中定义自己的值。可能的值是 0 至 1 之间的数值&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;transition-delay //定义过度效果何时开始&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;旋转&quot;&gt;旋转&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;transform: rotate; // 2D旋转&lt;/li&gt;
  &lt;li&gt;transform: rotateX/rotatrY/rotateZ; // 3D旋转&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;可以配合 perspective: 100px; 使用&lt;/strong&gt;
    &lt;ol&gt;
      &lt;li&gt;perspective-origin: 50% 50%; //默认&lt;/li&gt;
      &lt;li&gt;当为元素定义perspective属性时，&lt;strong&gt;其子元素会获得透视效果&lt;/strong&gt;，而不是元素本身。&lt;/li&gt;
      &lt;li&gt;属性只影响3D转换元素&lt;/li&gt;
      &lt;li&gt;取值为none或不设置，就没有真3D空间&lt;/li&gt;
      &lt;li&gt;取值越小，3D效果就越明显&lt;/li&gt;
      &lt;li&gt;值无穷大，或值为0时与取值为none效果一样&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;transform-style:&lt;/strong&gt; flat(平面的)/preserve-3d(表示所有子元素在3D空间中呈现)/preserve(保持原状)&lt;/li&gt;
  &lt;li&gt;transform: scale(1,1); // 括号里填倍数 2D缩放&lt;/li&gt;
  &lt;li&gt;transform: scaleX/Y/Z(1) //3D缩放&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;动画&quot;&gt;动画&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;animation-name: // 动画名称&lt;/li&gt;
  &lt;li&gt;animation-duration: // 动画持续时间&lt;/li&gt;
  &lt;li&gt;animation-play-state: // 动画状态&lt;/li&gt;
  &lt;li&gt;animation-iteration-count: // 动画播放次数&lt;/li&gt;
  &lt;li&gt;animation-fill-mode: // 动画终止时的状态&lt;/li&gt;
  &lt;li&gt;animation-direction: //动画执行的顺序&lt;/li&gt;
  &lt;li&gt;animation-timing-function: // 动画过度曲线&lt;/li&gt;
  &lt;li&gt;animation-delay: // 动画延时&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/*动画序列*/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@keyframes&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;change&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;名字&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;判断鼠标进入容器方向&quot;&gt;判断鼠标进入容器方向&lt;/h1&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mouseenter mouseleave&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 得到盒子宽度&lt;/span&gt;
     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 得到盒子高度&lt;/span&gt;
     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pageX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offsetLeft&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;// 获取x值&lt;/span&gt;
     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pageY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;offsetTop&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;// 获取y值&lt;/span&gt;
     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;direction&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;round&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((((&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;atan2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;180&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;180&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//direction的值为“0,1,2,3”分别对应着“上，右，下，左”&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;// 将点的坐标对应的弧度值换算成角度度数值&lt;/span&gt;
     &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dirName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;上方&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;右侧&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;下方&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;左侧&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mouseenter&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dirName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;direction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;进入&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dirName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;direction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;离开&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Kang Ruibo</name><email>835794414@qq.com</email></author><category term="css3" /><summary type="html">css3--笔记</summary></entry><entry><title type="html">一文了解GitHub上人气最高的十大JS框架</title><link href="https://kangrb.github.io/%E8%BD%AC%E8%BD%BD/GitHub%E4%B8%8A%E4%BA%BA%E6%B0%94%E6%9C%80%E9%AB%98%E7%9A%84%E5%8D%81%E5%A4%A7js%E6%A1%86%E6%9E%B6/" rel="alternate" type="text/html" title="一文了解GitHub上人气最高的十大JS框架" /><published>2018-04-16T00:00:00+00:00</published><updated>2018-04-16T00:00:00+00:00</updated><id>https://kangrb.github.io/%E8%BD%AC%E8%BD%BD/GitHub%E4%B8%8A%E4%BA%BA%E6%B0%94%E6%9C%80%E9%AB%98%E7%9A%84%E5%8D%81%E5%A4%A7js%E6%A1%86%E6%9E%B6</id><content type="html" xml:base="https://kangrb.github.io/%E8%BD%AC%E8%BD%BD/GitHub%E4%B8%8A%E4%BA%BA%E6%B0%94%E6%9C%80%E9%AB%98%E7%9A%84%E5%8D%81%E5%A4%A7js%E6%A1%86%E6%9E%B6/">&lt;p&gt;在这篇文章中，我们将介绍GitHub上人气最高的十大JavaScript框架&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;javascript是一种高级的解释型编程语言与htmlcss一起被认为是互联网内容工程的三大核心技术它可用于生成交互式动态网页并能够提供视频游戏等在线程序&quot;&gt;JavaScript是一种高级的解释型编程语言，与HTML、CSS一起被认为是互联网内容工程的三大核心技术，它可用于生成交互式动态网页，并能够提供视频游戏等在线程序。&lt;/h4&gt;

&lt;h2 id=&quot;react-js&quot;&gt;&lt;a href=&quot;https://doc.react-china.org/&quot;&gt;React JS&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;React JS是由Facebook创建的代码库，可以用于生成强有力的可重用用户界面组件。&lt;br /&gt;
&lt;img src=&quot;/images/React_js.webp&quot; alt=&quot;React JS&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;使用React的好处之一在于通过使用可帮助提高应用程序性能的虚拟DOM，来隐藏编程的复杂性。&lt;/li&gt;
  &lt;li&gt;React JS的功能包括：语法扩展，单向数据流，组件等等。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;vue-js&quot;&gt;&lt;a href=&quot;https://cn.vuejs.org/&quot;&gt;Vue JS&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;与React一样，Vue是构建用户喜爱的界面的另一个框架。&lt;/li&gt;
  &lt;li&gt;随着时间的推移，这个渐进式框架的设计变得越来越容易采用。因此这个代码库可以很简单地与其他项目集成，并随时使用。&lt;/li&gt;
  &lt;li&gt;Vue JS以其简单性而广为人知，除此之外，此代码库很轻，包含完整的文档，并且在开发过程中具有灵活性。&lt;/li&gt;
  &lt;li&gt;Vue鼓励开发人员编写“简单的JavaScript”。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;node-js&quot;&gt;&lt;a href=&quot;http://nodejs.cn/&quot;&gt;Node JS&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Node JS是有史以来最好的服务器端开发框架之一，它大大提高了JavaScript在服务器端脚本项目中受欢迎程度。Node JS引入了包管理工具NPM，帮助了许多程序员更加轻松地工作。&lt;/li&gt;
  &lt;li&gt;开发人员也喜欢它，是因为它提供了非阻塞（I / O）模型，可用于开发实时Web应用程序，易于学习，并且拥有大型社区。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;用node.js可以写爬虫&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;atom--中文社区&quot;&gt;&lt;a href=&quot;https://atom.io/&quot;&gt;Atom&lt;/a&gt;  &lt;a href=&quot;https://atom-china.org/&quot;&gt;中文社区&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Atom是迄今为止最好的文本编辑器之一。GitHub桌面版默认使用编辑器。&lt;br /&gt;
&lt;img src=&quot;/images/atom.webp&quot; alt=&quot;ATOM&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;与sublime text和visual studio相比，它拥有强大的功能，并能自动补齐，还继承了拼写检查，因为非常易于使用。然而，刚开始使用Atom可能会有些不便，因为你需要花费时间设置插件，才能体验其伟大之处。&lt;/li&gt;
  &lt;li&gt;不过，在Linux上安装Atom并不是那么难。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;html-5-boilerplate--中文文档&quot;&gt;&lt;a href=&quot;http://www.bootcss.com/p/html5boilerplate/&quot;&gt;HTML 5 Boilerplate&lt;/a&gt;  &lt;a href=&quot;https://www.w3cplus.com/html5/html5-boilerplate.html&quot;&gt;中文文档&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;网页的开发变得越来越复杂。迫于生产力的压力，我们不得不压缩日常的工作。而采用HTML 5 Boilerplate的项目，开发过程可以变得更加愉快。&lt;/li&gt;
  &lt;li&gt;这款最流行的前端样板框架有助于快速构建强健、适应性很强的web应用程序。&lt;/li&gt;
  &lt;li&gt;这款框架包括Normalize.css、jQuery、基于Modernize的自定义人脸识别代码库、并且拥有很高的性能。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;three-js--中文基础教程&quot;&gt;&lt;a href=&quot;https://threejs.org/&quot;&gt;Three JS&lt;/a&gt;  &lt;a href=&quot;http://www.hewebgl.com/article/articledir/1&quot;&gt;中文基础教程&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Three JS是3D计算机图形学框架之一。&lt;/li&gt;
  &lt;li&gt;Three JS利用WebGL引擎，在Web浏览器中创建漂亮的3D计算机图形。它拥有很多十分受欢迎的功能，其中包括特效和场景、相机、蒙皮网格（SkinnedMesh）和变形混合网格（morphblendmesh）动画、灯光等等。&lt;/li&gt;
  &lt;li&gt;其庞大的社区集合了大量程序员和用户，非常的活跃，因此这个项目将会稳步发展。&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://analysis.4sceners.de/#!/&quot;&gt;很棒的一个作品&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://facebook.github.io/react-vr/&quot;&gt;React VR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;meteor-js--易百教程&quot;&gt;&lt;a href=&quot;https://www.meteor.com/&quot;&gt;Meteor JS&lt;/a&gt;  &lt;a href=&quot;https://www.yiibai.com/meteor/meteor_core_api.html&quot;&gt;易百教程&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;论及为所有平台构建应用程序的框架，Meteor JS应该是迄今为止最好的应用程序之一。&lt;br /&gt;
&lt;img src=&quot;/images/meteor.webp&quot; alt=&quot;Meteor JS&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Meteor JS支持实时Web开发，简化了客户端、服务器端乃至数据库应用程序的开发，初学者可以很轻松地入门，且该框架拥有庞大的开发人员社区。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;express-js&quot;&gt;&lt;a href=&quot;http://www.expressjs.com.cn/&quot;&gt;Express JS&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Express JS是一个灵活的Node JS Web应用程序框架，可以用于开发高质量的Web和移动应用程序。&lt;/li&gt;
  &lt;li&gt;Express JS主要用于构建Web应用程序和API，在JavaScript社区中非常流行。接触过该系统的人都可能听说过MEAN栈（MongoDB、Express、AngularJS 和Node.js），Express正式该栈的后台。&lt;/li&gt;
  &lt;li&gt;Express JS加快了开发过程，易于配置和定制，并继承了大量模板引擎，可以很简单地与数据库连接。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;chart-js&quot;&gt;&lt;a href=&quot;https://chartjs.bootcss.com/&quot;&gt;Chart JS&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;对于大数据来说，数据的可视化非常重要，不仅仅是统计人员，而且对web开发人员来说也是如此。&lt;/li&gt;
  &lt;li&gt;通过Chart JS，可以在网页上显示精美的图表，从而保证数据在可视化之前不会受环境变化的影响。&lt;/li&gt;
  &lt;li&gt;Chart JS很轻很快，可用于创建响应式图表，具有清晰的文档，并支持8种图表类型。此外，Chart JS还拥有庞大的用户社区，所以可以很快找到问题的解决方法。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;yarn&quot;&gt;&lt;a href=&quot;https://yarn.bootcss.com/&quot;&gt;Yarn&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;这是一个JavaScript包管理工具，有助于简化开发过程。&lt;/li&gt;
  &lt;li&gt;与React一样，Yarn是由Facebook开发的，可以认为它是NPM工具的改良版，因为它支持并行操作，这是npm所没有的功能，且可以更有效地利用了网络。&lt;/li&gt;
  &lt;li&gt;Yarn受欢迎的原因包括：更快地的执行速度、强大的工作系统、许可检查功能、以及与NPM和和Bower软件包管理工具的完美兼容。&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;转载自：&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MjM5MjAwODM4MA==&amp;amp;mid=2650696656&amp;amp;idx=1&amp;amp;sn=aa44600288bbce5edd21953bccac00ca&amp;amp;chksm=bea61a0389d193159cd3d8dda1910d65cdab7ccee04f0a3a680ab5d824ae4d36cf318da5365d&amp;amp;mpshare=1&amp;amp;scene=23&amp;amp;srcid=0415VAiZbF9atiH7lVo76hQI#rd&quot;&gt;CSDN&lt;/a&gt;&lt;br /&gt;
译者：弯月，编辑：言则&lt;br /&gt;
&lt;a href=&quot;https://boostlog.io/@junp1234/top-10-popular-javascript-projects-on-github-5abf4e2c0814730093a2f026&quot;&gt;查看原文&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;我自己添加了各框架的文档链接地址&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;</content><author><name>Kang Ruibo</name><email>835794414@qq.com</email></author><category term="JavaScript" /><summary type="html">在这篇文章中，我们将介绍GitHub上人气最高的十大JavaScript框架</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://kangrb.github.io/images/640.gif" /><media:content medium="image" url="https://kangrb.github.io/images/640.gif" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">HTML5学习笔记</title><link href="https://kangrb.github.io/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/HTML5%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" rel="alternate" type="text/html" title="HTML5学习笔记" /><published>2018-04-16T00:00:00+00:00</published><updated>2018-04-16T00:00:00+00:00</updated><id>https://kangrb.github.io/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/HTML5%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0</id><content type="html" xml:base="https://kangrb.github.io/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/HTML5%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">&lt;h1 align=&quot;center&quot;&gt;html5--笔记&lt;/h1&gt;

&lt;h2 id=&quot;目录&quot;&gt;目录&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;#避免变量名污染的方式&quot;&gt;避免变量名污染的方式&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#input-type类型&quot;&gt;input-type类型&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#获取自定义数据集&quot;&gt;.dataset[] 获取自定义数据集&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#svg&quot;&gt;SVG&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#html5-新选择器&quot;&gt;html5 新选择器&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#添加事件监听&quot;&gt;添加事件监听&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#elementclasslist&quot;&gt;Element.classList&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#访问历史api&quot;&gt;访问历史API&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#全屏api&quot;&gt;全屏API&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#cssjs注入内容&quot;&gt;css/js注入内容&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#应用缓存&quot;&gt;应用缓存&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-storage-网页存储&quot;&gt;Web Storage 网页存储&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#文件api&quot;&gt;文件API&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#拖拽操作&quot;&gt;拖拽操作&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;避免变量名污染的方式&quot;&gt;避免变量名污染的方式&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;html5 自执行函数
    &lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;jQuary $
    &lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;input-type类型&quot;&gt;input-type类型&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;button(单机按钮)&lt;/li&gt;
  &lt;li&gt;checkbox(复选框)&lt;/li&gt;
  &lt;li&gt;file(文件上传)&lt;/li&gt;
  &lt;li&gt;hidden(隐藏的输入字段)&lt;/li&gt;
  &lt;li&gt;image(图像形式的提交按钮)&lt;/li&gt;
  &lt;li&gt;password(密码字段)&lt;/li&gt;
  &lt;li&gt;radio(单选按钮)&lt;/li&gt;
  &lt;li&gt;reset(重置按钮)&lt;/li&gt;
  &lt;li&gt;submit(提交按钮)&lt;/li&gt;
  &lt;li&gt;text(文本)
    &lt;h2 id=&quot;html5中type类型&quot;&gt;html5中type类型：&lt;/h2&gt;
    &lt;h3 id=&quot;email&quot;&gt;email&lt;/h3&gt;
    &lt;p&gt;(email 类型用于应该包含 e-mail 地址的输入域。在提交表单时，会自动验证 email 域的值。)&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;url&quot;&gt;url&lt;/h3&gt;
&lt;p&gt;(url 类型用于应该包含 URL 地址的输入域。在提交表单时，会自动验证 url 域的值。)&lt;/p&gt;

&lt;h3 id=&quot;number&quot;&gt;number&lt;/h3&gt;
&lt;p&gt;(number 类型用于应该包含数值的输入域。您还能够设定对所接受的数字的限定：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Points: &amp;lt;input type=&quot;number&quot; name=&quot;points&quot; min=&quot;1&quot; max=&quot;10&quot; step=&quot;2&quot; value=&quot;6&quot;/&amp;gt; (value为默认值 step为步长)&lt;/code&gt;)&lt;/p&gt;

&lt;h3 id=&quot;range&quot;&gt;range&lt;/h3&gt;
&lt;p&gt;(range 类型用于应该包含一定范围内数字值的输入域。range 类型显示为滑动条。您还能够设定对所接受的数字的限定：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;input type=&quot;range&quot; name=&quot;points&quot; min=&quot;1&quot; max=&quot;10&quot; /&amp;gt;&lt;/code&gt;)&lt;/p&gt;

&lt;h3 id=&quot;date-pickers&quot;&gt;date pickers:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;date 选取日、月、年&lt;/li&gt;
  &lt;li&gt;month 选取月、年&lt;/li&gt;
  &lt;li&gt;week 选取周和年&lt;/li&gt;
  &lt;li&gt;time 选取时间（小时和分钟）&lt;/li&gt;
  &lt;li&gt;datetime 选取时间、日、月、年（UTC 时间）&lt;/li&gt;
  &lt;li&gt;datetime-local 选取时间、日、月、年（本地时间）&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;search&quot;&gt;search&lt;/h3&gt;
&lt;p&gt;(search 类型用于搜索域，比如站点搜索或 Google 搜索。search 域显示为常规的文本域。)&lt;/p&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;dataset-获取自定义数据集&quot;&gt;.dataset[] 获取自定义数据集&lt;/h1&gt;
&lt;p&gt;event.prenventDefault(); 取消事件的默认动作&lt;/p&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;svg&quot;&gt;SVG&lt;/h1&gt;
&lt;h2 id=&quot;scalable-vector-graphics-可缩放矢量图形&quot;&gt;Scalable Vector Graphics 可缩放矢量图形&lt;/h2&gt;
&lt;h3 id=&quot;优势体积小质量高效果好可控程度高&quot;&gt;优势：体积小，质量高，效果好，可控程度高&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;以文件方式载入方式：
    &lt;ol&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;**&amp;lt;iframe src=&quot;demo.svg&quot; frameborder=&quot;0&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;object data=&quot;demo.svg&quot; type=&quot;&quot;&amp;gt;&amp;lt;/object&amp;gt;&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;embed src=&quot;demo.svg&quot; type=&quot;&quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;/code&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;直接把svg代码复制进html中&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;html5-新选择器&quot;&gt;html5 新选择器&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;返回第一个满足选择器条件的元素，一个dom对象
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;document.querySelector(selector);&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;返回所有满足该条件的元素，一个元素类型是dom类型的数组
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;document.querySelectorAll(selector);&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;类比jQuery的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$('.item')&lt;/code&gt;&lt;/strong&gt;是返回一个jQuary对象(dom元素的数组)
本质上jQuery方式和querySelector方式都是获取DOM数组，只不过jQuery会多一些其他成员
&lt;strong&gt;dom数组的每一个成员注册事件不能像jQuery一样直接注册，需要遍历每个子元素分别注册&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;h5就是将我们经常需要的操作又包装了一层&quot;&gt;h5就是将我们经常需要的操作又包装了一层&lt;/h3&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;添加事件监听&quot;&gt;添加事件监听&lt;/h1&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;element.addEventListener('click',function(e){
  ...
  e.perventDefault();//阻止默认事件
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;elementclasslist&quot;&gt;Element.classList&lt;/h1&gt;
&lt;h2 id=&quot;输出element拥有的class的数组&quot;&gt;输出Element拥有的class的数组&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Element.classList.add('classAttr');//添加类&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Element.classList.remove('classAttr');//移除类&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Element.classList.toggle('classAttr',true/false);//切换事件,true为添加、false为删除&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ELement.classList.contains('classAttr')//判断当前classlist中有没有classAttr这个属性;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;访问历史api&quot;&gt;访问历史API&lt;/h1&gt;
&lt;h3 id=&quot;在此之前可以使用window对象实现前进后退和刷新之类的操作&quot;&gt;在此之前可以使用window.对象实现前进、后退和刷新之类的操作&lt;/h3&gt;
&lt;h3 id=&quot;标准键值keyval&quot;&gt;标准键值?key=val&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.history.forword();//前进&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.history.back();//后退&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.history.go();//刷新（可传入url不写是本页面）&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;新加入的API&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.history.pushState(state,title,url);//url='?+t'+title&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//当我们在伪造访问历史记录的前进或后退时会执行一个popstate事件
window.addEventListener('popstate',function(e){
  //e.state = title;
});
//第一次请求过来，获取地址栏中的t参数
var title = window.location.search.split('=')[1];
title = decodeURI(title);//decodeURI作用是将URL编码转换到之前的状态
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;全屏api&quot;&gt;全屏API&lt;/h1&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var element = 需要全屏的元素;
fi(elememt.webkitRequestFullScreen){
  element.webkitRequestFullScreen();
}
else if(element.mozRequestFullScreen){
  element.mozRequestFullScreen();
}
// 标准函数：
else if(element.requestFullScreen){
  element.reuqestFullScreen();
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;cssjs注入内容&quot;&gt;css/js注入内容&lt;/h1&gt;
&lt;h2 id=&quot;css使用before-after伪类注入before是元素开始的时候在元素内部&quot;&gt;css使用::before  ::after伪类注入（before是元素开始的时候，在元素内部）&lt;/h2&gt;
&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;::before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;'css注入的内容'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;js&quot;&gt;js&lt;/h2&gt;
&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;js注入的内容&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;应用缓存&quot;&gt;应用缓存&lt;/h1&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;html lang=&quot;en&quot; manifest=&quot;cache.manifest&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;需要创建一个cache.manifest文件&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-manifest&quot;&gt;CACHE MANIFEST
# version 1.0.0

CACHE:			//缓存的文件
  index.html
  script.js
  style.css
			//这一行有一个Tab缩进
NETWORK:		//联网状态下可访问的文件
  *
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;web-storage-网页存储&quot;&gt;Web Storage 网页存储&lt;/h1&gt;
&lt;h2 id=&quot;localstorage本地存储--sessionstorage会话存储&quot;&gt;localStorage本地存储    sessionStorage会话存储&lt;/h2&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var btnSet = document.querySelector('#btn_set');
var btnGet = document.querySelector('#btn_get');
var txtValue = document.querySelector('#txt_value');
btnGet.addEventListener('click',function(){
  if(window.localStorage)
    //txtValue.value = localStorage.getItem('key1');获取一个不存在的键，返回空字符串
    txtValue.value = localStorage['key1'];//获取一个不存在的键，返回undefined
});
btnSet.addEventListener('click',function(){
  localStorage['key1'] = txtValue.value;
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;文件api&quot;&gt;文件API&lt;/h1&gt;
&lt;h3 id=&quot;提供客户端本地操作文件的可能&quot;&gt;提供客户端本地操作文件的可能&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;对于表单里的input来说：可以直接通过name找到元素//document.form[0].input_file&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;form&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;input_file&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;input_file&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;multiple&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;//multiple可多选文件
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;

&lt;h1 id=&quot;拖拽操作&quot;&gt;拖拽操作&lt;/h1&gt;
&lt;h3 id=&quot;dragdrop-拖放&quot;&gt;drag&amp;amp;drop  拖&amp;amp;放&lt;/h3&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var target = document.querySelector('#target');//找到拖拽目标框
target.addEventListener('dragenter',function(){
  //添加拖拽进去事件
});
target.addEventListener('dragleave',function(){
  //添加拖拽离开事件
});
target.addEventListener('dragover',function(e){
  //如果想要捕获drop事件，就一定要在该事件中阻止默认事件
  e.preventDefault();
  e.stopPropagation();//阻止事件冒泡
});
target.addEventListener('drop',function(e){
  //把元素放在该对象中
  if(e.dataTransfer.files.length){
  //拖拽文件
    var files = e.dataTansfer.files;
    for(var i = 0;i &lt;span class=&quot;nt&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;++){&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;li = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;document.createElement('li');&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;('&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;','&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;list-group-item&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;')&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;li.innerHTML = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'&amp;lt;h5 class=&quot;list-group-item-heading&quot;&amp;gt;'&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&amp;lt;/&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;h5&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;p&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;list-group-item-text&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;'
	+ files[i].lastModifiedDate.toLocaleDateString() + ' '
	+ files[i].lastModifiedDate.toLocaleTimeString() + ' '
	+ (files[i].size / 1024).toFixed(2) + 'KB&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;';
      fileList.appendChild(li);
    }
  }else{
    //var data = e.dataTransfer.getData('text/plain') || e.dataTransfer.getData('text/uri-list');//短路运算
    var data = e.dataTransfer.getData('text/plain');
    if(data){
      //拖入的是文本
      target.innerHTML = data;
    }else{
      //拖入的是图片
      var img = document.createElement('img');
      img.src = e.dataTransfer.getData('text/uri-list');

      e.preventDefault();
      e.stopPropagation();
    }
  }
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 align=&quot;right&quot;&gt;&lt;a href=&quot;#目录&quot;&gt;返回目录&lt;/a&gt;&lt;/h3&gt;</content><author><name>Kang Ruibo</name><email>835794414@qq.com</email></author><category term="html5" /><summary type="html">html5--笔记</summary></entry><entry><title type="html">使用Jekyll和GitHub搭建个人博客</title><link href="https://kangrb.github.io/%E5%BF%83%E5%BE%97/%E6%8A%80%E6%9C%AF/Blog-Build/" rel="alternate" type="text/html" title="使用Jekyll和GitHub搭建个人博客" /><published>2018-04-15T00:00:00+00:00</published><updated>2018-04-15T00:00:00+00:00</updated><id>https://kangrb.github.io/%E5%BF%83%E5%BE%97/%E6%8A%80%E6%9C%AF/Blog-Build</id><content type="html" xml:base="https://kangrb.github.io/%E5%BF%83%E5%BE%97/%E6%8A%80%E6%9C%AF/Blog-Build/">&lt;h4 id=&quot;写在前面的话&quot;&gt;写在前面的话&lt;/h4&gt;
&lt;p&gt;搭建这个小博客的目的一是为了记录自己学习全栈开发的过程和遇到的问题，二是为了将无意看到的比较好的文章收录下来，方便以后能很快的找到并查看。&lt;/p&gt;

&lt;h1 id=&quot;使用的技术&quot;&gt;使用的技术&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt; 是可以将静态网页托管在GitHub上的技术。用户可以使用GitHub Pages提供的或者一些开源主题来显示自己的GitHub Pages主页，当然也可以自己设计。
    &lt;ul&gt;
      &lt;li&gt;可以将自己的静态html文件托管在GitHub上，在这个Repository的网址前加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://htmlpreview.github.io/?&lt;/code&gt;便可在线查看页面。eg.&lt;a href=&quot;http://htmlpreview.github.io/?https://github.com/KangRB/2017.12-ke-cheng-shi-ji/blob/master/index.html&quot;&gt;点我查看dome&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.jekyll.com.cn/&quot;&gt;Jekyll&lt;/a&gt; 将纯文本转化为静态网站和博客。&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/mmistakes/so-simple-theme&quot;&gt;So Simple Theme&lt;/a&gt; 一个简单的Jekyll主题，可以为自己的文章和图片文章提供清晰的排版，响应式布局，完美适配了移动端。&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;过程&quot;&gt;过程&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;首先在电脑上安装Windows上运行的Jekyll &lt;a href=&quot;http://jekyll-windows.juthilo.com/1-ruby-and-devkit/&quot;&gt;这里是官方教程&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;克隆主题
    &lt;blockquote&gt;
      &lt;p&gt;有3个安装主题的方法&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;如果正在运行Jekyll v3.5 + 自行托管，则可以快速将主题安装为Ruby gem。
    &lt;ol&gt;
      &lt;li&gt;将以下代码添加到自己的jekyll网站Gemfile
        &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby gem &quot;jekyll-theme-so-simple&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;将以下代码添加到自己的jekyll网站的_config.yml文件中
        &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yaml theme: jekyll-theme-so-simple
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;然后运行Bundler来安装 theme gem 和依赖关系
        &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;terminal bundle install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
      &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;可以安装为远程主题
    &lt;blockquote&gt;
      &lt;p&gt;GitHub Pages增加了对任何GitHub托管主题的全面支持。&lt;/p&gt;
    &lt;/blockquote&gt;

    &lt;ol&gt;
      &lt;li&gt;替换&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gem &quot;jekyll&quot;&lt;/code&gt;为：
        &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby gem &quot;github-pages&quot;, group: :jekyll_plugins
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;运行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bundle update&lt;/code&gt;并验证所有gem安装正确&lt;/li&gt;
      &lt;li&gt;添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;remote_theme: &quot;mmistakes/so-simple-theme&quot;&lt;/code&gt;到_config.yml文件并删除任何其他&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;theme:&lt;/code&gt;或&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;remote_theme:&lt;/code&gt;条目&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;直接将所有主题文件复制到项目中
可以删除不必要的文件和文件夹：
    &lt;ul&gt;
      &lt;li&gt;.github&lt;/li&gt;
      &lt;li&gt;docs&lt;/li&gt;
      &lt;li&gt;example&lt;/li&gt;
      &lt;li&gt;.editorconfig&lt;/li&gt;
      &lt;li&gt;.gitattributes&lt;/li&gt;
      &lt;li&gt;banner.js&lt;/li&gt;
      &lt;li&gt;CHANGELOG.md&lt;/li&gt;
      &lt;li&gt;Gemfile&lt;/li&gt;
      &lt;li&gt;jekyll-theme-so-simple.gemspec&lt;/li&gt;
      &lt;li&gt;package.json&lt;/li&gt;
      &lt;li&gt;Rakefile&lt;/li&gt;
      &lt;li&gt;README.md&lt;/li&gt;
      &lt;li&gt;README-OLD.md&lt;/li&gt;
      &lt;li&gt;screenshot.png&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;#### 我用的第三种方法，直接复制粘贴
  直接复制粘贴后需要在根目录下添加index.html文件，这里就可以使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/example/index.html&lt;/code&gt;example目录中的index.html文件，并且如果需要其他如post、categories、tags、search等页面，就直接把example目录中对应的md文件复制进项目根目录中。其他修改项就根据README.md提供的教程自定义修改、添加自己想要的功能&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;将项目托管于GitHub
    &lt;ul&gt;
      &lt;li&gt;申请github账号&lt;/li&gt;
      &lt;li&gt;创建名称为USERNAME.github.io(USERNAME为自己的用户名)的仓库&lt;/li&gt;
      &lt;li&gt;用&lt;a href=&quot;https://desktop.github.com/&quot;&gt;GitHub桌面版&lt;/a&gt;Push到新建的仓库中&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;将写好的md格式的文章存储在根目录下的_post文件夹中
    &lt;ul&gt;
      &lt;li&gt;文件名格式：yyyy-mm-dd-标题&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;总结&quot;&gt;总结&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;经过一个周末的倒腾，尝试了很多主题，最后选择了这个界面简洁明了的开源主题。&lt;/li&gt;
  &lt;li&gt;在安装本地Jekyll环境，和迁移这个主题的过程中遇到了很多困难。&lt;/li&gt;
  &lt;li&gt;因为对整个主题的结构不熟悉，又看到那么长篇幅的英文说明文档，从而失去了耐心。&lt;/li&gt;
  &lt;li&gt;但是这个主题深深吸引了我，非常喜欢这种简洁明了的风格，因此沉住气仔细阅读了READEME说明。&lt;/li&gt;
  &lt;li&gt;经过仔细了解主题整体结构，踩过很多坑后，终于成功将网页搭建起来。&lt;/li&gt;
  &lt;li&gt;修改了一些小内容，为的是自己看起来舒服些。
    &lt;h2 id=&quot;end&quot;&gt;END&lt;/h2&gt;
    &lt;p&gt;这个Jekyll主题有很多可选功能，类似基于Disqus的评论功能，还有在文章中加入目录的插件。
详细参考&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;README.md&lt;/code&gt;说明。&lt;strong&gt;在此感谢此主题的维护者们。&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;</content><author><name>Kang Ruibo</name><email>835794414@qq.com</email></author><category term="GitHub Pages" /><category term="jekyll" /><summary type="html">写在前面的话 搭建这个小博客的目的一是为了记录自己学习全栈开发的过程和遇到的问题，二是为了将无意看到的比较好的文章收录下来，方便以后能很快的找到并查看。</summary></entry></feed>