Skip to content
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
16 changes: 16 additions & 0 deletions components/Box/Box.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.box {
display: flex;
width: 100%;
box-sizing: border-box;
}

.box .Box1 {
border: 2px solid black;
padding: 25px;
}

.box .Box2 {
border: 2px solid black;
padding: 25px;
}

47 changes: 47 additions & 0 deletions components/Section/Section.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Dropdown Button */
.dropbtn {
background-color: white;
color: black;
padding: 20px;
font-size: 16px;
border: none;
cursor: pointer;
border: 2px solid black;
padding: 10px;
margin-top: 20px;
margin-left: 8px;
}

.dropbtn:hover, .dropbtn:focus {
background-color: white;
}

.dropdown {
position: relative;
display: inline-block;
}

.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px solid black;
z-index: 1;
border: 3px solid black;
}

.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}


.dropdown-content a:hover {background-color: #ddd}

/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}


18 changes: 18 additions & 0 deletions dropdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

function dropDownFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}

window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {

let dropdowns = document.getElementsByClassName("dropdown-content");
let i;
for (i = 0; i < dropdowns.length; i++) {
let openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
37 changes: 35 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
<!DOCTYPE html>
<hml>
<html lang="en">
<head>
<title>Introduction to the DOM</title>
<link rel="stylesheet" href="./styles.css">
<script defer="defer" type="text/javascript" src="./dropdown.js"></script>
</head>
<body>
<div class="Header">
<div class = "Section">
<div class="dropdown">
<button onclick="dropDownFunction()" class="dropbtn">Dropdown</button>
<div id="myDropdown" class="dropdown-content">
<a href="#">Lambda</a>
<a href="#">Google</a>
<a href="#">MDN</a>
</div>
</div>
</div>
<h1>Header</h1>
</div>
<section class="box">
<div class="Box1">
<div class="Box1__header">
<h3 class="Box1__headerHeadline">Placeholder</h3>
</div>
<div class="Box1__Text">
<p class="Box1__textParagaraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce risus nibh, gravida nec felis quis, facilisis facilisis lectus. Nulla ac orci pretium, condimentum orci quis, accumsan nisi. Aliquam erat volutpat. Curabitur cursus mattis libero, at viverra risus hendrerit quis. Fusce imperdiet tristique tortor non tincidunt. Mauris accumsan urna nec augue feugiat porta. Proin vitae magna in ex malesuada laoreet eget a nulla. Aliquam tristique et elit at consequat. In hac habitasse platea dictumst.</p>
</div>
</div>
<div class="Box2">
<div class="Box2__header">
<h3 class="Box2__headerHeadline">Placeholder</h3>
</div>
<div class="Box2__Text">
<p class="Box2__textParagaraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce risus nibh, gravida nec felis quis, facilisis facilisis lectus. Nulla ac orci pretium, condimentum orci quis, accumsan nisi. Aliquam erat volutpat. Curabitur cursus mattis libero, at viverra risus hendrerit quis. Fusce imperdiet tristique tortor non tincidunt. Mauris accumsan urna nec augue feugiat porta. Proin vitae magna in ex malesuada laoreet eget a nulla. Aliquam tristique et elit at consequat. In hac habitasse platea dictumst.</p>
</div>
</div>
</section>
</body>
</hml>
</html>
<!--section, box, Dropdown-->
Empty file added index.js
Empty file.
47 changes: 47 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,50 @@ body {
min-width: 300px;
margin: 0;
}

.Header {
display: flex;
border: 2px solid black;
}

.Header h1 {
display: flex;
justify-content: center;
margin-left: 565px;
}


@media(max-width: 400px) {

body {
box-sizing: border-box;
min-width: 300px;
margin: 0;
}

.Header {
display: flex;
border: 2px solid black;
}

.Header h1 {
display: flex;
justify-content: center;
margin-left: 45px;
}

.box {
display: flex;
flex-direction: column;
}

.box .Box1 {
padding: 14px;
}

.box .Box2 {
padding: 14px;
}

}