Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button Mitosis #140

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions dom_manipulation/button.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
<!DOCTYPE html>
<html>
<head><title>JavaScript Button Example</title></head>
<html lang="en">

<body>
<button id='squeeze'>Squeeze me</button>

<script>
let button = document.getElementById("squeeze");
function shout(){
alert("... and I squeak");
}
button.addEventListener("click", shout);
</script>
</body>
</html>
<head>
<title>JavaScript Button Example</title>
</head>

<body>
<div id="buttons">
<button id="original">I have friends</button>
</div>

<script>
function duplicate()
{
var newButton = document.createElement("button")
newButton.innerHTML = "Hello!"
document.getElementById("buttons").appendChild(newButton)
}

// Add listener to original button
let button = document.getElementById("original");
button.addEventListener("click", duplicate);
</script>
</body>

</html>
47 changes: 47 additions & 0 deletions html_css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
html
{
font-family: Helvetica, Arial, sans-serif;
font-size: 10px;
}

h2
{
font-size: 2rem;
}

ul,ol,dl,p
{
font-size: 1.5rem;
}

li, p {
line-height: 1.5;
}

/* Unordered list styles */
ul {
padding-left: 2rem;
list-style-type: none;
}

ul li
{
padding-left: 2rem;
}

/* Ordered list styles */
ol
{
list-style-type: upper-roman;
}

/* Description list styles */
dd, dt
{
line-height: 1.5;
}

dt
{
font-weight: bold;
}
55 changes: 1 addition & 54 deletions html_css/styling-lists.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Styling lists</title>
<style>
/* General styles */

html {
font-family: Helvetica, Arial, sans-serif;
font-size: 10px;
}

h2 {
font-size: 2rem;
}

ul,ol,dl,p {
font-size: 1.5rem;
}

li, p {
line-height: 1.5;
}

/* Unordered list styles */

ul {
padding-left: 2rem;
list-style-type: none;
}

ul li {
padding-left: 2rem;
background-image: url(star.svg);
background-position: 0 0;
background-size: 1.6rem 1.6rem;
background-repeat: no-repeat;
}

/* Ordered list styles */

ol {
list-style-type: upper-roman;
}

/* Description list styles */

dd, dt {
line-height: 1.5;
}

dt {
font-weight: bold;
}

</style>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2>Shopping (unordered) list</h2>
Expand Down Expand Up @@ -94,7 +43,5 @@ <h2>Ingredient description list</h2>
<dt>Green salad</dt>
<dd>That green healthy stuff that many of us just use to garnish kebabs.</dd>
</dl>


</body>
</html>