Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created July 7, 2011 20:00
Show Gist options
  • Select an option

  • Save mhulse/1070411 to your computer and use it in GitHub Desktop.

Select an option

Save mhulse/1070411 to your computer and use it in GitHub Desktop.
CSS gradient test using % and px as units...
.test {
background: #000;
background: -moz-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #000), color-stop(2%, #000), color-stop(2%, #5f5f5f), color-stop(3%, #5f5f5f), color-stop(3%, #1a1a1a), color-stop(4%, #1a1a1a), color-stop(4%, #333), color-stop(100%, #333));
background: -webkit-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
background: -o-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
background: -ms-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#333333', GradientType=0);
background: linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.0.0/build/cssfonts/fonts-min.css&3.0.0/build/cssreset/reset-min.css&3.0.0/build/cssbase/base-min.css">
<style type="text/css">
<!--
.test {
background: #000;
background: -moz-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #000), color-stop(2%, #000), color-stop(2%, #5f5f5f), color-stop(3%, #5f5f5f), color-stop(3%, #1a1a1a), color-stop(4%, #1a1a1a), color-stop(4%, #333), color-stop(100%, #333));
background: -webkit-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
background: -o-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
background: -ms-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#333333', GradientType=0);
background: linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%);
height: 500px;
}
-->
</style>
</head>
<body>
<div class="test"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment