-
html
- 关于html头部的声明前缀,DTD(文档类型定义)十一组机器可读的规则,他们定义xml或HTML的特定版本中允许有什么,不允许有什么。浏览器在解析网页时,通过这些规则来检查网页的有效性及其采取相应的措施,浏览器通过页面的DOCTYPE声明来了解使用哪个DTD
- 普通文档流中块级元素的垂直外边距才会放生外边距叠加,行内框,浮动框或绝对定位框的外边距不会叠加。
- 行内框(行内元素),使用水平内边距,边框和外边距调整他们的水平间距,但是垂直内边距,边框和外边距不影响行内框的高度,同样在行内框上显示设置高度和宽度也没有影响。行框(包含行内框)通过设置行框的高度来设置行内框的高度。
-
javascript
- 创建原生方法:使用继承 prototype
- 变量提升:若在一个函数中,在变量声前使用了该变量,则该变量为未定义。实际是在执行时,该变量会被率先声明但是不会被赋值。
- 关于this:this总指向当前运行中的对象
- 关于call()和apply(): this.foo(arg1,arg2,arg3){} 等于 foo.call(this,arg1,arg2,arg3) 等于 foo.apply(this,arguments); 当传入的参数为固定时都可以用,当传入的参数不固定时使用apply
-
css
-
position: absolute;
An element with
position: absolute;
is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed).However; if an absolute positioned element has no positioned ancestors, it uses the document body, and moves along with page scrolling.
Note: A "positioned" element is one whose position is anything except
static
. - Hiding an element can be done by setting the
display
property tonone
. The element will be hidden, and the page will be displayed as if the element is not there:visibility:hidden;
also hides an element.However, the element will still take up the same space as before. The element will be hidden, but still affect the layout:
-
When setting the style for several link states, there are some order rules:
- a:hover MUST come after a:link and a:visited
- a:active MUST come after a:hover