Issue with dropdown in navbar - Bootstrap - html

Do you guys know why my dropdown in navbar is like this? I'm using the bootstrap framework for my css.
Image of issue
The css for the dropdown is as followed:
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 10rem;
padding: 0.5rem 0;
margin: 0.125rem 0 0;
font-size: 1rem;
color: #212529;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem; }
Here is the html for the header:
<header>
<div class="container" style="height: 80px;">
<div class="logo">
<img src="assets/img/logo.png" style="max-width: 130px;" alt=""/>
</div>
<div class="menu">
<ul>
<li>Hem</li>
<li>Projekt <i class="fas fa-arrow-down"></i>
<div class="dropdown-menu bg-dark" aria-labelledby="navbarDropdown">
<!--<a class="dropdown-item" href="#">Ungdomligt Engagemang</a>-->
</div>
</li>
<li>Om oss</li>
<li>Bli medlem</li>
<li>Sociala Medier <i class="fas fa-arrow-down"></i>
<div class="dropdown-menu bg-dark" aria-labelledby="socmeddropdown">
<a class="dropdown-item" href="https://www.instagram.com/samhallets.unga/" target="_blank">Instagram</a>
<a class="dropdown-item" href="https://discord.gg/pkJMK3hVa5" target="_blank">Discord</a>
</div>
<li>Kontakta oss</li>
<li>Ung Medlem</li>
</ul>
</div>
<div class="mobile-menu"><i class="fa fa-bars"></i></div>
</div>
</header>
Here is the css for the dropdown-item class:
.dropdown-item {
display: block;
width: 100%;
padding: 0.25rem 1.5rem;
clear: both;
font-weight: 400;
color: #212529;
text-align: inherit;
white-space: nowrap;
background-color: transparent;
border: 0; }

Check the position attribute of the dropdown i.e., the element within which dropdown must be present should have position: relative and your dropdown list position: absolute.
Could you please add some code with your question to get more helpful answers
Edit: Checked your site
Just remove the overflow: hidden on <header> tag
header {
overflow: unset; // change here
display: block;
position: absolute;
width: 100%;
top: 0;
left: 0;
z-index: 99;
padding: 40px 0;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
}

Related

How to apply rounded border radius in opposite direction on hover on menu item in menubar [duplicate]

This question already has an answer here:
CSS transparent curved shape with two rounded sides
(1 answer)
Closed 6 months ago.
How to apply rounded border radius in opposite direction on hover on menu item in menubar
I want this effect on menu item hover
Currently my menubar looks like this
This is my css code
sidebar-menu .dropdown-toggle:hover, .sidebar-menu .show>.dropdown-toggle {
background: #f8f9fa;
color: #2daab8;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 70px;
border-top-right-radius: 70px;
width: 250px;
}
HTML Code:
<div class="left-side-bar lftsideBar">
<div class="brand-logo">
<a href="{% url 'home' %}">
<img src="{% static 'website/vendors/images/Rectangle_33.png' %}" alt="" />
</a>
</div>
<div class="close-sidebar" data-toggle="left-sidebar-close">
<i class="ion-close-round"></i>
</div>
<div class="menu-block customscroll">
<div class="sidebar-menu">
<ul id="accordion-menu menucls" style="margin-left: 25px !important;margin-bottom:250px;">
<li>
<a href="{% url 'home' %}" class="dropdown-toggle no-arrow">
<span class="micon dw dw-house-1"></span><span class="mtext">Home</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Client</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Medical</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Social</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Transportation</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Activity</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Food</span>
</a>
</li>
<li>
<a href="#" class="dropdown-toggle no-arrow">
<span class="micon dw dw-add-user"></span><span class="mtext">Reports</span>
</a>
</li>
</ul>
</div>
</div>
Can you please suggest me to what css make changes so I can make exactly same design as per screenshot-1 on each and every item of menubar?
You'll need imagination to be able to create the inverted radius. We could use a circle and use it to mask a square, but CSS mask is not very well supported still. But we can extend on this strategy and use borders to fill the part of a square not occupied by the circle.
In my example below, I've used a holder with overflow:hidden to hide any overflowing border. The size of the holder also determines the size of the final curve since the div inside spans to 100%. Instead of using a full circle, I've used just the 1/4 of it that was needed by rounding just the interesting corner to 100%. The color of the border determines the color of the curve.
.holder{
width:100px;
height:100px;
overflow:hidden;
}
.holder div{
width:100%;
height:100%;
border-bottom-right-radius:100%;
border:99999px solid black;
border-left:none;
border-top:none;
}
<div class="holder">
<div></div>
</div>
Now, armed with that knowledge, you can easily do the same for the bottom part by rounding a different corner. You'll need to add the markup to each menu element tough, and play with the display property. You could try to reduce as much as possible by using the ::before and/or ::after elements but I doupt you'd be able to save much (just maybe get to replace the inner div maybe?)
source code from there
const initNavBar = () => {
const menusEl = document.querySelectorAll('.side-bar ul li')
menusEl.forEach(menu => menu.addEventListener('click', ()=> {
const menuActiveEl = document.querySelector('.side-bar ul li.active')
menuActiveEl.classList.remove('active')
menu.classList.add('active')
}))
}
initNavBar()
:root {
--color-primary: #1380b8;
--color-secondary: #33ace3;
}
aside.side-bar-wrap {
--radius-size: 25px;
height: 98vh;
position: fixed;
top: 1vh;
left: 1vh;
overflow-y: scroll;
overflow-x: hidden;
border-radius: var(--radius-size);
padding-right: 2px;
}
aside.side-bar-wrap::-webkit-scrollbar {
width: 10px;
}
aside.side-bar-wrap::-webkit-scrollbar-track {
background-color: transparent;
}
aside.side-bar-wrap::-webkit-scrollbar-thumb {
border-radius: var(--radius-size);
background-color: var(--color-primary);
}
nav.side-bar {
min-height: 100%;
background-color: var(--color-primary);
display: inline-block;
border-left: var(--radius-size) solid var(--color-secondary);
border-right: var(--radius-size) solid var(--color-primary);
border-radius: var(--radius-size);
}
nav.side-bar .logo-area {
--curve-size: calc(2 * var(--radius-size));
position: relative;
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
min-height: var(--curve-size);
background-color: var(--color-secondary);
border-radius: 0 var(--radius-size) var(--radius-size) 0;
box-shadow: var(--radius-size) 0 var(--color-secondary);
}
nav.side-bar .logo-area::after {
content: '';
width: var(--curve-size);
height: var(--curve-size);
background-color: var(--color-primary);
border-radius: 50%;
position: absolute;
bottom: calc(-1 * var(--curve-size));
left: 0;
box-shadow: calc(-1 * var(--curve-size) * 0.5) calc(-1 * var(--curve-size) * 0.5) var(--color-secondary);
}
nav.side-bar .logo-area img {
position: absolute;
max-height: 75%;
transition-duration: 1s;
}
aside.side-bar-wrap:hover nav.side-bar .logo-area img.min {
max-height: 0;
opacity: 0;
}
nav.side-bar .logo-area img.max {
max-width: 0;
opacity: 0;
transition-duration: 1s;
}
aside.side-bar-wrap:hover nav.side-bar .logo-area img.max {
max-width: 90%;
opacity: 1;
}
nav.side-bar ul {
padding: 0;
margin: calc(2 * var(--radius-size)) 0;
display: flex;
flex-direction: column;
}
nav.side-bar ul li {
height: 50px;
padding: 10px var(--radius-size);
list-style: none;
border-radius: var(--radius-size);
margin-bottom: var(--radius-size);
z-index: 1;
}
nav.side-bar ul li:not(.active) {
z-index: 2;
}
nav.side-bar ul li:not(.active):hover {
backdrop-filter: brightness(0.85);
}
nav.side-bar ul li.active {
position: relative;
background-color: var(--color-secondary);
border-radius: 0 var(--radius-size) var(--radius-size) 0;
}
nav.side-bar ul li.active::before,
nav.side-bar ul li.active::after {
--curve-size: calc(2 * var(--radius-size));
content: '';
width: var(--curve-size);
height: var(--curve-size);
background-color: var(--color-primary);
border-radius: 50%;
position: absolute;
}
nav.side-bar ul li.active::before {
top: calc(-1 * var(--curve-size));
left: 0;
box-shadow: calc(-1 * var(--curve-size) * 0.5) calc(var(--curve-size) * 0.5) var(--color-secondary);
}
nav.side-bar ul li.active::after {
bottom: calc(-1 * var(--curve-size));
left: 0;
box-shadow: calc(-1 * var(--curve-size) * 0.5) calc(-1 * var(--curve-size) * 0.5) var(--color-secondary);
}
nav.side-bar ul li a{
color: white;
font-size: 16pt;
width: 100%;
height: 100%;
display: flex;
gap: 0;
align-items: center;
text-decoration: none;
transition: 1s;
}
aside:hover nav.side-bar ul li a{
gap: 10px;
}
nav.side-bar ul li a span {
display: flex;
transition: 0.75s cubic-bezier(0.39, 0.58, 0.57, 1);
}
nav.side-bar ul li a span.icon {
font-size: 24pt;
}
nav.side-bar ul li a span.title {
max-width: 0;
opacity: 0;
}
aside:hover nav.side-bar ul li a span.title {
width: auto;
max-width: 10rem;
opacity: 1;
}
<aside class="side-bar-wrap">
<nav class="side-bar">
<div class="logo-area">
<img class="min" src="images/min-logo.png" alt="logo">
<img class="max" src="images/max-logo.png" alt="logo">
</div>
<ul>
<li class="active">
<a href="#">
<span class="title">Home</span>
</a>
</li>
<li>
<a href="#">
<span class="title">News</span>
</a>
</li>
<li>
<a href="#">
<span class="title">Jobs</span>
</a>
</li>
<li>
<a href="#">
<span class="title">Contact</span>
</a>
</li>
<li>
<a href="#">
<span class="title">About</span>
</a>
</li>
</ul>
</nav>
</aside>

HTML menu markup position

I cannot understand how, in my case, possible to properly positioned the menu by creating only one class menu, instead of menu_left and menu_right classes.
How can I optimize css here?
Here's code example:
html:
<div class="menu_left" >
<div class="menu__item">
<span class="menu__item__link__text">SHOP</span>
</div>
<div class="menu__item">
<span class="menu__item__link__text">ABOUT</span>
</div>
</div>
<a href="" class="logo">
<img src="assets/sds.jpgf" class="logo__image">
</a>
<div class ="menu_right">
<div class="menu__item">
<span class="menu__item__link__text">CART</span>
</div>
<div class="menu__item">
<span class="menu__item__link__text">EUR</span>
</div>
</div>
Menu Image
css
.menu_left {
background: rgba(0, 0, 0, 0.85);
position: relative;
top: auto;
right: auto;
bottom: auto;
left: auto;
background: transparent;
float: left;
width: auto;
opacity: 1;
visibility: visible;
-webkit-transition: none;
-moz-transition: none;
transition: none; }
.menu_right{
position: relative;
top: auto;
right: auto;
bottom: auto;
left: auto;
background: transparent;
float: right;
width: auto;
opacity: 1;
visibility: visible;
-webkit-transition: none;
-moz-transition: none;
transition: none; }
}
Try it with Flexbox
See flexbox menu here
HTML
<div class="menu">
<ul>
<li>
Lorem
</li>
<li>
Lorem
</li>
</ul>
<div class="img"> <!-- replace div with the <img src="" alt="" /> tag -->
img here
</div>
<ul>
<li>
Lorem
</li>
<li>
Lorem
</li>
</ul>
</div>
CSS
.menu {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 5px 10px;
background: #ddd;
}
ul {
display: flex;
padding: 0;
list-style: none;
}
a {
padding: 5px 10px;
color: #000;
text-decoration: none;
text-transform: uppercase;
}
.img {
width: 200px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
background-color: #000;
color: #fff;
}
To optimize CSS when using very similar settings, use three classes instead of two: One common class for both elements which contains all the common settings, and two separate classes for the two elements which contain the different settings:
CSS:
.menu_all {
position: relative;
top: auto;
right: auto;
bottom: auto;
left: auto;
background: transparent;
width: auto;
opacity: 1;
visibility: visible;
-webkit-transition: none;
-moz-transition: none;
transition: none;
top: auto;
right: auto;
bottom: auto;
left: auto;
background: transparent;
}
.menu_left {
background: rgba(0, 0, 0, 0.85);
float: left;
}
.menu_right{
float: right;
}
and HTML:
<div class="menu_all menu_left" >
<div class="menu__item">
<span class="menu__item__link__text">SHOP</span>
</div>
<div class="menu__item">
<span class="menu__item__link__text">ABOUT</span>
</div>
</div>
<a href="" class="logo">
<img src="assets/sds.jpgf" class="logo__image">
</a>
<div class ="menu_all menu_right">
<div class="menu__item">
<span class="menu__item__link__text">CART</span>
</div>
<div class="menu__item">
<span class="menu__item__link__text">EUR</span>
</div>
</div>

Content stuck to navbar

Photo of the page
I have my website's content somehow stuck to the navigation menu. I have tried putting it in a different div but nothing has worked for me so far, neither replacing the placing of the container class. I dont understand why the body's main content wont align underneath the navigational menu and be in its own section so that it doesn't leak out. Any help would be greatly appreciated.
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
max-width: calc(100vw - 20px);
min-height: 100vh;
}
body {
width: 100%;
overflow-x: hidden;
}
#container {
min-height: 100%;
position: relative;
width: 100%;
}
main {
margin-left: 100px;
}
/*
html {
display: block;
}
/*
/* SCROLL BAR CSS STARTS */
body::-webkit-scrollbar {
width: 0.30rem;
}
body::-webkit-scrollbar-track {
background: #212429;
}
body::-webkit-scrollbar-thumb {
background: #fc3218;
}
/* SCROLL BAR CSS ENDS */
/* NAV BAR CSS STARTS */
.logo {
margin-right: 5px;
}
.my-nav {
position: absolute;
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
}
.navbar-light .navbar-nav .nav-link {
color: white;
}
.navbar-nav>li {
padding-left: 35px;
padding-right: 55px;
float: none;
display: table-cell;
text-align: center;
font-size: 14px;
}
.navbar-light .navbar-nav .nav-link:focus,
.navbar-light .navbar-nav .nav-link:hover {
color: #fc3218;
}
.navbar-light .navbar-nav .nav-link:focus,
.navbar-light .navbar-nav .nav-link:active {
color: #fc3218;
}
.navbar {
margin-top: 0px;
margin-left: 10px;
width: 100%;
background: #22252a;
}
.dropdown-menu {
color: white;
background-color: #fc3218;
}
.dropdown-item {
color: white;
font-size: 12px;
}
/* NAV BAR CSS END */
/* SIDEBAR CSS STARTS */
.lateral-nav {
position: absolute;
top: 0;
left: 0;
width: 100px;
background: #fafafc;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
img {
width: 60px;
height: 45px;
margin-top: 3px;
}
.lateral-nav a {
writing-mode: vertical-lr;
text-orientation: mixed;
margin: 5px 0;
}
.socialbox {
position: fixed;
display: inline-block;
top: 50%;
left: 0;
width: 80px;
height: auto;
margin: -120px 0 0;
text-align: center;
}
.socialbox img {
display: inline-block;
width: 30px;
height: 30px;
padding: 5px;
margin: 4px;
box-sizing: border-box;
}
.socialbox::before {
content: "#Suivez-nous";
bottom: -180px;
left: -38px;
width: 150px;
font-size: 16px;
font-weight: 800;
letter-spacing: 0;
color: #000f33;
transform: rotate(-90deg);
}
.socialbox::after {
content: "";
bottom: -105px;
left: 50%;
width: 1px;
height: 110px;
margin: 0 0 0 -2px;
background-color: #dddee4;
}
.socialbox::after,
.socialbox::before {
position: absolute;
display: inline-block;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0);
}
.socialbox .fa {
font-size: 20px;
color: #000f33;
-webkit-transition: all .4s linear;
transition: all .4s linear;
}
/* SIDEBAR CSS ENDS */
/* CARD DECK START */
.card-deck {
width: 90%;
margin: auto;
}
/* CARD DECK END */
/* Footer start */
footer {
background: #16222A;
background: -webkit-linear-gradient(59deg, #3A6073, #16222A);
background: linear-gradient(59deg, #3A6073, #16222A);
color: white;
width: calc(100% - 85px);
margin-left: 100px;
margin-right: -15px;
}
footer a {
color: #fff;
font-size: 14px;
transition-duration: 0.2s;
}
footer a:hover {
color: #FA944B;
text-decoration: none;
}
.copy {
font-size: 12px;
padding: 10px;
border-top: 1px solid #FFFFFF;
}
.footer-middle {
padding-top: 2em;
color: white;
}
/* Footer social icons */
ul.social-network {
list-style: none;
display: inline;
margin-left: 0 !important;
padding: 0;
}
ul.social-network li {
display: inline;
margin: 0 5px;
}
.social-network a.icoFacebook:hover {
background-color: #3B5998;
}
.social-network a.icoLinkedin:hover {
background-color: #007bb7;
}
.social-network a.icoFacebook:hover i,
.social-network a.icoLinkedin:hover i {
color: #fff;
}
.social-network a.socialIcon:hover,
.socialHoverClass {
color: #44BCDD;
}
.social-circle li a {
display: inline-block;
position: relative;
margin: 0 auto 0 auto;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
text-align: center;
width: 30px;
height: 30px;
font-size: 15px;
}
.social-circle li i {
margin: 0;
line-height: 30px;
text-align: center;
}
.social-circle li a:hover i,
.triggeredHover {
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-ms--transform: rotate(360deg);
transform: rotate(360deg);
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-o-transition: all 0.2s;
-ms-transition: all 0.2s;
transition: all 0.2s;
}
.social-circle i {
color: #595959;
-webkit-transition: all 0.8s;
-moz-transition: all 0.8s;
-o-transition: all 0.8s;
-ms-transition: all 0.8s;
transition: all 0.8s;
}
.social-network a {
background-color: #F9F9F9;
}
/* Footer end */
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/carousel/">
<link rel="stylesheet" href="style1.css">
<link rel="stylesheet" href="normalize.css">
<!-- Bootstrap core CSS -->
<link href="../../dist/css/bootstrap.min.css" rel="stylesheet">
<title>Hello, world!</title>
</head>
<body>
<div id="container">
<!-- Navigation menu -->
<header>
<nav class="my-nav navbar navbar-light navbar-expand-lg">
<button class="navbar-toggler" type="button" data-toggle="collapse" data- target="#navbarsExample08"
aria-controls="navbarsExample08" aria-expanded="false" aria- label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-md-center" id="navbarsExample08">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown08" data-toggle="dropdown" aria- haspopup="true"
aria-expanded="false">ACTIVITES</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Rafting</a>
<a class="dropdown-item" href="#">Canooing</a>
<a class="dropdown-item" href="#">Parachute</a>
<a class="dropdown-item" href="#">Soufflerie</a>
<a class="dropdown-item" href="#">Saut elastique</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#">OFFRES</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">EVENEMENTS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">A PROPOS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ESPACE HANDICAP</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">CONTACT</a>
</li>
</ul>
</div>
</nav>
</header>
<!-- Navigation menu -->
<!-- Sidebar menu -->
<div class="lateral-nav position-fixed">
<img class="logo" src="./img/so.png" alt="">
<div class="socialbox ">
<img class="fa fa-facebook" src="./img/facebook.png" alt="">
<img class="fa fa-twitter" src="./img/twitter.png" alt="">
<img class="fa fa-youtube" src="./img/youtube.png" alt="">
</div>
</div>
<!-- Sidebar menu -->
<!-- Website Content -->
<main>
<section>
<!-- NOS ACTIVITES START -->
<h2 class="text-center">NOS ACTIVITES</h2>
<div class="card-deck ">
<div class="card text-center" style="width: 18rem;">
<div class="card-body rafting">
<h5 class="card-title">RAFTING</h5>
RÉSERVEZ
</div>
</div>
<div class="card text-center" style="width: 18rem; height: 15rem;">
<div class="card-body canooing">
<h5 class="card-title">CANNOING</h5>
RÉSERVEZ
</div>
</div>
<div class="card text-center" style="width: 18rem;">
<div class="card-body parachute">
<h5 class="card-title">PARACHUTE</h5>
RÉSERVEZ
</div>
</div>
<div class="card text-center" style="width: 18rem;">
<div class="card-body soufflerie">
<h5 class="card-title">SOUFFLERIE</h5>
RÉSERVEZ
</div>
</div>
<div class="card text-center" style="width: 18rem;">
<div class="card-body saut-elastique">
<h5 class="card-title">SAUT ELASTIQUE</h5>
RÉSERVEZ
</div>
</div>
</div>
<!-- NOS ACTIVITES END -->
</section>
</main>
</div>
<!-- Footer Start -->
<footer class="mainfooter" role="contentinfo">
<div class="footer-middle">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>Heading 1</h4>
<ul class="list-unstyled">
<li></li>
<li>Payment Center</li>
<li>Contact Directory</li>
<li>Forms</li>
<li>News and Updates</li>
<li>FAQs</li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>Heading 2</h4>
<ul class="list-unstyled">
<li>Website Tutorial</li>
<li>Accessibility</li>
<li>Disclaimer</li>
<li>Privacy Policy</li>
<li>FAQs</li>
<li>Webmaster</li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>Heading 3</h4>
<ul class="list-unstyled">
<li>Parks and Recreation</li>
<li>Public Works</li>
<li>Police Department</li>
<li>Fire</li>
<li>Mayor and City Council</li>
<li>
</li>
</ul>
</div>
</div>
<div class="col-md-3">
<h4>Follow Us</h4>
<ul class="social-network social-circle">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-linkedin"></i></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-12 copy">
<p class="text-center">© Copyright 2018 - Company Name. All rights reserved.</p>
</div>
</div>
</div>
</div>
</footer>
<!-- Footer Ends -->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous">
</script>
</body>
</html>
This is because of the position: absolute on .my-nav element. Just remove that or change it to relative and you should be good
Why do you use position: absolute for the my-nav? What position: absolute or fixed does, it pulls out the element (my-nav) from the document context. If you check this and debug in your browser, you can see that the header has height equal to 0.
In order to fix the card-deck layout, just simply remove the position absolute.
If you want the menu, to be visible when you scroll down the page, consider putting position: sticky on the header.
like:
header {
position: sticky;
top: 0; // need to apply top and left for position sticky to work
left: 0;
z-index: 5; // z-index, so it is at the top
}
.my-nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
}
You can add padding to the top of the div which contains the card deck :
.card-deck {
width: 90%;
margin: auto;
padding-top:50px;
}
for the heading to move down edit this part in HTML file:
<h2 style="padding-top:40px;" class="text-center">NOS ACTIVITES</h2>

how to create a fullscreen overlay menu?

I am trying to make a full-screen menu with two sides, one side has a list of items; Home, Services, Portfolio and the other side will show an image on item hover. For example, if mouse hover on Services, a new image shows up and so.
This is what I need:
But, this is what I have so far:
Another example of what I'm trying to do is this website
Any help pleaseee??
Thanks,
PS: Hide the image in mobile.
.overlay {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: $dkgreen;
background-color: $dkgreen;
overflow-x: hidden;
transition: 0.5s;
}
.overlay-content {
position: relative;
/* top: 25%;*/
width: 100%;
text-align: center;
* margin-top: 30px;
*/
}
.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block;
transition: 0.3s;
}
.overlay a:hover,
.overlay a:focus {
color: #f1f1f1;
}
.overlay .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
z-index: 1;
}
#media screen and (max-height: 450px) {
.overlay a {
font-size: 20px
}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
<nav class=" navbar navbar-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#"><img src="./img/maduro-logo.png" class="img-fluid" width="115" /></a>
<button class="navbar-toggler custom-toggler" type="button" onclick="openNav()">
<span class="navbar-toggler-icon"></span>
</button>
<div id="myNav" class="overlay">
<div class="row overlay-content">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×
</a>
<div class="col-sm-5">
<a style="color: #fff;" id="" class="" href="index.php">Home</a>
<a style="color: #fff;" id="" class="" href="services.php">Services</a>
<a style="color: #fff;" id="" class="" href="portfolio.php">Portfolio</a>
<a style="color: #fff;" id="" class="" href="clients.php">Clients</a>
<a style="color: #fff;" id="" class="" href="contact.php">Contact</a>
</div>
<div class="col-sm-7">
<img class="img-fluid" src="img/a.jpg">
</div>
</div>
</div>
Edit:
$('#home').hover(function() {
$('.change-img').css({
"background-image": "url('https://www.ryanhomes.com/rh-community-gallery-NewAspectRatio/7ac519ed-9b29-47b0-a489-ded2da8b770f/db/7ac519ed-9b29-47b0-a489-ded2da8b770f.jpg')"
});
});
$('#services').hover(function() {
$('.change-img').css({
"background-image": "url('https://www.starwebcreations.com/new_images/services.jpg')"
});
});
$('#portfolio').hover(function() {
$('.change-img').css({
"background-image": "url('https://www.ryanhomes.com/rh-community-gallery-NewAspectRatio/7ac519ed-9b29-47b0-a489-ded2da8b770f/db/7ac519ed-9b29-47b0-a489-ded2da8b770f.jpg')"
});
});
$('#clients').hover(function() {
$('.change-img').css({
"background-image": "url('https://www.starwebcreations.com/new_images/services.jpg')"
});
});
$('#contact').hover(function() {
$('.change-img').css({
"background-image": "url('https://www.ryanhomes.com/rh-community-gallery-NewAspectRatio/7ac519ed-9b29-47b0-a489-ded2da8b770f/db/7ac519ed-9b29-47b0-a489-ded2da8b770f.jpg')"
});
});
.side-bar {
width: 50vw;
background-color: #ddd;
height: 100vh;
position: fixed;
top: 0;
left: 0;
bottom: 0;
}
.side-bar>ul {
list-style-type: none;
}
.side-bar>ul>li {
text-align: center;
padding: 15px 0;
cursor: pointer;
}
.img-sec {
width: 50vw;
background-color: #333;
height: 100vh;
position: fixed;
top: 0;
right: 0;
bottom: 0;
}
.change-img {
width: 100%;
max-height: 100%;
background-size: cover;
background-position: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<div class="side-bar">
<ul>
<li id="home">Home</li>
<li id="services">Services</li>
<li id="portfolio">Portfolio</li>
<li id="clients">Clients</li>
<li id="contact">Contacts</li>
</ul>
</div>
<div class="img-sec">
<div class="change-img"></div>
</div>
</div>

html link buttons centered on page

Currently I am trying to create some links that look like buttons. It's working fairly well, except I want to be able to align them horizontally. This what I have so far:
.border {
display: table;
width: 220px;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
border-spacing: 10px;
float:left;
}
.border:hover {
border-spacing: 2px;
}
a.btn {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #ffffff;
font: 17.5px sans-serif;
text-decoration: none;
background-color: #1E5034;
line-height: 20px;
margin-bottom: 0;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited,
a.btn:link {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
Edit:
If it has display:inline-block; it will mess up with formatting with heights and not center the text.
I'm trying to create something as shown here, but then be able to center this on the page as well.
Thanks!
Support in all browsers including IE.
.btn-grp {
position: absolute;
top: 0%;
left: 50%;
transform: translate(-50%, 0%);
width: 80vw;
}
.border {
display: table;
width: 25%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
border-spacing: 10px;
float: left;
}
.border:hover {
border-spacing: 2px;
}
a.btn {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #ffffff;
font: 17.5px sans-serif;
text-decoration: none;
background-color: #1E5034;
line-height: 20px;
margin-bottom: 0;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited,
a.btn:link {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
If you need the 4 div at vertically centered then use:
.btn-grp {
position: absolute;
top: 50%;
left:50%;
transform: translate(-50%, -50%);
}
Because you are using width in px thats why then don't come in a single row...So try to use % width i.e. 25%...
.border {
display: table;
width: 25%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
border-spacing: 10px;
float: left;
}
.border:hover {
border-spacing: 2px;
}
a.btn {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #ffffff;
font: 17.5px sans-serif;
text-decoration: none;
background-color: #1E5034;
line-height: 20px;
margin-bottom: 0;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited,
a.btn:link {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
Well I recommend you to use Flexbox here...It will give you the full control to align the item vertically and horizontally...Also you will need to use :after for the background, as flexbox does not allow border-spacing
.btn-grp {
display: flex;
justify-content: center;
}
.border {
width: 20%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 10px;
}
a.btn {
text-align: center;
color: #ffffff;
font: 16px sans-serif;
text-decoration: none;
line-height: 20px;
margin-bottom: 0;
flex: 1;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
.border:before {
content: "";
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #1f5034;
position: absolute;
z-index: -1;
transition: all .3s ease;
transform: scale(0.85);
}
.border:hover:before {
transform: scale(0.95);
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
Well for IE 8 support use display:inline-block and transform to place the content in center...
.btn-grp {
text-align: center;
font-size: 0;
}
.border {
width: 20%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
display: inline-block;
vertical-align: top;
position: relative;
padding: 10px;
}
a.btn {
text-align: center;
color: #ffffff;
font: 16px sans-serif;
text-decoration: none;
line-height: 20px;
margin-bottom: 0;
position: relative;
top: 50%;
transform: translateY(-50%);
display: block;
}
.border:before {
content: "";
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #1f5034;
position: absolute;
z-index: -1;
transition: all .3s ease;
transform: scale(0.85);
}
.border:hover:before {
transform: scale(0.95);
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>