Skip to content

Instantly share code, notes, and snippets.

View cycold's full-sized avatar

cy cycold

  • ShenZhen, China
View GitHub Profile
*{margin:0;padding:0;}
.text{
display: inline-block;
font-size:16px;
vertical-align: middle;/* 保证文字垂直居中 */
}
.box-1{
height:200px;
.container{
width:95%;
height:200px;
background: #f90;
margin: 10px auto 0;
position: relative;
}
.box-1{
width:30%;
[
{
"class": "label_control",
"color": [255, 255, 255],
"shadow_color": [24, 24, 24],
"shadow_offset": [0, -1]
},
{
"class": "button_control",
"content_margin": [6, 5, 6, 6],
@cycold
cycold / clipboard.html
Created May 13, 2014 06:42
chrome浏览器支持从clipboard读取复制的数据 粘贴图片
Convert image from clipboard to base64 encoded data with JavaScript
http://stackoverflow.com/questions/11194209/convert-image-from-clipboard-to-base64-encoded-data-with-javascript
<div contenteditable></div>
$('div[contenteditable]').bind('paste', function(e) {
alert(123);
var data = e.originalEvent.clipboardData.items[0].getAsFile();
var elem = this;
var fr = new FileReader;
@cycold
cycold / CSS-3D-Panorama.markdown
Created May 22, 2014 02:21
A Pen by icewater.
@cycold
cycold / compass-animate.scss
Created May 23, 2014 07:33
compass animate and easing use
@charset "utf-8";
//注意animate keyframe 不能嵌套
@include animate-flipOutY;
>h1{
width: 200px;
height: 200px;
background-color: green;
@include ceaser-transition(all , 600ms, $easeInOutBack);
//@include transition(all 600ms ceaser($easeInOutBack));
@cycold
cycold / rAF.js
Created May 29, 2014 07:08 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@cycold
cycold / json.js
Created July 19, 2014 07:59
comon js
onclick="loadPanel(this,{'name':'er','age':'12'})"
json = {'name':'er','age':'12'} //输出直接就是jsond对像
onclick='loadPanel(this,"{\"name\":\"er\"}")'
json = "{\"name\":\"er\"}") //输出是json字符串
function loadPanel(obj,json){
console.log(json);
var json = eval('(' + json + ')');
console.log(json);

Absolute Centering

Perfect horizontal AND vertical centering in CSS, at any width or height!

Works with percentage based width/height, min-/max- width, images, position: fixed and even variable content heights.

Updated Aug 13: Added a comparison table, an explanation, more documentation, and a Modernizr test for variable height

Updated Aug 16: Minor corrections and clarifications