Skip to content

Instantly share code, notes, and snippets.

@melaniehoff
Last active May 4, 2018 01:30
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 melaniehoff/239bd2e3f2612c5eda227323ec0676c2 to your computer and use it in GitHub Desktop.
Save melaniehoff/239bd2e3f2612c5eda227323ec0676c2 to your computer and use it in GitHub Desktop.
D3A - embed p5.js sketch centered on a page.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<script>
// JAVASCRIPT COULD GO HERE
</script>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
height: 100%;
/*//////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
CHANGE BACKGROUND COLOR HERE: */
background-color: #ccecdc;
}
.flexcontainer {
height:100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
}
.centerdiv {
}
iframe {
border: none;
/*////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
THE WIDTH AND HEIGHT OF YOUR P5 CANVAS HERE: */
width: 500px;
height: 500px;
}
</style>
<title>TITLE</title>
</head>
<body>
<div class="flexcontainer">
<div class="centerdiv">
<!-- //////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
Click file > share > embed
YOUR EMBEDDED IFRAME HERE: -->
<iframe scrolling="no" src="XXXXXXXXXXXXXXXXX"></iframe>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment