Stay/Collapse nav bar - html

I have navbar menus with submenu dropped-down. whenever the menu is clicked then the submenus is expanded however when the submenu is clicked then the sub-menus returns collapsed. How to make the menu and its submenus stay expanded until the other menu is clicked?
above picture, when picture submenu under profile menu is clicked it opens a page and the profile menu stays expanded, until other menu (eg. messages menu) is clicked then profile menu is collapsed.
my fiddle
Please advise.

In your code, you are binding to a css :target that is RESET when any other link is clicked.
Whether this problem is solved, I do not know. But such tasks are usually done using javaScript
const links = document.querySelectorAll('.menu-btn');
let activeNav = null;
links.forEach(item => {
item.addEventListener('click', e => {
e.preventDefault();
const wrapper = item.closest('.item');
if (!wrapper) {
return;
}
/** 1. START - each menu item is separate*/
// wrapper.classList.toggle('open');
/** 1. END - each menu item is separate*/
/** 2. START - only one active (need variable - activeNav) */
if (activeNav === wrapper) {
/** If you want the active to be always, remove this code */
wrapper.classList.remove('open')
activeNav = null;
} else {
if (activeNav) {
activeNav.classList.remove('open');
}
wrapper.classList.add('open');
activeNav = wrapper;
}
/** 2. START - only one active */
})
})
#import url('https://fonts.googleapis.com/css2?family=Poppins:wght#100;200;300;400;500;600;700;800;900&display=swap');
* {
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
width: 100%;
background: #e5e7eb;
position: relative;
}
.wrapper .header {
z-index: 1;
background: #22242A;
position: fixed;
/*aslinya width: calc(100%-0%)*/
width: calc(100%);
height: 70px;
display: flex;
top: 0;
}
.wrapper .header .header-menu {
width: calc(100%-0%);
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}
.wrapper .header .header-menu .title {
color: #fff;
font-size: 25px;
text-transform: uppercase;
font-weight: 900;
}
.wrapper .header .header-menu .title span {
color: #4ccee8;
}
.wrapper .header .header-menu .sidebar-btn {
color: #fff;
position: absolute;
margin-left: 240px;
font-size: 22px;
font-weight: 900;
cursor: pointer;
transition: 0.3s;
transition-property: color;
}
.wrapper .header .header-menu .sidebar-btn:hover {
color: #4ccee8;
}
.wrapper .header .header-menu ul {
display: flex;
}
/*tombol sebelah my panel*/
.wrapper .header .header-menu ul li a {
background: #fff;
color: #000;
display: block;
margin: 0 10px;
font-size: 18px;
width: 34px;
height: 34px;
line-height: 35px;
text-align: center;
border-radius: 50%;
transition: 0.3s;
transition-property: background, color;
}
.wrapper .header .header-menu ul li a:hover {
background: #4ccee8;
color: #fff;
}
.wrapper .sidebar {
z-index: 1;
background: #2f323a;
position: fixed;
top: 70px;
width: 250px;
/*begron abu2. aslinya: height: calc(100%-9%);*/
height: calc(100%);
transition: 0.3s;
transition-property: width;
overflow-y: auto;
}
.wrapper .sidebar .sidebar-menu {
overflow: hidden;
}
.wrapper .sidebar .sidebar-menu .profile img {
margin: 20px 0;
width: 100px;
height: 100px;
border-radius: 50%;
}
.wrapper .sidebar .sidebar-menu .profile p {
color: #bbb;
font-weight: 700;
margin-bottom: 10px;
}
.wrapper .sidebar .sidebar-menu .item {
width: 250px;
overflow: hidden;
}
.wrapper .sidebar .sidebar-menu .item .menu-btn {
display: block;
color: #fff;
position: relative;
padding: 25px 20px;
transition: 0.3s;
transition-property: color;
}
.wrapper .sidebar .sidebar-menu .item .menu-btn:hover {
color: #4ccee8;
}
.wrapper .sidebar .sidebar-menu .item .menu-btn i {
margin-right: 20px;
}
.wrapper .sidebar .sidebar-menu .item .menu-btn .drop-down {
float: right;
font-size: 12px;
margin-top: 3px;
}
.wrapper .sidebar .sidebar-menu .item .sub-menu {
background: #3498d8;
overflow: hidden;
max-height: 0;
transition: 0.3s;
transition-property: background, max-height;
}
.wrapper .sidebar .sidebar-menu .item .sub-menu a {
display: block;
position: relative;
color: #fff;
white-space: nowrap;
font-size: 15px;
padding: 20px;
border-bottom: 1px solid #8fc5e9;
transition: 0.3s;
transition-property: background;
}
.wrapper .sidebar .sidebar-menu .item .sub-menu a:hover {
background: #55b1f0;
}
.wrapper .sidebar .sidebar-menu .item .sub-menu i {
padding: right 20px;
font-size: 10px;
}
.wrapper .sidebar .sidebar-menu .item.open .sub-menu {
max-height: 500px;
}
.wrapper .sidebar .sidebar-menu .item:target .sub-menu {
/* max-height: 500px; */
}
.wrapper .main-container {
width: (100%-250px);
margin-top: 70px;
margin-left: 250px;
padding: 15px;
background: url("images/background.jpg")no-repeat;
height: 100vh;
transition: 0.3s;
}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Apanel</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<div class="header">
<div class="header-menu">
<div class="title">This <span>is</span></div>
<div class="sidebar-btn">
<i class="fas fa-bars"></i>
</div>
<ul>
<li><i class="fas fa-search"></i></li>
<li><i class="fas fa-bell"></i></li>
<li><i class="fas fa-power-off"></i></li>
</ul>
</div>
</div>
<div class="sidebar">
<div class="sidebar-menu">
<li class="item">
<a href="#" class="menu-btn">
<i class="fas fa-desktop"></i><span>Dashboard</span>
</a>
</li>
<li class="item" id="profile">
<a href="#profile" class="menu-btn">
<i class="fa fa-user-circle"></i><span>Profile <i class="fas fa-chevron-down drop-down"></i>
</span>
</a>
<div class="sub-menu">
<i class="fas fa-image"></i><span>Picture</span>
<i class="fas fa-address-card"></i><span>Info</span>
</div>
</li>
<li class="item" id="messages">
<a href="#messages" class="menu-btn">
<i class="fa fa-envelope"></i><span> Messages<i class="fas fa-chevron-down drop-down"></i>
</span>
</a>
<div class="sub-menu">
<i class="fas fa-envelope"></i><span>New</span>
<i class="fas fa-envelope-square"></i><span>Sent</span>
<i class="fas fa-exclamation-circle"></i><span>Spam</span>
</div>
</li>
<li class="item" id="settings">
<a href="#settings" class="menu-btn">
<i class="fa fa-cog"></i><span>Settings<i class="fas fa-chevron-down drop-down"></i>
</span>
</a>
<div class="sub-menu">
<i class="fas fa-lock"></i><span>Password</span>
<i class="fas fa-language"></i><span>Language</span>
<i class="fas fa-exclamation-circle"></i><span>Spam</span>
</div>
</li>
<li class="item">
<a href="#" class="menu-btn">
<i class="fas fa-info-circle"></i><span>About</span>
</a>
</li>
</div>
</div>
<div class="main-container">
link
</div>
</div>
</body>
</html>

Related

How to move the scrollbar position in a sidebar?

I'm working on a costume admin dashboard for my SPA project. I have the following codes for sidebar section:
HTML:
<div class="sidebar">
<div class="logo_content">
<div class="logo">
<i class='bx bxl-c-plus-plus'></i>
<div class="logo_name">CodeX</div>
</div>
<i class='bx bx-menu' id="btn"></i>
</div>
<div class="items-list">
<ul class="nav-list">
<li>
<a href="#">
<i class='bx bxs-grid-alt'></i>
<span class="links_name">Dashboard</span>
</a>
</li>
</ul>
<ul class="nav-list">
<li>
<a href="#">
<i class='bx bxs-user'></i>
<span class="links_name">User</span>
</a>
</li>
</ul>
.
.
<-- uls come here -->
.
.
.
</div>
</div>
CSS:
.sidebar .items-list{
height: calc(100% - 130px);
overflow-y: scroll;
overflow-x: hidden;
}
.sidebar ul{
margin-top: 20px;
}
.sidebar ul li{
position: relative;
height: 50px;
width: 100%;
margin: 0 5px;
list-style: none;
line-height: 50px;
}
.sidebar ul li a{
color: #fff;
display: flex;
align-items: center;
text-decoration: none;
border-radius: 12px;
transition: all .4s ease;
}
.sidebar ul li a:hover{
color: #11101d;
background: #fff;
}
.sidebar ul li a i{
height: 50px;
min-width: 50px;
border-radius: 12px;
line-height: 50px;
text-align: center;
font-size: 30px;
}
The styled page is:
I want to move the scrollbar to the right edge of the sidebar. Currently, there is some gap between the sidbar edge and the scrollbar.
I have studied some related questions such as this and this, but I could not implement them in my own problem.
How can I do that?
I solved my own problem by modifying these styles:
.sidebar ul li a{
color: #fff;
display: flex;
align-items: center;
text-decoration: none;
border-radius: 12px;
transition: all .4s ease;
margin-right: 12px;
}
.sidebar{
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 240px;
background-color: #11101d;
padding: 6px 2px;
}

Changes in #media do not appear

I tried to create a responsive menu for a smaller screen, but the icon fa fa-bar would not appear, even though I set display: block inside media query. I wonder what the priority in css is. I followed a tutorial on reponsive menu, yet my code in media does not reflect on the smaller screen.
nav {
display: flex;
padding: 2% 6%;
justify-content: space-between;
align-items: center;
}
.nav img {
width: 150px;
}
.nav-links {
flex: 1;
text-align: right;
}
.nav-links ul li {
list-style: none;
display: inline-block;
padding: 8px 12px;
position: relative;
}
.nav-links ul li a {
color: white;
text-decoration: none;
font-weight: 500;
}
.nav-links ul li::after {
content: "";
width: 100%;
height: 2px;
display: block;
margin: auto;
}
.nav-links ul li:hover::after {
width: 100%;
}
#media (max-width: 700px) {
.nav-links ul li {
display: block;
}
.nav-links {
position: absolute;
background: #012a5d;
height: 100vh;
width: 200px;
top: 0;
right: -200px;
text-align: left;
z-index: 2;
transition: 1s;
}
nav.fa {
display: block;
color: #fff;
margin: 10px;
font-size: 22px;
cursor: pointer;
}
.nav-links ul {
padding: 30px;
}
}
<nav>
<div class="logo">
<img src="images/Logos/University of Toronto Logos/U of T Signature_Reverse RGB (1).png">
</div>
<div class="nav-links" id="navLinks">
<i class="fa fa-times" onclick="hideMenu()"></i>
<ul>
<li>Home</li>
...
<li><a href="contact.html" class="button-header">
<div class="button-font">
Contact Us
</div>
</a></li>
</ul>
</div>
<i class="fa fa-bars" onclick="showMenu()"></i>
</nav>
<script>
var navLinks = document.getElementById("navLinks");
function showMenu()
{navlinks.style.right ="0";}
function hideMenu()
{ navlinks.style.right = "-200";}
</script>
how the menu looks like on a big screen

How to make a working navigation menu that transition from top when clicked on hamburger menu?

I was trying to design a hamburger menu that lets users tap on while using phones and tablets but switch to the full nav bar on the desktop. I have a working navbar for desktop but I have not been able to make one for phones/tablets. I have made a checkbox to try implementing it. But when the checkbox(ham menu) is clicked, it doesn't do anything. Also, tried with negative values. If anyone can help me, I would appreciate it a lot.
Here's my code:
#import url("https://fonts.googleapis.com/css2?family=Montserrat&display=swap");
html,
body {
margin: 0;
padding: 0;
overflow-x: hidden;
font-family: "Montserrat", sans-serif;
}
a {
text-decoration: none;
color: aliceblue;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 8%;
background-color: #2f2e41;
top: 0;
color: aliceblue;
width: auto;
.nav-links,
li {
list-style: none;
display: inline-block;
padding: 0 10px;
}
.nav-links li a {
transition: all 0.3s ease 0s;
}
.nav-links li a:hover {
color: #6e00ff;
}
}
input[type="checkbox"] {
display: none;
}
header .navMode .menu {
display: none;
}
#media (max-width: 420px) {
header nav .nav-links {
background: #2f2e41;
position: absolute;
top: 10%;
height: 30vh;
width: 100%;
right: 0%;
display: flex;
flex-direction: column;
text-align: center;
transition: all 0.3s ease;
li {
margin-top: 5px;
padding: 10px 0;
a:hover {
color: #6e00ff;
background: none;
}
}
}
header .navMode .menu{
display: block;
}
#click:checked ~ .menuBar i:before {
content: "\f00d";
}
#click:checked ~ .menuBar .nav-links {
top: 0%;
}
header nav i {
font-size: 20px;
}
}
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
</head>
<body>
<header>
<a href="#" class="logo">
<p>Name</p>
</a>
<nav class="navMode">
<div class="menu">
<input type="checkbox" id="click">
<label for="click" class="menuBar">
<i class="fas fa-bars"></i>
</label>
</div>
<ul class="nav-links">
<li> <a class="navBar-links" href="#">Lorem
</a></li>
<li> <a class="navBar-links" href="#">Lorem
</a></li>
<li> <a class="navBar-links" href="#">Lorem
</a></li>
<li> <a class="navBar-links" href="#">lorem
</a></li>
</ul>
</nav>
</header>
</body>

drop down menu is not visible after providing image below menu-bar

Can somebody tell me, how can I fix the drop-down menu? after taking cursor, the drop-down items are not visible if I put an image in a different section but drop-down is visible if I don't put any image. But I need to put the image. please tell me what I did wrong.
here is my HTML code=
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css"/>
</head>
<body>
<header>
<div class="menu-bar">
<nav>
<ul>
<li><i class="fa fa-home"></i><span class="data-hover"data-hover="home"> Home</span></li>
<li><span class="data-hover" data-hover="Shortcodes"><i class="fa fa-file-text-o"></i> About</span>
<ul>
<li>D1</li>
<li>D2</li>
</ul>
</li>
<li><i class="fa fa-briefcase" aria-hidden="true"></i> Our work</span>
<ul>
<li>D3</li>
<li><a href="#">D4/a></li>
</ul>
</li>
<li><span class="data-hover" data-hover="Portfolio"><i class="fa fa-users" aria-hidden="true"></i> Galary</span>
<ul>
<li>D5</li>
<li>D6</li>
</ul>
</li>
<li> <span class="data-hover" data-hover="contact"><i class="fa fa-phone" aria-hidden="true"></i> Contact</span></li>
</ul>
</nav>
</div>
</header>
<section>
<div class="page_head">
<div class="contained">
<h1>XXXXXXXX</h1>
</div>
</div>
</section> </body> </html>
and here is CSS code
.menu-bar{
background: #2c97e4;
}
nav{
height: 40px;
width: 960px;
display: block;
margin-left: 250px;
}
nav li a{
display: block;
text-decoration: none;
font-size: 16px;
font-weight: bold;
color:white;
text-align: center;
text-transform: capitalize;
overflow: visible;
}
nav a:hover{
background: red;
color:white;
text-decoration: none;
}
nav ul{
list-style: none;
}
nav ul li{
float: left;
width: 150px;
height: 40px;
line-height: 40px;
background: #2c97e4;
overflow-y: visible;
margin-right: 30px;
}
nav ul li ul li{
position: relative;
display: none;
right:50px;
}
nav ul li:hover ul li{
display: block;
width: 200px;
padding:1px;
position: relative;
animation: nacm 500ms forwards;
}
#keyframes nacm{
0%{
opacity: 0;
top:5px;
}
100%{
opacity: 1;
top:0;
}
}
.contained{
width:90%;
margin:auto;
overflow:hidden;
}
.page_head{
background: url(c-1.jpg);
background-size:cover;
background-position:center;
height:100%;
width:100%;
padding-bottom:2%;
position:relative;
z-index:99;
padding-top:110px;
padding-bottom:82px;
}
.page_head .contained h1{
font-size:50px;
color:#FF4500;
float: left;
text-decoration: none;
text-underline-position:under;
text-decoration-color: #FF4500;
letter-spacing:3px;
}
This work for me:
.menu-bar {
background: #2c97e4;
}
nav {
height: 40px;
width: 960px;
display: block;
margin-left: 250px;
}
nav li a {
display: block;
text-decoration: none;
font-size: 16px;
font-weight: bold;
color: white;
text-align: center;
text-transform: capitalize;
overflow: visible;
}
nav a:hover {
background: red;
color: white;
text-decoration: none;
}
nav ul {
list-style: none;
}
nav ul li {
float: left;
width: 150px;
height: 40px;
line-height: 40px;
background: #2c97e4;
overflow-y: visible;
margin-right: 30px;
}
nav ul li ul li {
position: relative;
display: none;
right: 50px;
}
nav ul li:hover ul li {
display: block;
width: 200px;
padding: 1px;
position: relative;
animation: nacm 500ms forwards;
}
#keyframes nacm {
0% {
opacity: 0;
top: 5px;
}
100% {
opacity: 1;
top: 0;
}
}
.contained {
width: 90%;
margin: auto;
overflow: hidden;
}
.page_head {
background: url(c-1.jpg);
background-attachment: fixed;
height: 690px;
background-size: cover;
background-position: center;
width: 100%;
padding-bottom: 2%;
position: relative;
z-index: -1;
padding-top: 110px;
padding-bottom: 82px;
}
.page_head .contained h1 {
font-size: 50px;
color: #FF4500;
float: left;
text-decoration: none;
text-underline-position: under;
text-decoration-color: #FF4500;
letter-spacing: 3px;
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<header>
<div class="menu-bar">
<nav>
<ul>
<li><i class="fa fa-home"></i><span class="data-hover"data-hover="home"> Home</span></li>
<li><span class="data-hover" data-hover="Shortcodes"><i class="fa fa-file-text-o"></i> About</span>
<ul>
<li>D1</li>
<li>D2</li>
</ul>
</li>
<li><span class="data-hover" data-hover="pages"><i class="fa fa-briefcase" aria-hidden="true"></i> Our work</span>
<ul>
<li>D3</li>
<li>D4</li>
</ul>
</li>
<li><span class="data-hover" data-hover="Portfolio"><i class="fa fa-users" aria-hidden="true"></i> Galary</span>
<ul>
<li>D5</li>
<li>D6</li>
</ul>
</li>
<li>
<span class="data-hover" data-hover="contact"><i class="fa fa-phone" aria-hidden="true"></i> Contact</span>
</li>
</ul>
</nav>
</div>
</header>
<section>
<div class="page_head">
<div class="contained">
<h1>XXXXXXXX</h1>
</div>
</div>
</section>
</body>
</html>

Make 'absolute' positioned elements behave as if they were fixed

I'm attempting to familiarise myself with Bootstrap in order to build a responsive website for an assignment, and have based my design off of this template.
I have replaced the main body of content with a landing screen for my website that involves a carousel (complete with captions) for the background image, as well as the website's logo in the centre of the page. Aside from the text upon it, the navbar remains unchanged.
Everything on the page is wrapped inside a wrapper div, which contains a sidebar nav for the sidebar, and a content div for the rest of the page content. Inside the content div is the bg div (contains the carousel, including its indicators and captions), hdr div (containing the toggle sidebar button as seen in the demo), and the body div (containing the logo).
Ideally, I would like everything within the content div to behave as if it were 'fixed'. I want the logo, background, carousel indicators, captions, etc. to remain in the viewport when the webpage is scrolled. However, I cannot set the position to 'fixed' as it breaks the navbar.
For now, I also have my bg div set to position 'absolute' so that the carousel captions/indicators remain in the centre of the page when the navbar is expanded or collapsed. So not only do my elements not remain fixed as I would like them, there is also tons of whitespace at the bottom of the page when the web page is viewed at lower resolutions.
Below is the code for my website.
/*
DEMO STYLE
*/
#import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";
body {
font-family: 'Poppins', sans-serif;
background: #fafafa;
}
img {
display: block;
max-width: 100%;
height: auto;
}
p {
font-family: 'Poppins', sans-serif;
font-size: 1.1em;
font-weight: 300;
line-height: 1.7em;
color: #999;
}
a, a:hover, a:focus {
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
.navbar {
padding: 15px 10px;
background: #fff;
border: none;
border-radius: 0;
margin-bottom: 40px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}
.navbar-btn {
box-shadow: none;
outline: none !important;
border: none;
}
.line {
width: 100%;
height: 1px;
border-bottom: 1px dashed #ddd;
margin: 40px 0;
}
i, span {
display: inline-block;
}
.carousel-item {
height: 100vh;
min-height: 300px;
background: no-repeat center center scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.sticky {
position: fixed;
top: 0;
width: 100%;
}
.sticky + .content {
padding-top: 60px;
}
.carousel-caption h3 {
font-size: 2.5vw;
}
.carousel-caption p {
font-size: 1.5vw;
}
.carousel-indicators {
position: absolute;
margin-right: auto;
margin-left: auto;
}
.carousel-caption {
position: absolute;
margin-right: auto;
margin-left: auto;
}
/* ---------------------------------------------------
SIDEBAR STYLE
----------------------------------------------------- */
.wrapper {
display: flex;
align-items: stretch;
}
#sidebar {
min-width: 250px;
max-width: 250px;
background: #7386D5;
color: #fff;
transition: all 0.3s;
}
#sidebar.active {
min-width: 80px;
max-width: 80px;
text-align: center;
}
#sidebar.active .sidebar-header h3, #sidebar.active .CTAs {
display: none;
}
#sidebar.active .sidebar-header strong {
display: block;
}
#sidebar ul li a {
text-align: left;
}
#sidebar.active ul li a {
padding: 20px 10px;
text-align: center;
font-size: 0.85em;
}
#sidebar.active ul li a i {
margin-right: 0;
display: block;
font-size: 1.8em;
margin-bottom: 5px;
}
#sidebar.active ul ul a {
padding: 10px !important;
}
#sidebar.active a[aria-expanded="false"]::before, #sidebar.active a[aria-expanded="true"]::before {
top: auto;
bottom: 5px;
right: 50%;
-webkit-transform: translateX(50%);
-ms-transform: translateX(50%);
transform: translateX(50%);
}
#sidebar .sidebar-header {
padding: 20px;
background: #6d7fcc;
}
#sidebar .sidebar-header strong {
display: none;
font-size: 1.8em;
}
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #47748b;
}
#sidebar ul li a {
padding: 10px;
font-size: 1.1em;
display: block;
}
#sidebar ul li a:hover {
color: #7386D5;
background: #fff;
}
#sidebar ul li a i {
margin-right: 10px;
}
#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #fff;
background: #6d7fcc;
}
a[data-toggle="collapse"] {
position: relative;
}
a[aria-expanded="false"]::before, a[aria-expanded="true"]::before {
content: '\f078';
display: block;
position: absolute;
right: 20px;
font-family: FontAwesome;
font-size: 0.6em;
}
a[aria-expanded="true"]::before {
content: '\f077';
}
ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
background: #6d7fcc;
}
ul.CTAs {
padding: 20px;
}
ul.CTAs a {
text-align: center;
font-size: 0.9em !important;
display: block;
border-radius: 5px;
margin-bottom: 5px;
}
a.download {
background: #fff;
color: #7386D5;
}
a.article, a.article:hover {
background: #6d7fcc !important;
color: #fff !important;
}
/* ---------------------------------------------------
CONTENT STYLE
----------------------------------------------------- */
#content {
padding: 0;
min-height: 100vh;
transition: all 0.3s;
position: relative;
width: auto;
height: auto;
}
#hdr {
position: relative;
z-index: 100;
padding: 20px;
}
#bg {
position: fixed;
top: 0;
left: 0;
z-index: -100;
width: 100%;
height: 100%;
}
#body {
height: 84%;
}
#logo {
position: relative;
width: 30%;
height: 30%;
top: 5%;
margin-top: auto;
margin-left: auto;
margin-right: auto;
}
/* ---------------------------------------------------
MEDIAQUERIES
----------------------------------------------------- */
#media (max-width: 768px) {
#sidebar {
min-width: 80px;
max-width: 80px;
text-align: center;
margin-left: -80px !important ;
}
a[aria-expanded="false"]::before, a[aria-expanded="true"]::before {
top: auto;
bottom: 5px;
right: 50%;
-webkit-transform: translateX(50%);
-ms-transform: translateX(50%);
transform: translateX(50%);
}
#sidebar.active {
margin-left: 0 !important;
}
#sidebar .sidebar-header h3, #sidebar .CTAs {
display: none;
}
#sidebar .sidebar-header strong {
display: block;
}
#sidebar ul li a {
padding: 20px 10px;
}
#sidebar ul li a span {
font-size: 0.85em;
}
#sidebar ul li a i {
margin-right: 0;
display: block;
}
#sidebar ul ul a {
padding: 10px !important;
}
#sidebar ul li a i {
font-size: 1.3em;
}
#sidebar {
margin-left: 0;
}
#sidebarCollapse span {
display: none;
}
}
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel=stylesheet type=text/css href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</head>
<body>
<div class="wrapper">
<!-- Sidebar Holder -->
<nav id="sidebar">
<div class="sidebar-header">
<h3>Website</h3>
<strong>W</strong>
</div>
<ul class="list-unstyled components">
<li class="active">
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="false">
<i class="fas fa-home"></i>
Home
</a>
<ul class="collapse list-unstyled" id="homeSubmenu">
<li>Home 1</li>
<li>Home 2</li>
<li>Home 3</li>
</ul>
</li>
<li>
<a href="#">
<i class="fas fa-briefcase"></i>
About
</a>
<a href="#pageSubmenu" data-toggle="collapse" aria-expanded="false">
<i class="fas fa-newspaper"></i>
Pages
</a>
<ul class="collapse list-unstyled" id="pageSubmenu">
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
</ul>
</li>
<li>
<a href="#">
<i class="fas fa-link"></i>
Portfolio
</a>
</li>
<li>
<a href="#">
<i class="fas fa-paperclip"></i>
FAQ
</a>
</li>
<li>
<a href="#">
<i class="fas fa-at"></i>
Contact
</a>
</li>
</ul>
<ul class="list-unstyled CTAs">
<li>Download source</li>
<li>Back to article</li>
</ul>
</nav>
<!-- Page Content Holder -->
<div id="content" class="container-fluid" style="width:100%;overflow:hidden;">
<div id="bg" style="width:100% !important;position:absolute;">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active" style="background-image: url('https://www.publicdomainpictures.net/pictures/170000/velka/red-purple-pattern-background.jpg');">
<div class="carousel-caption">
<h3>First Slide</h3>
<p>This is a description for the first slide.</p>
</div>
</div>
<div class="carousel-item" style="background-image: url('https://www.publicdomainpictures.net/pictures/140000/velka/cool-calm-green-water-background.jpg');">
<div class="carousel-caption">
<h3>Second Slide</h3>
<p>This is a description for the second slide.</p>
</div>
</div>
<div class="carousel-item" style="background-image: url('https://www.publicdomainpictures.net/pictures/170000/velka/blue-brush-strokes-background.jpg');">
<div class="carousel-caption">
<h3>Third Slide</h3>
<p>This is a description for the third slide.</p>
</div>
</div>
</div>
</div>
</div>
<div id="hdr">
<nav class="navbar navbar-default" style="background-color:rgba(0,0,0,0);">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="fas fa-align-left"></i>
<span>Toggle Sidebar</span>
</button>
</div>
</div>
</nav>
</div>
<div id="body" class="container-fluid">
<img id="logo" src="https://upload.wikimedia.org/wikipedia/commons/a/ab/Logo_TV_2015.png">
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
});
});
</script>
</body>
</html>
What can I do?