* 到css参考手册网站
http://css.doyoe.com/
下载chm手册
* 到github下载对应的html页面
cd /Applications/XAMPP/htdocs git clone https://github.com/doyoe/css-handbook
或者从百度云盘 密码: sgvk
* 启动xampp
* 浏览器访问 本地css手册
http://localhost/css-handbook/index.htm
function copyToClipboard(text) {
if (text.indexOf('-') !== -1) {
let arr = text.split('-');
text = arr[0] + arr[1];
}
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.padding = '0';
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? '成功复制到剪贴板' : '该浏览器不支持点击复制到剪贴板';
alert(msg);
} catch (err) {
alert('该浏览器不支持点击复制到剪贴板');
}
document.body.removeChild(textArea);
}
var a = document.createElement("a");
a.href = "javascript:;";
a.innerHTML = "复制密码到剪贴板";
a.setAttribute("data-text", "sgvk");
document.body.appendChild(a);
a.style.backgroundColor = "#214fa0";
a.style.color = "#fff"
a.style.right = 0;
a.style.top = 0;
a.style.display = "block";
a.style.position = "fixed";
a.style.zIndex = 3;
a.style.borderRadius = "4px";
a.style.padding = "2px 4px";
a.style.cursor = "pointer";
a.onclick = function() {
var text = this.getAttribute("data-text");
copyToClipboard(text);
var that = this;
setTimeout(function() {
that.style.display = "none";
}, 100);
};