作者的文章

Chris Coyier

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

文章的直接链接 添加用户代理的数据属性

添加用户代理的数据属性

var b = document.documentElement;
b.className = b.className.replace('no-js', 'js');
b.setAttribute("data-useragent",  navigator.userAgent);
b.setAttribute("data-platform", navigator.platform );

这导致数据属性被添加到 html 元素中,例如

<html 
	data-useragent="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 
文章的直接链接 三角形列表符号

三角形列表符号

ul {
  margin: 0.75em 0;
  padding: 0 1em;
  list-style: none;
}
li::before { 
  content: "";
  border-color: transparent #111;
  border-style: solid;
  border-width: 0.35em 0 0.35em 0.45em;
  display: block;
  height: 0;
  width: 0;
  left: -1em;
  top: 0.9em;
  position: relative;
}

这是一个……