作者文章

Chris Coyier

创始人、作者、设计师、垃圾邮件删除者、电子邮件个性化

文章“Google 字体 API 基础知识”的直链

Google 字体 API 基础知识

链接到 CSS 文件

你本质上是直接链接到 Google.com 上的 CSS 文件。通过 URL 参数,你可以指定你想要哪些字体,以及这些字体的哪些变体。

<head>
  
   ...

   <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine:bold,bolditalic|Inconsolata:italic|Droid+Sans">
</head>
想法:你可以避免一个…
文章“HSLa 万岁”的直链

HSLa 万岁

巨大的沉重的长裤?高强度低合金钢?不,我们说的是色相、饱和度、亮度和 alpha,它是 CSS 中声明颜色的方法。它看起来像这样

#some-element {
  background-color: hsla(170, 50%, 45%, 1);
}

它类似于…

文章“间隔”的直链

间隔

标准

你不需要创建变量,但这是一个好习惯,因为你可以使用该变量与 clearInterval 停止当前正在运行的间隔。

var int = setInterval("doSomething()", 5000 ); /* 5 seconds */
var int = 
文章“到 Wufoo”的直链

到 Wufoo

当我决定离开我的上一份工作时,我决定在夏季开始时离开。我打算在夏天无所事事地闲逛,甚至可能延长一年。…

文章“字体栈”的直链

字体栈

/* Times New Roman-based stack */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;

/* Modern Georgia-based serif stack */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream 
文章“随机数组”的直链

随机数组

技巧 #1
function Shuffle(o) {
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};

用法

var testArray = [1,2,3,4,5];
Shuffle(testArray);

// jQuery to dump out 
文章“验证 HTML 书签”的直链

验证 HTML 书签

javascript:(function(){%20function%20fixFileUrl(u)%20{%20var%20windows,u;%20windows%20=%20(navigator.platform.indexOf("Win")%20!=%20-1);%20%20/*%20chop%20off%20file:///,%20unescape%20each%20%hh,%20convert%20/%20to%20\%20and%20|%20to%20:%20*/%20%20u%20=%20u.substr(windows%20?%208%20:%207);%20u%20=%20unescape(u);%20if(windows)%20{%20u%20=%20u.replace(/\//g,"\");%20u%20=%20u.replace(/\|/g,":");%20}%20return%20u;%20}%20/*%20bookmarklet%20body%20*/%20var%20loc,fileloc;%20loc%20=%20document.location.href;%20if%20(loc.length%20>%209%20&&%20loc.substr(0,8)=="file:///")%20{%20fileloc%20=%20fixFileUrl(loc);%20if%20(prompt("Copy%20filename%20to%20clipboard,%20press%20enter,%20paste%20into%20validator%20form",%20fileloc)%20!=%20null)%20{%20document.location.href%20=%20"http://validator.w3.org/file-upload.html"%20}%20}%20else%20document.location.href%20=%20"http://validator.w3.org/check?uri="%20+%20escape(document.location.href);%20void(0);%20})();

使用以上代码创建一个书签,或者只需将以下按钮链接拖到你的书签栏。

验证 html