Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

A mercer08

🎯
Focusing
View GitHub Profile
@mercer08
mercer08 / shadowBg.css
Last active Aug 4, 2017
通过阴影来弱化背景(rgba) CSS SECRET
View shadowBg.css
.overlay{ /*用于遮挡背景*/
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,.8);
}
.lightbox{ /*用于吸引用户注意的元素*/
@mercer08
mercer08 / button.css
Last active Aug 4, 2017
button style code from css secrets
View button.css
button{
padding: .3em .8em;
border: 1px solid rgba(0,0,0,.1);
background: #58a linear-gradient(hsla(0,0%,100%,.2),transparent);
border-radius: .2em;
box-shadow: 0 .05em .25em rgba(0,0,0,.5);
color: white;
text-shadow: 0 -.05em .05em rgba(0,0,0,-.5);
font-size: 125%;
line-height: 1.5;
@mercer08
mercer08 / getElementByClassName.js
Last active Aug 4, 2017
this is code of the book(DOM Scripting Web Design with JavaScript and the Doucment Object Model), the way to make the method of getElementByClassName to be true;
View getElementByClassName.js
function getElementByClassName (node,classname) {
if (node.getElementByClassName) {
return node.getElementByClassName(classname);
} else {
var elems = getElementByTagName("*");
var results = [];
for (var i = 0; i < elems.length; i++) {
if (elems[i].className.indexOf(classname) != -1) {
results.push(elems[i]);
}