I have literally 1 hour of experience in HTML, CSS right now, and a lot more sophisticated understanding of programming, for example with java script. So please forgive me, if i have zero idea on how to do something here.
I would like to have my p5 canvas created, which also adhers to my CSS rules. how do i do this?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My website!</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="container">
<h1>My Website</h1>
<h2>It is all coming together.</h2>
<script type="text/javascript" src="p5.js"></script>
<script type="text/javascript" src="my_code.js"></script>
</div>
</body>
</html>
My CSS:
body {
background-image: url("matt-walsh-tVkdGtEe2C4-unsplash.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.container {
background-color: hsla(0, 0%, 50%, 0.8);
height: auto;
width: fit-content;
padding: 0px 250px;
}
h1 {
text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
font-size: 10vw;
font-family: Arial;
color: white;
text-align: center;
}
h2 {
text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
font-size: 5vw;
font-family: Arial;
color: white;
text-align: center;
}
p {
font-family: Arial;
color: black;
text-align: left;
max-width: 200vw;
}
script {
alignment: center;
}
And for completion sake:
function setup() {
createCanvas(400, 400);
}
function draw() {
if (mouseIsPressed) {
fill(0);
ellipse(mouseX, mouseY, 80, 80);
}
}