I'm having an issue where my content is being hidden behind the sidebar and I want the sidebar to stay fixed on the left side.
When I changed position:fixed to float:left in the CSS, it gave me the desired result but the sidebar isn't fixed when I scroll.
Here's my CSS:
.Navbar {
width: 5%;
height: 100vh;
background-color: var(--bg-primary);
position: fixed;
}
The complete code is as follows:
APP.js
import './App.css';
import Navbar from './components/Navbar';
import Topbar from './components/Topbar';
function App() {
return (
<div className="App">
<Navbar />
<Topbar />
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliq...
<a href='lul' class="nav-link">
<AiFillHome color='white' size={45} />
<span className="link-text">Home</span>
</a>
</li>
<li className='nav-item'>
<a href='lul' class="nav-link">
<CgProfile color='white' size={45} />
<span className="link-text">Profile</span>
</a>
</li>
<li className='nav-item'>
<a href='lul' class="nav-link">
<FiBarChart color='white' size={45} />
<span className="link-text">Charts</span>
</a>
</li>
<li className='nav-item nav-item-last'>
<a href='lul' class="nav-link">
<FiSettings color='white' size={45} />
<span className="link-text">Settings</span>
</a>
</li>
</ul>
</nav>
)
}
export default Navbar
.Navbar {
width: 5%;
height: 100vh;
background-color: var(--bg-primary);
position: fixed;
}
.navbar-nav {
list-style: none;
padding: 0;
margin: 0;
height: 100%;
display: flex;
flex-direction: column;
}
...
a:visited {
text-decoration: none;
color:White;
}