Skip to content

Instantly share code, notes, and snippets.

@zz85
Created January 8, 2015 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zz85/1123718d124bb7b54ee5 to your computer and use it in GitHub Desktop.
Save zz85/1123718d124bb7b54ee5 to your computer and use it in GitHub Desktop.
Testing GSS
<html>
<head>
<script>
GSS_CONFIG = {
worker: "bower_components/gss/dist/worker.js",
verticalScroll: !false
};
// also see https://raygun.io/blog/2014/06/next-gen-constraint-layouts-browser-grid-style-sheets/
</script>
<script src="bower_components/gss/dist/gss.js"></script>
<style type="text/gss">
.box {
/* width: 200px;
height: 100px;
margin: 20px;
*/
padding: 20px;
}
#parent {
background: blue;
width: == ::window[width] - 200;
height: == ::window[height] - 200;
center-x: == ::window[center-x];
center-y: == ::window[center-y];
}
#child {
background: red;
width: == #parent[width] / 3;
x: == #parent[x];
}
#grandchild {
background: yellow;
width: == #parent[width] / 3;
x: == #child[right];
}
#cousin {
background: pink;
width: == #parent[width] / 2;
width: >= 500 !weak;
height: == 200;
x: == #parent[x];
y: == #parent[bottom] + 100;
/*padding: 40px;
margin: 20px;*/
}
/* #family {
#cousin[height] == #parent[height] !require;
#parent[right] + 120 <= #cousin[left] !require;
width: 100%;
}
*/
</style>
</head>
<body>
<div id="family">
<div id="parent" class="box">
Parent
<div id="child" class="box">
Child
<div id="grandchild" class="box">
Grandchild
</div>
</div>
</div>
<div id="cousin" class="box">
Cousin
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment