This is a solution to the Intro section with dropdown navigation challenge on Frontend Mentor.
This is the first web-dev project undertaken for my portfolio after re-aquainting myself with the basics of modern dev, taking a number of online classes and completing an online bootcamp. This portfolio piece demonstrates the use of HTML, CSS, and JS to create a standard landing page that utilizes drop down menus, a sliding drawer nav in mobile mode, and media queries to provide responsiveness.
Users can:
I started with a mobile-first workflow, and actually created a v1 of this page First version, until manipulating the nav got a bit out of control. I rebooted everything and this time began with the HTML structure as it would be most natural, and then manipulated the structure with CSS and media queries to get the mobile features I needed. In the process I dropped 110 lines out of the CSS file.
The HTML structure below illustrates what I'm talking about (simplified from the actual HTML file):
<div class="nav-container">
<div class="logo"></div>
<nav id="nav-menu" class="nav-flex-container"></nav>
<div class="menu-ctrl"></div>
</div>
I structured this as a container with a logo, a nav element (which would change as the media type dictated), and a button which would appear or not as needed. Within each of these is one or multiple other elements, and many employing flexbox. In a large enough layout the natural structure is horizontal with each primary element inline. And then what I did was to pop the nav element out with absolute positioning when I needed the vertical layout. Still, the nav-container retained an inline and flex display, adding the control button in for the slideout nav, and it was only the nav element that needed to be moved about. The flex-direction and spacing of the nav-container was constant throughout. This taught me to determine, prior to writing any code, what was the most "natural" layout dictated by the design(s), and adjust from there as required by media type.