Skip to content

Instantly share code, notes, and snippets.

@erottman
Created December 2, 2016 00:58
Show Gist options
  • Select an option

  • Save erottman/b7702aababdacafc6a450d0a0ca84b18 to your computer and use it in GitHub Desktop.

Select an option

Save erottman/b7702aababdacafc6a450d0a0ca84b18 to your computer and use it in GitHub Desktop.
html
<!DOCTYPE html>
<html >
<head>
<title>Stupid Button</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<main id="main-container">
<div id="message"><p>What does this text look like?</p></div>
<button id="button-add">Add Style</button>
<button id="button-remove">Remove Style</button>
</main>
</body>
<script type="text/javascript" src="js/index.js"></script>
</html>
CSS
.main-style {
width: 300px;
margin: auto;
background-color: #fff;
border: 20px solid #7d56c1;
padding: 10px 0 20px 0;
border-radius: 10px;
text-align: center;
font-family: arial;
}
.button-style {
background-color:#6948a2;
border: none;
color:#fff;
font-size:14px;
padding:6px 18px;
}
button:focus { outline: none; }
.text-style {
color: #6948a2;
font-size: 18px;
font-family: arial, sans-serif;
}
JS
document.getElementById('button-add').addEventListener("click", function () {
document.getElementById('button-add').classList.add("button-style");
});
document.getElementById("button-remove").addEventListener("click", function () {
document.getElementById('button-remove').classList.remove("button-style");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment