I am currently working on implementing a side navigation bar for a website. At the moment, I am utilizing a <nav>
element and populating it with <li>
items to establish my sidebar.
My code snippet is as follows (note: in-line styling is temporary for testing purposes, I plan to use an external CSS file later on):
<body>
<nav style="background: #3f9edd; height: 1000px; min-width: 200px; position:fixed;">
<li style="position: relative; display: block; background: #2ecc71; width: 100%; height: 10%; padding: 33px 25px;">Home Area</li>
<li style="position: relative; display: block; background: #2b87c3; width: 100%; height: 5%; padding: 33px 25px; border-bottom: 1px solid;">item one</li>
<li style="position: relative; display: block; background: #2b87c3; width: 100%; height: 5%; padding: 33px 25px; border-bottom: 1px solid;">item two</li>
<li style="position: relative; display: block; background: #2b87c3; width: 100%; height: 5%; padding: 33px 25px; border-bottom: 1px solid;">item three</li>
<li style="position: relative; display: block; background: #2b87c3; width: 100%; height: 5%; padding: 33px 25px; border-bottom: 1px solid;">item four</li>
<li style="position: relative; display: block; background: #2b87c3; width: 100%; height: 5%; padding: 33px 25px; border-bottom: 1px solid;">item five</li>
</nav>
<div class="container" ng-controller="projectController">
</div>
</body>
The provided code generates the following output:
https://i.sstatic.net/lTa9n.png
Current Challenge:
I am facing difficulty in adjusting the side navigation bar when the user resizes their window or accesses the site from devices like iPad or iPhone.
If the screen is full-size, it should display like this (which is already achieved):
https://i.sstatic.net/aeBAJ.png
However, if the screen size decreases below a certain threshold, the nav bar should automatically transform into:
https://i.sstatic.net/WDz5s.png
I am uncertain about how to implement this functionality. Can someone please provide guidance on the right approach? Feel free to ask for more information if needed.
Appreciate your help in advance.