JSFiddle - React, Tailwind, and code Playground
by brad28b
HTML
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<title>Responsive sidebar submenus</title>
</head>
<body onload="initMap();">
<!--========== HEADER ==========-->
<header class="header">
<div class="header__container">
<img src="https://www.cssscript.com/demo/responsive-multi-level-sidebar-menu/assets/img/perfil.jpg" alt="" class="header__img">
<a href="#" class="header__logo">Bedimcode</a>
<div class="header__search">
<input type="search" placeholder="Search" class="header__input">
<i class='bx bx-search header__icon'></i>
</div>
<div class="header__toggle">
<i class='bx bx-menu' id="header-toggle"></i>
</div>
</div>
</header>
<!--========== NAV ==========-->
<div class="nav" id="navbar">
<nav class="nav__container">
<div>
<a href="#" class="nav__link nav__logo">
<i class='bx bxs-disc nav__icon'></i>
<span class="nav__logo-name">Bedimcode</span>
</a>
<div class="nav__list">
<div class="nav__items">
<h3 class="nav__subtitle">Profile</h3>
<a href="#" class="nav__link active">
<i class='bx bx-home nav__icon'></i>
<span class="nav__name">Home</span>
</a>
<div class="nav__dropdown">
<a href="#" class="nav__link">
<i class='bx bx-user nav__icon'></i>
<span class="nav__name">Profile</span>
<i class='bx bx-chevron-down nav__icon nav__dropdown-icon'></i>
</a>
<div class="nav__dropdown-collapse">
<div class="nav__dropdown-content">
<a href="#"...
CSS
/*========== GOOGLE FONTS ==========*/
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");
/*========== VARIABLES CSS ==========*/
:root {
--header-height: 3.5rem;
--nav-width: 219px;
/*========== Colors ==========*/
--first-color: #6923D0;
--first-color-light: #F4F0FA;
--title-color: #19181B;
--text-color: #58555E;
--text-color-light: #A5A1AA;
--body-color: #F9F6FD;
--container-color: #FFFFFF;
/*========== Font and typography ==========*/
--body-font: 'Poppins', sans-serif;
--normal-font-size: .938rem;
--small-font-size: .75rem;
--smaller-font-size: .75rem;
/*========== Font weight ==========*/
--font-medium: 500;
--font-semi-bold: 600;
/*========== z index ==========*/
--z-fixed: 100;
}
@media screen and (min-width: 1024px) {
:root {
--normal-font-size: 1rem;
--small-font-size: .875rem;
--smaller-font-size: .813rem;
}
}
/*========== BASE ==========*/
*,
::before,
::after {
box-sizing: border-box;
}
body {
margin: var(--header-height) 0 0 0;
padding: 1rem 1rem 0;
font-family: var(--body-font);
font-size: var(--normal-font-size);
background-color: var(--body-color);
color: var(--text-color);
}
#map {
height: 600px;
/* The height is 400 pixels */
width: 100%;
/* The width is the width of the web page */
}
h3 {
margin: 0;
}
a {
text-decoration: none;
}
img {
max-width: 100%;
height: auto;
}
/*========== HEADER ==========*/
.header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: var(--container-color);
box-shadow: 0 1px 0 rgba(22, 8, 43, 0.1);
padding: 0 1rem;
z-index: var(--z-fixed);
}
.header__container {
display: flex;
align-items: center;
height: var(--header-height);
justify-content: space-between;
}
.header__img {
width: 35px;
height: 35px;
border-radius: 50%;
}
.header__logo {
color: var(--title-color);
font-weight: var(--font-medium);
display:...
JavaScript
// Initialize and add the map
function initMap() {
// The location of Uluru
const uluru = {
lat: -25.344,
lng: 131.031
};
// The map, centered at Uluru
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
center: uluru,
});
// The marker, positioned at Uluru
const marker = new google.maps.Marker({
position: uluru,
map: map,
});
}