Skip to content

Instantly share code, notes, and snippets.

@itsRealoj
Created October 28, 2019 20:37
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 itsRealoj/b848ca8c0623e1f3a4ea09d975e9ec27 to your computer and use it in GitHub Desktop.
Save itsRealoj/b848ca8c0623e1f3a4ea09d975e9ec27 to your computer and use it in GitHub Desktop.
Click-and-win-js
<!DOCTYPE html>
<html>
<head>
<title>Playing around</title>
</head>
<body>
<header>Just Playing around js and Flex</header
<br>
<div id ="demo2" class="div2">Hooray!</div>
<div id="demo" class="div3">Hooray Hooray!
<div class="div3-child">Hooray!</div>
<div class="div3-child">Hooray!</div>
<div> <button id="btn">WePlay!</div>
</div>
</body>
</html>
let myButton = "You Won! !";
myButtonStatus = true;
document.getElementById("btn").addEventListener("click", changeElement);
function changeElement() {
let myHeading = "The Game status changed ";
document.getElementById("demo").innerHTML = myButton;
if (myButtonStatus = true) {
document.getElementById("demo2").textContent = myHeading;
}
}
header {
font-family: Helvetica;
font-size: 20px;
padding: 3px;
}
.div1 {
width: 300px;
height: 100px;
border: 1px solid blue;
border-radius: 10px;
box-sizing: border-box;
text-align: center;
padding: 20px;
}
.div2 {
width: 300px;
height: 100px;
padding: 30px;
text-align: center;
border: 1px dashed red;
border-radius: 10px;
box-sizing: border-box;
}
.div3 {
border: 2px solid green;
border-radius: 10px;
font-family: Helvetica;
margin: 15px 2px;
width: 250px;
height: 100px;
padding: 20px;
text-align: center;
box-sizing: border-box;
background-color: #FFDEAD;
/*flex it here*/
display:flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
}
.div3-child {
border: 1px solid green;
background-color: #FFF8DC;
margin: 10px;
font-family: Helvetica;
/*flex commands here */
display:flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment