diff --git a/components/Box/Box.css b/components/Box/Box.css index e69de29..f743e96 100644 --- a/components/Box/Box.css +++ b/components/Box/Box.css @@ -0,0 +1,3 @@ +.Box{ + padding: 20px; +} \ No newline at end of file diff --git a/components/Dropdown/Dropdown.css b/components/Dropdown/Dropdown.css new file mode 100644 index 0000000..05b46d0 --- /dev/null +++ b/components/Dropdown/Dropdown.css @@ -0,0 +1,26 @@ +.Dropdown { + display: inline-block; + margin-left: 20px; +} + +.Dropdown__btn { + border: 2px solid black; + height: 40px; +} + +.Dropdown__list { + flex-direction: column; + display: none; + margin-top: 10px; + background: white; + border: 2px solid black; + text-align: center; + justify-content: space-around; + position: absolute; + width: 65px; +} + +.Dropdown--active { + display: flex; + height: 80px; +} \ No newline at end of file diff --git a/components/Dropdown/Dropdown.js b/components/Dropdown/Dropdown.js new file mode 100644 index 0000000..72b6512 --- /dev/null +++ b/components/Dropdown/Dropdown.js @@ -0,0 +1,21 @@ +let btn = document.querySelector('.Dropdown__btn'); +let dropdown = document.querySelector('.Dropdown__list'); + + +// btn.addEventListener('click', () => { +// dropdown.classList.toggle('Dropdown--active'); +// }) + +// ES6 Syntax +class Dropdown { + constructor(button, dropdownMenu) { + this.button = button; + this.dropdownMenu = dropdownMenu + this.button.addEventListener('click', () => {this.showDropdown()}) + } + showDropdown() { + this.dropdownMenu.classList.toggle('Dropdown--active'); + } +} + +btn = new Dropdown(btn, dropdown); diff --git a/components/Section/Section.css b/components/Section/Section.css index e69de29..86301de 100644 --- a/components/Section/Section.css +++ b/components/Section/Section.css @@ -0,0 +1,21 @@ + +.Section { + max-width: 1100px; + width: 100%; + margin: 0 auto; + border: 2px solid black; +} +.Section__header { + display: inline-block; + margin-left: 390px; +} + +.Section--half { + width: 49%; + display: inline-block; + border: 0px; +} + +.Section--border { + border-right: 2px solid black; +} diff --git a/index.html b/index.html index 39167c5..0cdb69e 100644 --- a/index.html +++ b/index.html @@ -1,9 +1,39 @@ - + Introduction to the DOM + +
+ +

Header

+
+
+
+
+

Placeholder

+
+ 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. +
+
+
+
+

Placeholder

+
+ 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. +
+
+
+
+ -
\ No newline at end of file + \ No newline at end of file diff --git a/styles.css b/styles.css index 997c895..33c9c4e 100644 --- a/styles.css +++ b/styles.css @@ -1,5 +1,6 @@ @import './components/Section/Section.css'; @import './components/Box/Box.css'; +@import './components/Dropdown/Dropdown.css'; body { box-sizing: border-box;