I'm trying to get the ul with the id #cloudmenu (line 51 in html) to display when I hover over the li with the id #cloud (line 50 in html). The CSS I wrote is in line 96-103 of the CSS.
What I'm trying to archieve specifically is that I want change display: none; of the #cloudmenu ul to display: grid; when I hover over the #cloud li
For some reason #cloud:hover #cloudmenu doesn't work like I thought it would...
/*--------STYLE.CSS--------*/
#import url('https://fonts.googleapis.com/css?family=Alegreya+Sans:300,500,700');
* {
margin: 0;
padding: 0;
border: 0;
}
html {
height: 100%;
}
body {
height: 100%;
background: #424949;
color: #f5f5f5;
font-family: 'Alegreya Sans', sans-serif;
margin: 0;
overflow: hidden;
}
h2 {
font-size: 250%;
font-weight: 700;
text-align: center;
padding-top: 2%;
}
p {
font-size: 160%;
font-weight: 500;
line-height: 150%;
padding: 10px;
/*3%*/
text-indent: 20px;
/*2%*/
text-align: justify;
}
img {
height: auto;
width: auto;
}
header {
background-color: #1a1a1a;
width: 100%;
height: 86px;
}
#header-inner {
max-width: 1200px;
margin: 0 auto;
}
#logo {
margin: 0 0 0 20px;
padding: 0 10px 0 10px;
/*top right bottom left*/
float: left;
width: 86px;
height: 86px;
background: url(https://slothy.cloud/img/logohead.svg) no-repeat center;
}
#logo:hover {
transition: all .1s linear;
transform: translateY(-4px);
}
nav {
float: right;
padding: 4px 20px 0 0;
height: 82px;
}
#menu-icon {
display: none;
}
#menu-icon i {
font-size: 240%;
color: #f5f5f5;
padding: 15px 20px 15px 20px;
margin: 0 6px 0 0;
}
#menu-icon i:hover {
color: #616a6b;
}
ul {
list-style-type: none;
}
nav ul li {
font-family: 'Alegreya Sans', sans-serif;
font-size: 150%;
display: inline-block;
float: left;
margin-top: -5px;
}
nav ul li a {
color: #f5f5f5;
text-decoration: none;
padding: 37px 25px 22px 25px;
display: inline-block;
}
a:hover#home,
a#homecurrent {
color: #f5f5f5;
background: #616a6b;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #424949;
}
a:hover#cloud,
a#cloudcurrent {
color: #f5f5f5;
background: #3498db;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #2874a6;
}
a:hover#paste,
a#pastecurrent {
color: #f5f5f5;
background: #2ecc71;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #239b56;
}
a:hover#uptime,
a#uptimecurrent {
color: #f5f5f5;
background: #e74c3c;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #b03a2e;
}
a:hover#contact,
a#contactcurrent {
color: #f5f5f5;
background: #f1c40f;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #b7950b;
}
#cloudmenu {
display: none;
position: relative;
background: #1a1a1a;
}
#cloud:hover #cloudmenu {
display: grid;
}
.container {
overflow: hidden;
width: 100%;
height: calc(100% - 86px - 69px);
background-color: #303030;
}
.container img {
height: 100%;
width: 100%;
object-fit: cover;
pointer-events: none;
}
.container video {
height: 100%;
width: 100%;
object-fit: cover;
pointer-events: none;
}
.container-inner {
height: 100%;
max-width: 1100px;
margin: 0 auto;
}
footer {
background: #1a1a1a;
width: 100%;
}
.social {
list-style-type: none;
text-align: center;
}
.social li {
display: inline;
margin: 0px -3px;
}
.social i {
font-size: 260%;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 7%;
padding-right: 7%;
color: #616a6b
}
.social i:hover {
color: #f5f5f5;
transition: all .1s linear;
transform: translateY(-6px);
}
/*--------SMARTPHONE--------*/
#media screen and (max-width: 768px) {
h2 {
font-size: 150%;
}
header {
z-index: +10;
position: absolute;
height: 66px;
}
#logo {
margin: 0 0 0 10px;
height: 66px;
width: 66px;
}
#menu-icon {
display: inline-block;
}
nav {
padding: 0px;
height: 66px;
}
nav ul,
nav:active ul {
display: none;
z-index: -1;
position: absolute;
padding: 26px 20px 10px 20px;
background: #1a1a1a;
right: 0px;
top: 45px;
border-radius: 0 0 0 15px;
width: 40%;
}
nav:hover ul {
display: block;
}
nav li {
text-align: center;
width: 100%;
padding: 10px 0 10px 0;
}
nav ul li a {
color: #f5f5f5;
text-decoration: none;
padding: 15px 46px 15px 46px;
}
.container {
padding-top: 66px;
height: calc(100% - 66px - 56px);
}
.container video {
display: none;
}
.social li {
margin: 0px;
}
.social i {
font-size: 240%;
padding-top: 10px;
padding-bottom: 10px;
}
}
<!-- Home page of slothy.cloud -->
<!DOCTYPE html>
<html>
<!--
My small cozy website.
© veryslothysloth 2018
-->
<head>
<!-- Links -->
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#2e86c1">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<!-- Open Graph Protocol -->
<meta property="og:url" content="https://slothy.cloud">
<meta property="og:type" content="website">
<meta property="og:title" content="slothy.cloud | by veryslothysloth">
<meta property="og:description" content="A small slothy website.">
<meta property="og:image" content="https://slothy.cloud/img/slothyicon.png">
<!-- Twitter card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="slothy.cloud |by veryslothysloth">
<meta name="twitter:description" content="A small slothy website.">
<meta name="twitter:image" content="https://slothy.cloud/img/slothyicon.png">
<!-- Data -->
<title>slothy.cloud | by veryslothysloth</title>
<meta charset="utf-8">
<meta name="description" content="A small slothy website.">
<meta name="keywords" content="sloth,slothy,veryslothysloth,file,upload,hosting,lolisafe">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#616a6b">
</head>
<body>
<header>
<!-- Header -->
<div id="header-inner">
<nav>
<i class="fas fa-bars"></i>
<ul>
<li>Home</li>
<li>Cloud
<ul id="cloudmenu">
<li>Frontpage</li>
<li>Dashboard</li>
<li>FAQ</li>
<li>On Github</li>
</ul>
</li>
<li>Paste</li>
<li>Uptime</li>
<li>Contact</li>
</ul>
</nav>
</div>
</header>
<!-- Main Body -->
<div class="container" id="container">
<video autoplay muted loop src="" id="backgroundVid" type="video/mp4" alt="Background_Video" media="min-width: 768px"></video>
<img src="" id="backgroundImg" type="image/jpg" alt="Background_Image">
<!-- Random Background Script -->
<script>
var backgrounds = ['alley0', 'alley1', 'neonsigns0', 'neonsigns1', 'shrine0']
var background = backgrounds[Math.floor(Math.random() * backgrounds.length)];
document.getElementById('backgroundVid').src = 'img/background/' + background + '.mp4';
document.getElementById('backgroundImg').src = 'img/background/' + background + '.jpg';
</script>
<!--<div class="container-inner">
<p>Test Text</p>
</div>-->
</div>
<!-- Footer -->
<footer>
<ul class="social">
<li><i class="fab fa-twitter"></i></li>
<li><i class="fab fa-instagram"></i></li>
<li><i class="fab fa-steam"></i></li>
<li><i class="fab fa-github"></i></li>
<!--<li><i class="fas fa-at"></i></li>-->
</ul>
</footer>
</body>
</html>
Thanks in advance for the help!
Your current selector is selecting a #cloudmenu nested inside a #cloud element which is not how your HTML is structured. BTW, #cloud is an a not the parent li (you said "when I hover over the #cloud li" ... there is no "#cloud li").
Your need a CSS sibling selector ~ or +.
#cloud:hover ~ #cloudmenu {
display: grid;
}
Also, try setting your #cloudmenu to position: absolute; so it doesn't flicker.
#cloudmenu {
display: none;
position: absolute;
background: #1a1a1a;
}
Here is a fiddle (with a larger viewport): https://jsfiddle.net/qL3Ldpad/
/*--------STYLE.CSS--------*/
#import url('https://fonts.googleapis.com/css?family=Alegreya+Sans:300,500,700');
* {
margin: 0;
padding: 0;
border: 0;
}
html {
height: 100%;
}
body {
height: 100%;
background: #424949;
color: #f5f5f5;
font-family: 'Alegreya Sans', sans-serif;
margin: 0;
overflow: hidden;
}
h2 {
font-size: 250%;
font-weight: 700;
text-align: center;
padding-top: 2%;
}
p {
font-size: 160%;
font-weight: 500;
line-height: 150%;
padding: 10px;
/*3%*/
text-indent: 20px;
/*2%*/
text-align: justify;
}
img {
height: auto;
width: auto;
}
header {
background-color: #1a1a1a;
width: 100%;
height: 86px;
}
#header-inner {
max-width: 1200px;
margin: 0 auto;
}
#logo {
margin: 0 0 0 20px;
padding: 0 10px 0 10px;
/*top right bottom left*/
float: left;
width: 86px;
height: 86px;
background: url(https://slothy.cloud/img/logohead.svg) no-repeat center;
}
#logo:hover {
transition: all .1s linear;
transform: translateY(-4px);
}
nav {
float: right;
padding: 4px 20px 0 0;
height: 82px;
}
#menu-icon {
display: none;
}
#menu-icon i {
font-size: 240%;
color: #f5f5f5;
padding: 15px 20px 15px 20px;
margin: 0 6px 0 0;
}
#menu-icon i:hover {
color: #616a6b;
}
ul {
list-style-type: none;
}
nav ul li {
font-family: 'Alegreya Sans', sans-serif;
font-size: 150%;
display: inline-block;
float: left;
margin-top: -5px;
}
nav ul li a {
color: #f5f5f5;
text-decoration: none;
padding: 37px 25px 22px 25px;
display: inline-block;
}
a:hover#home,
a#homecurrent {
color: #f5f5f5;
background: #616a6b;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #424949;
}
a:hover#cloud,
a#cloudcurrent {
color: #f5f5f5;
background: #3498db;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #2874a6;
}
a:hover#paste,
a#pastecurrent {
color: #f5f5f5;
background: #2ecc71;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #239b56;
}
a:hover#uptime,
a#uptimecurrent {
color: #f5f5f5;
background: #e74c3c;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #b03a2e;
}
a:hover#contact,
a#contactcurrent {
color: #f5f5f5;
background: #f1c40f;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #b7950b;
}
#cloudmenu {
display: none;
position: absolute;
background: #1a1a1a;
}
#cloud:hover ~ #cloudmenu {
display: grid;
}
.container {
overflow: hidden;
width: 100%;
height: calc(100% - 86px - 69px);
background-color: #303030;
}
.container img {
height: 100%;
width: 100%;
object-fit: cover;
pointer-events: none;
}
.container video {
height: 100%;
width: 100%;
object-fit: cover;
pointer-events: none;
}
.container-inner {
height: 100%;
max-width: 1100px;
margin: 0 auto;
}
footer {
background: #1a1a1a;
width: 100%;
}
.social {
list-style-type: none;
text-align: center;
}
.social li {
display: inline;
margin: 0px -3px;
}
.social i {
font-size: 260%;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 7%;
padding-right: 7%;
color: #616a6b
}
.social i:hover {
color: #f5f5f5;
transition: all .1s linear;
transform: translateY(-6px);
}
/*--------SMARTPHONE--------*/
#media screen and (max-width: 768px) {
h2 {
font-size: 150%;
}
header {
z-index: +10;
position: absolute;
height: 66px;
}
#logo {
margin: 0 0 0 10px;
height: 66px;
width: 66px;
}
#menu-icon {
display: inline-block;
}
nav {
padding: 0px;
height: 66px;
}
nav ul,
nav:active ul {
display: none;
z-index: -1;
position: absolute;
padding: 26px 20px 10px 20px;
background: #1a1a1a;
right: 0px;
top: 45px;
border-radius: 0 0 0 15px;
width: 40%;
}
nav:hover ul {
display: block;
}
nav li {
text-align: center;
width: 100%;
padding: 10px 0 10px 0;
}
nav ul li a {
color: #f5f5f5;
text-decoration: none;
padding: 15px 46px 15px 46px;
}
.container {
padding-top: 66px;
height: calc(100% - 66px - 56px);
}
.container video {
display: none;
}
.social li {
margin: 0px;
}
.social i {
font-size: 240%;
padding-top: 10px;
padding-bottom: 10px;
}
}
<!-- Home page of slothy.cloud -->
<!DOCTYPE html>
<html>
<!--
My small cozy website.
© veryslothysloth 2018
-->
<head>
<!-- Links -->
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#2e86c1">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<!-- Open Graph Protocol -->
<meta property="og:url" content="https://slothy.cloud">
<meta property="og:type" content="website">
<meta property="og:title" content="slothy.cloud | by veryslothysloth">
<meta property="og:description" content="A small slothy website.">
<meta property="og:image" content="https://slothy.cloud/img/slothyicon.png">
<!-- Twitter card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="slothy.cloud |by veryslothysloth">
<meta name="twitter:description" content="A small slothy website.">
<meta name="twitter:image" content="https://slothy.cloud/img/slothyicon.png">
<!-- Data -->
<title>slothy.cloud | by veryslothysloth</title>
<meta charset="utf-8">
<meta name="description" content="A small slothy website.">
<meta name="keywords" content="sloth,slothy,veryslothysloth,file,upload,hosting,lolisafe">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#616a6b">
</head>
<body>
<header>
<!-- Header -->
<div id="header-inner">
<nav>
<i class="fas fa-bars"></i>
<ul>
<li>Home</li>
<li>Cloud
<ul id="cloudmenu">
<li>Frontpage</li>
<li>Dashboard</li>
<li>FAQ</li>
<li>On Github</li>
</ul>
</li>
<li>Paste</li>
<li>Uptime</li>
<li>Contact</li>
</ul>
</nav>
</div>
</header>
<!-- Main Body -->
<div class="container" id="container">
<video autoplay muted loop src="" id="backgroundVid" type="video/mp4" alt="Background_Video" media="min-width: 768px"></video>
<img src="" id="backgroundImg" type="image/jpg" alt="Background_Image">
<!-- Random Background Script -->
<script>
var backgrounds = ['alley0', 'alley1', 'neonsigns0', 'neonsigns1', 'shrine0']
var background = backgrounds[Math.floor(Math.random() * backgrounds.length)];
document.getElementById('backgroundVid').src = 'img/background/' + background + '.mp4';
document.getElementById('backgroundImg').src = 'img/background/' + background + '.jpg';
</script>
<!--<div class="container-inner">
<p>Test Text</p>
</div>-->
</div>
<!-- Footer -->
<footer>
<ul class="social">
<li><i class="fab fa-twitter"></i></li>
<li><i class="fab fa-instagram"></i></li>
<li><i class="fab fa-steam"></i></li>
<li><i class="fab fa-github"></i></li>
<!--<li><i class="fas fa-at"></i></li>-->
</ul>
</footer>
</body>
</html>
Because your #cloudmenu is not a child of #cloud, but a sibling, a sibling combinator is required (+ or ~):
#cloud:hover ~ #cloudmenu {
position: absolute;
display: grid;
}
JSFiddle demo
/*--------STYLE.CSS--------*/
#import url('https://fonts.googleapis.com/css?family=Alegreya+Sans:300,500,700');
* {
margin: 0;
padding: 0;
border: 0;
}
html {
height: 100%;
}
body {
height: 100%;
background: #424949;
color: #f5f5f5;
font-family: 'Alegreya Sans', sans-serif;
margin: 0;
overflow: hidden;
}
h2 {
font-size: 250%;
font-weight: 700;
text-align: center;
padding-top: 2%;
}
p {
font-size: 160%;
font-weight: 500;
line-height: 150%;
padding: 10px;
/*3%*/
text-indent: 20px;
/*2%*/
text-align: justify;
}
img {
height: auto;
width: auto;
}
header {
background-color: #1a1a1a;
width: 100%;
height: 86px;
}
#header-inner {
max-width: 1200px;
margin: 0 auto;
}
#logo {
margin: 0 0 0 20px;
padding: 0 10px 0 10px;
/*top right bottom left*/
float: left;
width: 86px;
height: 86px;
background: url(https://slothy.cloud/img/logohead.svg) no-repeat center;
}
#logo:hover {
transition: all .1s linear;
transform: translateY(-4px);
}
nav {
float: right;
padding: 4px 20px 0 0;
height: 82px;
}
#menu-icon {
display: none;
}
#menu-icon i {
font-size: 240%;
color: #f5f5f5;
padding: 15px 20px 15px 20px;
margin: 0 6px 0 0;
}
#menu-icon i:hover {
color: #616a6b;
}
ul {
list-style-type: none;
}
nav ul li {
font-family: 'Alegreya Sans', sans-serif;
font-size: 150%;
display: inline-block;
float: left;
margin-top: -5px;
}
nav ul li a {
color: #f5f5f5;
text-decoration: none;
padding: 37px 25px 22px 25px;
display: inline-block;
}
a:hover#home,
a#homecurrent {
color: #f5f5f5;
background: #616a6b;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #424949;
}
li:hover#cloud,
a#cloudcurrent {
color: #f5f5f5;
background: #3498db;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #2874a6;
}
a:hover#paste,
a#pastecurrent {
color: #f5f5f5;
background: #2ecc71;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #239b56;
}
a:hover#uptime,
a#uptimecurrent {
color: #f5f5f5;
background: #e74c3c;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #b03a2e;
}
a:hover#contact,
a#contactcurrent {
color: #f5f5f5;
background: #f1c40f;
transition: all .1s linear;
transform: translateY(-6px);
box-shadow: 0 6px 0 #b7950b;
}
#cloudmenu {
display: none;
position: absolute;
background: #1a1a1a;
}
#cloud:hover #cloudmenu {
display: grid;
}
.container {
overflow: hidden;
width: 100%;
height: calc(100% - 86px - 69px);
background-color: #303030;
}
.container img {
height: 100%;
width: 100%;
object-fit: cover;
pointer-events: none;
}
.container video {
height: 100%;
width: 100%;
object-fit: cover;
pointer-events: none;
}
.container-inner {
height: 100%;
max-width: 1100px;
margin: 0 auto;
}
footer {
background: #1a1a1a;
width: 100%;
}
.social {
list-style-type: none;
text-align: center;
}
.social li {
display: inline;
margin: 0px -3px;
}
.social i {
font-size: 260%;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 7%;
padding-right: 7%;
color: #616a6b
}
.social i:hover {
color: #f5f5f5;
transition: all .1s linear;
transform: translateY(-6px);
}
/*--------SMARTPHONE--------*/
#media screen and (max-width: 768px) {
h2 {
font-size: 150%;
}
header {
z-index: +10;
position: absolute;
height: 66px;
}
#logo {
margin: 0 0 0 10px;
height: 66px;
width: 66px;
}
#menu-icon {
display: inline-block;
}
nav {
padding: 0px;
height: 66px;
}
nav ul,
nav:active ul {
display: none;
z-index: -1;
position: absolute;
padding: 26px 20px 10px 20px;
background: #1a1a1a;
right: 0px;
top: 45px;
border-radius: 0 0 0 15px;
width: 40%;
}
nav:hover ul {
display: block;
}
nav li {
text-align: center;
width: 100%;
padding: 10px 0 10px 0;
}
nav ul li a {
color: #f5f5f5;
text-decoration: none;
padding: 15px 46px 15px 46px;
}
.container {
padding-top: 66px;
height: calc(100% - 66px - 56px);
}
.container video {
display: none;
}
.social li {
margin: 0px;
}
.social i {
font-size: 240%;
padding-top: 10px;
padding-bottom: 10px;
}
}
<header>
<!-- Header -->
<div id="header-inner">
<nav>
<i class="fas fa-bars"></i>
<ul>
<li>Home</li>
<li id="cloud"><a href="https://safe.slothy.cloud/" >Cloud</a>
<ul id="cloudmenu">
<li>Frontpage</li>
<li>Dashboard</li>
<li>FAQ</li>
<li>On Github</li>
</ul>
</li>
<li>Paste</li>
<li>Uptime</li>
<li>Contact</li>
</ul>
</nav>
</div>
</header>
Related
I have a navbar at the top of my page with an image logo and some hyperlinks. I want to make it so the image is always the max height it can be while staying within the foot print of the navbar. Here's what I mean:
As you can see, the image in the top left has 10px padding, but the image is slightly too small and has a larger gap at the bottom.
This is my code:
HTML:
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<title>Home | Aeron</title>
<link rel="icon" type="image/x-icon" href="./images/favicon.png">
<link rel="stylesheet" media="screen and (min-width: 1294px)" href="main.css">
<link rel="stylesheet" media="screen and (max-width: 1294px)" href="mobile.css">
<link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="header">
<img src="./images/logo.png" title="Aeron" alt="logo" class="header-logo">
<div class="desktop-nav">
<ul class="desktop-nav-links">
<li>Home</li>
<li>Portfolio</li>
<li>Contact me</li>
<li>About me</li>
<li>Recipes</li>
<li>Progress</li>
<li>PC Setup Designer</li>
<li>Gallery</li>
</ul>
</div>
</body>
</html>
CSS:
html {
box-sizing: border-box;
scroll-behavior: smooth;
font-family: 'Poppins', sans-serif;
height: 100%;
}
body {
margin: 0;
background: linear-gradient(45deg, #280036 0%, #000836 100%);
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
height: 100%;
}
.header-logo {
margin: 10px;
float: left;
height: 72px;
}
.header {
background-color: #000000;
overflow: hidden;
width: 100%;
}
.desktop-nav-links {
float: right;
margin-right: 1.5vw;
}
.desktop-nav-links a {
margin: 1.5vw;
display: block;
color: white;
font-size: 1vw;
}
.desktop-nav-links li {
float: left;
list-style: none;
}
How can I make it so no matter what screen size is, the image is always as big as it can be without influening the navbar height?
Basically by making it position:absolute inside the position:relative header, you can control where it begins top:0 and where it'll end bottom:0.
Update:
We will wrap the image inside a container. That container will take 100% of the height by using absolute position with top and bottom equals 0. It will have a padding of the desired 10px, where as inside of it the image will reside having a height of 100%.
:root {
color-scheme: dark;
}
html {
box-sizing: border-box;
scroll-behavior: smooth;
font-family: 'Poppins', sans-serif;
height: 100%;
}
body {
margin: 0;
background: linear-gradient(45deg, #280036 0%, #000836 100%);
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
height: 100%;
}
.heading {
margin: 20px;
font-size: 2.5vw;
text-align: center;
color: #ffffff;
}
p {
color: #ffffff;
font-size: 20px;
}
a {
text-decoration: none;
}
.slideshow-container {
display: block;
width: 80%;
position: relative;
margin: 10px;
margin-left: auto;
margin-right: auto;
}
.mySlides {
display: none;
}
.prev,
.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
.prev:hover,
.next:hover {
background-color: #a6a6a650;
}
.slide-name {
color: #f2f2f2;
font-size: 15px;
padding: 8px 12px;
position: absolute;
bottom: 8px;
width: 100%;
text-align: center;
}
.slide-number {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
.progress-bar {
width: 100%;
border: none;
border-radius: 100px;
background-color: #FFFFFF;
padding: 3px;
}
.progress-tag {
color: #DDDDDD;
margin-left: 10px;
}
.fill-html {
width: 75%;
background-color: #FA3200;
border-radius: 100px;
}
.fill-css {
width: 60%;
background-color: #0000C8;
border-radius: 100px;
}
.fill-js {
width: 10%;
background-color: #C80000;
border-radius: 100px;
}
.fill-php {
width: 0%;
background-color: #00C832;
border-radius: 100px;
}
.fill-rwpd {
width: 100%;
background-color: #450099;
border-radius: 100px;
}
#return {
display: none;
position: fixed;
bottom: 50px;
right: 50px;
z-index: 99;
border: none;
background-color: #3a3a3a;
cursor: pointer;
border-radius: 100px;
width: 60px;
height: 60px;
}
#return:hover {
background-color: #2a2a2a;
}
.progress-container {
padding: 10px;
}
.headar-logo-container {
position: absolute;
left: 0;
top: 0;
bottom: 0;
padding: 10px;
}
.header-logo {
height: 100%;
}
.header {
background-color: #000000;
overflow: hidden;
width: 100%;
position: relative;
}
.desktop-nav-links {
float: right;
margin-right: 1.5vw;
}
.desktop-nav-links a {
margin: 1.5vw;
display: block;
color: white;
font-size: 1vw;
}
.desktop-nav-links a:hover {
color: #b4b4b4;
transition: 0.2s all ease;
}
.desktop-nav-links li {
float: left;
list-style: none;
}
.menu-button {
display: none;
}
.copyright {
color: #b4b4b4;
font-size: 15px;
}
footer {
background: #000000;
padding: 25px 0;
text-align: center;
bottom: 0;
width: 100%;
height: auto;
display: block;
}
.hyperlink {
display: inline-block;
position: relative;
color: #b4b4b4;
}
.hyperlink:after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0px;
left: 0;
background-color: #b4b4b4;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
.hyperlink:hover:after {
transform: scaleX(1);
transform-origin: bottom left;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
right: 0;
background-color: #111111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 35px;
margin-left: 50px;
}
.recipe-container {
margin: 0px;
display: grid;
grid-template-columns: auto auto auto;
justify-content: center;
}
.recipe-window {
margin: 10px;
padding: 10px;
border: 1px solid #ffffff;
background-color: #ffffff;
word-break: break-word;
width: min-content;
border-radius: 10px;
}
.recipe-title {
color: black;
margin-top: 5px;
padding: 0px;
font-size: 25px;
}
.footer-links {
display: flex;
justify-content: center;
align-items: center;
}
.footer-links p {
margin: 0;
}
.footer-links a {
color: #ffffff;
margin: auto 10px auto 10px;
}
.footer-links a:hover {
color: #b4b4b4;
}
.about {
text-align: center;
padding: 0 300px;
}
.mobile-nav {
display: none;
}
.footer-logo {
width: 160px;
}
.table-container {
display: grid;
grid-template-columns: auto;
justify-content: center;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
background-color: white;
color: black;
border: 2px solid black;
}
td,
th {
border: 1px solid black;
padding: 10px 20px;
}
th {
font-size: 20px;
}
td {
font-size: 15px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
.output {
display: grid;
grid-template-columns: auto;
justify-content: center;
border-radius: 10px;
}
.total1 {
border: none;
}
.pc-border-title {
text-align: center;
}
.intro-heading {
font-size: 25px;
text-align: center;
color: #ffffff;
}
.pcbuilder-link {
color: #cecece;
}
.pcbuilder-link:hover {
color: #adadad;
}
.table-heading {
font-size: 50px;
text-align: center;
color: #000000;
margin-bottom: 10px;
margin-top: 0px;
border: 2px solid #000000;
}
#photo {
padding: 10px;
background-color: #ffffff;
border-radius: 10px;
}
.scrn_button {
font-size: 30px;
background-color: #bfbfbf;
border: 2px solid black;
border-radius: 10px;
color: black;
}
.scrn_button:hover {
cursor: pointer;
background-color: #9b9b9b;
}
.scrn_button:active {
background-color: #797979;
}
.contact-form {
border-radius: 10px;
background-color: #ffffff;
color: #000000;
padding: 10px;
width: auto;
}
.input {
width: 100%;
background-color: #bfbfbf;
border: none;
color: black;
border-radius: 10px 0px 10px 0px;
padding: 5px;
font-size: 18px;
}
.contact-form-container {
margin: 10px 300px;
}
.submit-button-container {
text-align: center;
}
.submit-button {
font-size: 25px;
border-radius: 10px;
border: none;
background-color: #818181;
user-select: none;
}
.submit-button:active {
background-color: #414141;
transition: ease 0.1s;
}
#keyframes fadeInAnimation {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.price::before {
content: "\00a3";
}
#msg {
background-color: #bfbfbf;
border: none;
color: black;
border-radius: 10px 0px 10px 0px;
padding: 5px;
resize: none;
width: 100%;
font-size: 15px;
}
.submit-button:hover::after {
content: ' >';
}
.upload-label {
background-color: #0030b0;
color: white;
padding: 10px;
font-size: 18px;
border-radius: 5px;
cursor: pointer;
border: none;
user-select: none;
}
.upload {
margin: 10px;
text-align: center;
}
#output {
width: 100%;
text-align: center;
padding: 10px;
}
.portfolio-intro {
font-size: 30px;
}
.content {
margin: 10px;
}
.professional:hover:before {
content: 'un-';
font-weight: bolder;
}
.learn-more {
color: #ffd000;
font-size: 20px;
}
.learn-more:hover {
color: #dab200;
transition: all ease 0.3s;
}
.learn-more:active {
color: #bb9900;
transition: all 0s;
}
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<title>Home | Aeron</title>
<link rel="icon" type="image/x-icon" href="./images/favicon.png">
<link rel="stylesheet" media="screen and (min-width: 1294px)" href="main.css">
<link rel="stylesheet" media="screen and (max-width: 1294px)" href="mobile.css">
<link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="header">
<div class="headar-logo-container">
<img src="https://picsum.photos/30/20" title="Aeron" alt="logo" class="header-logo">
</div>
<div class="desktop-nav">
<ul class="desktop-nav-links">
<li>Home</li>
<li>Portfolio</li>
<li>Contact me</li>
<li>About me</li>
<li>Recipes</li>
<li>Progress</li>
<li>PC Setup Designer</li>
<li>Gallery</li>
</ul>
</div>
<div class="mobile-nav">
<span class="menu-button" onclick="openNav()">☰</span>
<div id="mobile-nav-panel" class="mobile-nav-panel">
+
<ul class="mobile-nav-link-list">
<li class="mobile-nav-link">Home</li>
<hr>
<li class="mobile-nav-link">Portfolio</li>
<hr>
<li class="mobile-nav-link">Contact me</li>
<hr>
<li class="mobile-nav-link">About me</li>
<hr>
<li class="mobile-nav-link">Recipes</li>
<hr>
<li class="mobile-nav-link">Progress</li>
<hr>
<li class="mobile-nav-link">PC Setup Designer</li>
<hr>
<li class="mobile-nav-link">Gallery</li>
<hr>
<li class="mobile-nav-link"></li>
</ul>
</div>
</div>
</div>
<h1 class="heading">Welcome to Aeron</h1>
<div class="content">
</div>
<div style="height:100%"></div>
<footer>
<img src="./images/logo.png" title="Aeron" alt="logo" class="footer-logo">
<p class="copyright">Copyright © 2022 Aeron</p>
<div class="footer-links">
About me
<p>|</p>
Policy
<p>|</p>
<a href=contact.html>Contact me</a>
</div>
</footer>
<button onclick="topFunction()" id="return" title="Return To Top"><img src="./images/arrow_upward.svg" width="30px" alt="Return"></button>
<script>
let mybutton = document.getElementById("return");
window.onscroll = function() {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
}
function openNav() {
document.getElementById("mobile-nav-panel").style.width = "100%";
}
function closeNav() {
document.getElementById("mobile-nav-panel").style.width = "0";
}
</script>
</body>
</html>
For some reason I am unable to get the text between the anchor tags on a button to display.
Below is my HTML and CSS code. CSS is a direct copy from here with some modification.
I unable to figure out where I have gone wrong.
body,
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font: bold 14px/1.4 'Open Sans', arial, sans-serif;
background: #EBF0DC;
}
ul {
margin: 150px auto 0;
padding: 0;
list-style: none;
display: table;
width: 600px;
text-align: center;
}
li {
display: table-cell;
position: relative;
padding: 15px 0;
}
a {
color: rgb(7, 5, 5) !important;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.15em;
display: inline-block;
padding: 15px 20px;
position: relative;
}
ul a:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: rgb(233, 108, 25);
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
a:hover:after {
width: 100%;
left: 0;
}
#media screen and (max-height: 300px) {
ul {
margin-top: 40px;
}
}
/* Navigation ends here */
h1 {
color: #ff4411;
font-size: 48px;
font-family: 'Signika', sans-serif;
padding-bottom: 10px;
text-align: center;
}
/* Button */
.container {
padding-top: 1em;
margin-top: 1em;
border-top: solid 1px #CCC;
width: 200px;
margin: 20px auto;
}
a.button {
display: block;
position: relative;
float: left;
width: 120px;
padding: 0;
margin: 30px;
font-weight: 600;
text-align: center;
line-height: 50px;
border-radius: 5px;
transition: all 0.2s;
}
/* FLOAT */
.btnFloat:before {
content: 'Float';
display: block;
position: absolute;
top: 0;
left: 0;
width: 120px;
height: 50px;
border-radius: 5px;
transition: all 0.2s;
}
.btnBlueGreen.btnFloat:before {
background: #00AE68;
}
.btnLightBlue.btnFloat:before {
background: #5DC8CD;
}
.btnOrange.btnFloat:before {
background: #FFAA40;
}
.btnFloat:before {
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.4);
}
.btnFloat:hover:before {
margin-top: -2px;
margin-left: 0px;
transform: scale(1.1, 1.1);
-ms-transform: scale(1.1, 1.1);
-webkit-transform: scale(1.1, 1.1);
box-shadow: 0px 5px 5px -2px rgba(0, 0, 0, 0.25);
}
<!DOCTYPE html>
<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, maximum-scale=1.0">
<meta name="description" content="You can get coached on anything. Always free.">
<title>Careless2Naysayers | Life Coaching by Pradeep Kumar P</title>
<link rel="stylesheet" href="./css/style.css">
</head>
<body>
<header>
<nav>
<ul>
<li>About</li>
<li>Portfolio</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</nav>
</header>
<div>
<h1>CareLess2Naysayers</h1>
</div>
<div class="container">
Students
Teachers
Parents
</div>
</body>
</html>
This is how it is getting displayed. As you can see the word 'Float' is showing up and not the one I have intended.
This issue can be solved with update CSS code that I have add below.
body,
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font: bold 14px/1.4 'Open Sans', arial, sans-serif;
background: #EBF0DC;
}
ul {
margin: 150px auto 0;
padding: 0;
list-style: none;
display: table;
width: 600px;
text-align: center;
}
li {
display: table-cell;
position: relative;
padding: 15px 0;
}
a {
color: rgb(7, 5, 5) !important;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.15em;
display: inline-block;
padding: 15px 20px;
position: relative;
}
ul a:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: rgb(233, 108, 25);
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
a:hover:after {
width: 100%;
left: 0;
}
#media screen and (max-height: 300px) {
ul {
margin-top: 40px;
}
}
/* Navigation ends here */
h1 {
color: #ff4411;
font-size: 48px;
font-family: 'Signika', sans-serif;
padding-bottom: 10px;
text-align: center;
}
/* Button */
.container {
padding-top: 1em;
margin-top: 1em;
border-top: solid 1px #CCC;
width: 200px;
margin: 20px auto;
display: block;
}
a.button {
display: block;
position: relative;
float: left;
width: 120px;
padding: 0;
margin: 30px;
font-weight: 600;
text-align: center;
line-height: 50px;
border-radius: 5px;
transition: all 0.2s;
}
/* FLOAT */
.btnFloat:before {
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
width: 120px;
height: 50px;
border-radius: 5px;
transition: all 0.2s;
z-index: -1;
}
.btnBlueGreen.btnFloat:before {
background: #00AE68;
}
.btnLightBlue.btnFloat:before {
background: #5DC8CD;
}
.btnOrange.btnFloat:before {
background: #FFAA40;
}
.btnFloat:before {
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.4);
}
.btnFloat:hover:before {
margin-top: -2px;
margin-left: 0px;
transform: scale(1.1, 1.1);
-ms-transform: scale(1.1, 1.1);
-webkit-transform: scale(1.1, 1.1);
box-shadow: 0px 5px 5px -2px rgba(0, 0, 0, 0.25);
}
<!DOCTYPE html>
<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, maximum-scale=1.0">
<meta name="description" content="You can get coached on anything. Always free.">
<title>Careless2Naysayers | Life Coaching by Pradeep Kumar P</title>
<link rel="stylesheet" href="./css/style.css">
</head>
<body>
<header>
<nav>
<ul>
<li>About</li>
<li>Portfolio</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</nav>
</header>
<div>
<h1>CareLess2Naysayers</h1>
</div>
<div class="container">
Students
Teachers
Parents
</div>
</body>
</html>
I am trying to create a responsive side menu to slide in and out. I want the hover states of each element to extend the full width of the container but for some reason there is always a gap and I can't get the text to align to the right. I have tried everything I know and researched as best as I could and found nothing. Could someone help me understand what is going wrong?
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,500,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Brushworks NW Inc.</title>
</head>
<body>
<nav class="navbar animated fadeIn">
<span class="open-slide">
<a href="#" onclick="openSlideMenu()">
<svg width="30" height="30">
<path d="M0,5 30,5" stroke="#000" stroke-width="5"/>
<path d="M0,14 30,14" stroke="#000" stroke-width="5"/>
<path d="M0,23 30,23" stroke="#000" stroke-width="5"/>
</svg>
</a>
</span>
<ul class="navbar-links">
<li><a class="active" href="#">HOME</a></li>
<li>ABOUT US</li>
<li>SERVICES</li>
<li>GALLERY</li>
<li>CONTACT US</li>
<li id="number">(360) 679-4444</li>
</ul>
</nav>
<div class="side-hidden">
</div>
<div id="side-menu" class="side-nav">
<ul>
<li>×</li><br>
<li class="nav-item">Home</li>
<li class="nav-item">About</li>
<li class="nav-item">Services</li>
<li class="nav-item">Contact</li>
</ul>
</div>
<script>
function openSlideMenu(){
document.getElementById('side-menu').style.width = '250px';
}
function closeSlideMenu(){
document.getElementById('side-menu').style.width = '0';
}
</script>
</body>
</html>
body, html{
font-family: 'Raleway', sans-serif;
margin: 0;
padding: 0;
width: 100%;
}
.container{
max-width: 980px;
margin-left: auto;
margin-right: auto;
}
/*-- ----------------------------------------------------------------------------------- -->
<!-- NAVIGATION -->
<!-- ----------------------------------------------------------------------------------- --*/
.navbar {
background-color: #FFFFFF;
width: 100%;
height: 100px;
margin: 0;
border-bottom: 8px solid #CE2026;
}
.navbar-links {
max-width: 1090px;
margin-left: auto;
margin-right: auto;
position: relative;
bottom: 15px;
left: 30px;
}
.navbar-links a:hover {
background: #831517;
color: #FFFFFF;
transition: background 0.4s ease 0s;
transition-property: background;
transition-duration: 0.4s;
transition-timing-function: ease;
transition-delay: 0s;
}
.navbar-links a {
display: inline;
color: #444444;
text-decoration: none;
text-align: center;
margin: 0 5px 0 0;
font-size: 15px;
padding: 10px 17px;
right: 25px;
}
nav .active {
background: #CE2026;
color: #FFFFFF;
}
.navbar ul {
margin: 0 auto;
padding: 0;
list-style: none;
text-decoration: none;
width: 100%;
height: 100px;
}
ul li {
list-style: none;
display: inline-block;
margin-top: 50px;
font-size: 1.4em;
}
#number {
float: right;
padding-right: 0;
margin-top: 50px;
margin-right: 85px;
font-size: 21px;
font-weight: normal;
}
.side-hidden {
background-color: #000;
opacity: 0.6;
height: 1000px;
width: 100%;
position: relative;
top: 0;
right: 250px;
margin: 0;
display: none;
}
/* Responsive Menu*/
.open-slide {
float: right;
z-index: 5;
display: none;
}
.side-nav {
width: 0;
height: 100%;
z-index: 1;
position: fixed;
background-color: #111;
opacity: 0.9;
transition: 0.5s;
right: 0px;
text-align: right;
display: block;
transition: 0.3s;
z-index: 6;
}
.side-nav ul {
display: block;
text-decoration: none;
color: #ccc;
z-index: 6;
}
.side-nav ul a {
position: relative;
width: 100%;
padding: 10px 130px 10px 100px;
text-decoration: none;
color: #ccc;
margin-right: 20px;
z-index: 6;
right: 30px;
text-align: right;
}
.side-nav .btn-close {
position: absolute;
top: 0;
left: 22px;
font-size: 36px;
}
.side-nav a:hover {
color: #fff;
background: #CE2026;
}
#media only screen and (max-width: 1000px) {
.navbar-links {
display: none;
}
.open-slide {
display: block;
margin-right: 5%;
margin-top: 3.5%;
}
}
First minimize the screen to toggle the mobile view. When you click the hamburger menu it slides out. But when you hover over the nav links only a portion of the element block highlights red instead of the full width. And the highlight blocks are supposed to be one right on top of the other, but there's gaps between the nav links. I don't know why I can't get it to do what I want and I feel like I've tried everything.
Give your unordered list inside #side-menu a padding of 0px; then remove right: 30px; from the anchors inside .nav-item. I also tweaked with some of your properties to make it work. You can see the working code bellow(See in full page view):
body, html{
font-family: 'Raleway', sans-serif;
margin: 0;
padding: 0;
width: 100%;
}
.container{
max-width: 980px;
margin-left: auto;
margin-right: auto;
}
/*-- ----------------------------------------------------------------------------------- -->
<!-- NAVIGATION -->
<!-- ----------------------------------------------------------------------------------- --*/
.navbar {
background-color: #FFFFFF;
width: 100%;
height: 100px;
margin: 0;
border-bottom: 8px solid #CE2026;
}
.navbar-links {
max-width: 1090px;
margin-left: auto;
margin-right: auto;
position: relative;
bottom: 15px;
left: 30px;
}
.navbar-links a:hover {
background: #831517;
color: #FFFFFF;
transition: background 0.4s ease 0s;
transition-property: background;
transition-duration: 0.4s;
transition-timing-function: ease;
transition-delay: 0s;
}
.navbar-links a {
display: inline;
color: #444444;
text-decoration: none;
text-align: center;
margin: 0 5px 0 0;
font-size: 15px;
padding: 10px 17px;
right: 25px;
}
nav .active {
background: #CE2026;
color: #FFFFFF;
}
.navbar ul {
margin: 0 auto;
padding: 0;
list-style: none;
text-decoration: none;
width: 100%;
height: 100px;
}
ul li {
list-style: none;
display: inline-block;
margin-top: 50px;
font-size: 1.4em;
}
#number {
float: right;
padding-right: 0;
margin-top: 50px;
margin-right: 85px;
font-size: 21px;
font-weight: normal;
}
.side-hidden {
background-color: #000;
opacity: 0.6;
height: 1000px;
width: 100%;
position: relative;
top: 0;
right: 250px;
margin: 0;
display: none;
}
/* Responsive Menu*/
.open-slide {
float: right;
z-index: 5;
display: none;
}
.side-nav {
width: 0;
height: 100%;
z-index: 1;
position: fixed;
background-color: #111;
opacity: 0.9;
transition: 0.5s;
right: 0px;
text-align: right;
display: block;
transition: 0.3s;
z-index: 6;
}
.side-nav ul {
display: block;
text-decoration: none;
color: #ccc;
z-index: 6;
/* Added this */
padding: 0;
}
/* Added this */
.nav-item {
display:block;
}
.side-nav ul a {
position: relative;
width: 100%;
/* Changed this */
/* padding: 10px 130px 10px 100px;*/
padding: 10px 15px;
text-decoration: none;
color: #ccc;
margin-right: 20px;
z-index: 6;
/* Removed this */
/* right: 30px; */
text-align: right;
/* Added these */
display: block;
box-sizing: border-box;
}
.side-nav .btn-close {
position: absolute;
top: 0;
/* Changed this */
/* left: 22px; */
left: 0;
font-size: 36px;
}
.side-nav a:hover {
color: #fff;
background: #CE2026;
}
#media only screen and (max-width: 1000px) {
.navbar-links {
display: none;
}
.open-slide {
display: block;
margin-right: 5%;
margin-top: 3.5%;
}
}
<nav class="navbar animated fadeIn">
<span class="open-slide">
<a href="#" onclick="openSlideMenu()">
<svg width="30" height="30">
<path d="M0,5 30,5" stroke="#000" stroke-width="5"/>
<path d="M0,14 30,14" stroke="#000" stroke-width="5"/>
<path d="M0,23 30,23" stroke="#000" stroke-width="5"/>
</svg>
</a>
</span>
<ul class="navbar-links">
<li><a class="active" href="#">HOME</a></li>
<li>ABOUT US</li>
<li>SERVICES</li>
<li>GALLERY</li>
<li>CONTACT US</li>
<li id="number">(360) 679-4444</li>
</ul>
</nav>
<div class="side-hidden">
</div>
<div id="side-menu" class="side-nav">
<ul>
<li>×</li><br>
<li class="nav-item">Home</li>
<li class="nav-item">About</li>
<li class="nav-item">Services</li>
<li class="nav-item">Contact</li>
</ul>
</div>
<script>
function openSlideMenu(){
document.getElementById('side-menu').style.width = '250px';
}
function closeSlideMenu(){
document.getElementById('side-menu').style.width = '0';
}
</script>
I hope this can help:
1 suggestion instead of changing the width of navbar on click you can use display property (I have implemented this) :
<div id="side-menu" style="width:250px; display:none;" class="side-nav">
.....
<script>
function openSlideMenu(){
document.getElementById('side-menu').style.display = 'block';
}
function closeSlideMenu(){
document.getElementById('side-menu').style.display = 'none';
}
</script>
body, html{
font-family: 'Raleway', sans-serif;
margin: 0;
padding: 0;
width: 100%;
}
.container{
max-width: 980px;
margin-left: auto;
margin-right: auto;
}
/*-- ----------------------------------------------------------------------------------- -->
<!-- NAVIGATION -->
<!-- ----------------------------------------------------------------------------------- --*/
.navbar {
background-color: #FFFFFF;
width: 100%;
height: 100px;
margin: 0;
border-bottom: 8px solid #CE2026;
}
.navbar-links {
max-width: 1090px;
margin-left: auto;
margin-right: auto;
position: relative;
bottom: 15px;
left: 30px;
}
.navbar-links a:hover {
background: #831517;
color: #FFFFFF;
transition: background 0.4s ease 0s;
transition-property: background;
transition-duration: 0.4s;
transition-timing-function: ease;
transition-delay: 0s;
}
.navbar-links a {
display: inline;
color: #444444;
text-decoration: none;
text-align: center;
margin: 0 5px 0 0;
font-size: 15px;
padding: 10px 17px;
right: 25px;
}
nav .active {
background: #CE2026;
color: #FFFFFF;
}
.navbar ul {
margin: 0 auto;
padding: 0;
list-style: none;
text-decoration: none;
width: 100%;
height: 100px;
}
ul li {
list-style: none;
display: inline-block;
margin-top: 30px;
font-size: 1.4em;
}
#number {
float: right;
padding-right: 0;
margin-top: 50px;
margin-right: 85px;
font-size: 21px;
font-weight: normal;
}
.side-hidden {
background-color: #000;
opacity: 0.6;
height: 1000px;
width: 100%;
position: relative;
top: 0;
right: 250px;
margin: 0;
display: none;
}
/* Responsive Menu*/
.open-slide {
float: right;
z-index: 5;
display: none;
}
.side-nav {
width: 0;
height: 100%;
z-index: 1;
position: fixed;
background-color: #111;
opacity: 0.9;
transition: 0.5s;
right: 0px;
text-align: right;
display: block;
transition: 0.3s;
z-index: 6;
}
.side-nav ul {
display: block;
text-decoration: none;
color: #ccc;
z-index: 6;
}
.side-nav ul a {
position: relative;
width: 100%;
padding: 10px 130px 10px 100px;
text-decoration: none;
color: #ccc;
margin-right: 0%;
z-index: 6;
right: 40px;
text-align: right;
}
/* Modified this */
.btn-close {
position: absolute !important;
font-size: 36px;
padding: 0px !important;
padding-right: 0px !important;
width: 100% !important;
right: 0 !important;
margin-top: 0 px;
text-align: middle !important;
z-index: 6;
top: 0px;
}
.side-nav a:hover {
color: #fff;
background: #CE2026;
}
#media only screen and (max-width: 1000px) {
.navbar-links {
display: none;
}
.open-slide {
display: block;
margin-right: 5%;
margin-top: 3.5%;
}
}
<html>
<head>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,500,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Brushworks NW Inc.</title>
</head>
<body>
<body>
<nav class="navbar animated fadeIn">
<span class="open-slide">
<a href="#" onclick="openSlideMenu()">
<svg width="30" height="30">
<path d="M0,5 30,5" stroke="#000" stroke-width="5"/>
<path d="M0,14 30,14" stroke="#000" stroke-width="5"/>
<path d="M0,23 30,23" stroke="#000" stroke-width="5"/>
</svg>
</a>
</span>
<ul class="navbar-links">
<li><a class="active" href="#">HOME</a></li>
<li>ABOUT US</li>
<li>SERVICES</li>
<li>GALLERY</li>
<li>CONTACT US</li>
<li id="number">(360) 679-4444</li>
</ul>
</nav>
<div class="side-hidden">
</div>
<div id="side-menu" style="width:250px; display:none;" class="side-nav">
<ul>
<li> × </li><br>
<li class="nav-item">Home</li>
<li class="nav-item">About</li>
<li class="nav-item">Services</li>
<li class="nav-item">Contact</li>
</ul>
</div>
<script>
function openSlideMenu(){
document.getElementById('side-menu').style.display = 'block';
}
function closeSlideMenu(){
document.getElementById('side-menu').style.display = 'none';
}
</script>
</body>
</body>
</html>
PROBLEM: I am having problems in my bootstrap imports that seems to be affecting my link logo and social icon border. If i remove the link for the bootstrap, the logo and icon borders will work fine. However, I need the bootstrap tag for the gallery. Can someone help me fix this?
this is the code with errors
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" >
This is the source of error (Specifically the code above) :
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sabreen's Seafood Market & Restaurant</title>
<link href="css/jquery.bxslider.css" rel="stylesheet" />
<link href="css/styles.css" rel="stylesheet">
<link href="css/nav.css" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="images/seafood-favicon.png"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" >
</head>
This is my current output with the link for the bootstrap enabled.You could see that the logo and social box is not properly placed.
This is what it looks like when i commented the bootstrap link. You can see that the logo and social border works fine, but the gallery does not.
Is there anyway for me to fix both?
HERE IS THE HTML CODE
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sabreen's Seafood Market & Restaurant</title>
<link href="css/jquery.bxslider.css" rel="stylesheet" />
<link href="css/styles.css" rel="stylesheet">
<link href="css/nav.css" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="images/seafood-favicon.png"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" >
</head>
<body>
<a name="home">
<!--- Start Navigation -->
<script src="js/jquery-1.11.2.min.js"></script>
<script src="js/main.js"></script> <!--- For Navigation -->
<!---ADD NAVIGATION HERE-->
<div class="logo">
<img src="images/seafoodLogo.png">
</div>
<div class="nav-outer">
<div class="nav-wrap">
<nav class="navigation">
<div class='nav' nav-menu-style="yoga">
<ul class="nav-menu">
<li> EXPLORE</li>
<li> MENU</li>
<li> GALLERY</li>
<li> RESERVATION</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="nav-clear"></div>
<!--- End Navigation -->
<div class="clearfix"></div>
<!-- Start of Content -->
<h1> Check out some of our Suggested Paluto!</h1>
<section class="paluto">
<div class="container-fluid">
<div class="container">
<div class="row">
<div class="col-sm-4">
<div class="box-paluto">
<div class="imgBox-paluto">
<img src="images/menu/crabs1.jpg" class="img-responsive">
</div>
<div class="content-paluto">
<h3>Sweet Chili Crab</h3>
<p>Considered as one of our year-round staples, our bright and bold #ChiliCrab packs a lot of flavor and heat! If you prefer to have it mildly spiced, our kitchen team is flexible with all types and tastes and preference.</p>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="box-paluto">
<div class="imgBox-paluto">
<img src="images/menu/crabs2.jpg" class="img-responsive">
</div>
<div class="content-paluto">
<h3>Grilled Crab</h3>
<p>Our take on #GrilledCrab is deliciously simple and oozing with smoky flavor. Plus it's meaty and guaranteed fresh! Contact us on our Facebook fan page for booking and inquiries.</p>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="box-paluto">
<div class="imgBox-paluto">
<img src="images/menu/crabs3.jpg" class="img-responsive">
</div>
<div class="content-paluto">
<h3>Sweet Chili Crab with Black Pepper</h3>
<p>Thankfully, crabs are always at full swing and piled high in our #seafoodrestaurant! Roll up your sleeves and get ready to indulge our #chilicrab that's deliciously drenched with garlic and herbs. We're open 'til 10:30 pm so it's never too late to satisfy your cravings for crustaceans!</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End of Content -->
<div class="clearfix"></div>
<footer>
<center>
</center>
<p> © 2018 SABREEN'S SEAFOOD MARKET & RESTAURANT ALL RIGHTS RESERVED</p>
</footer>
</body>
HERE IS THE CSS CODE FOR MY NAV.CSS AND STYLES.CSS
/*styles.css*/
/*---Body Font--*/
#import url(https://fonts.googleapis.com/css?family=Hindi);
/*---Heading Font--*/
#import url(https://fonts.googleapis.com/css?family=Nobile);
/*---Social Font--*/
#import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css);
/*---Menu Gallery Font--*/
#import url('https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700');
* {
margin: 0;
border: 0;
padding: 0;
}
body {
background-color: #fffdf9;
font-family: 'Times New Roman', Times, serif;
font-size: 18px;
position: relative;
}
h1 {
font-family: 'Times New Roman', Times, serif;
text-align: center;
font-size: 175%;
color: #494949;
text-transform: uppercase;
letter-spacing: 3px;
padding: 3% 0;
}
h2 {
font-family: 'Times New Roman', Times, serif;
text-align: center;
font-size: 150%;
color: #494949;
text-transform: uppercase;
letter-spacing: 3px;
padding: 3% 0;
}
h3 {
font-family: 'Times New Roman', Times, serif;
text-align: center;
color: #494949;
text-transform: uppercase;
letter-spacing: 1%;
}
p {
padding: 2%;
color: #4A4444;
text-align: justify;
font-size: 125%;
}
img {
max-width: 100%;
max-height: auto;
}
#banner-wrapper {
max-width: 1280px;
margin: 0 auto;
}
/*---Start Image Slider Style--*/
.slider {
width: 100%;
}
.slider1 img {
min-width: 100%;
}
.slider .bx-wrapper .bx-controls-direction a {
outline: 0 none;
position: absolute;
text-indent: -9999px;
top: 40%;
height: 71px;
width: 40px;
z-index: -1;
transition: all 0.7s;
}
.slider .bx-wrapper:hover .bx-controls-direction a{
z-index: 5;
}
.slider .bx-wrapper .bx-prev {
background: #000 url("img/left-arrow-white.png") no-repeat 8px 13px;
left: 0;
opacity: 0.3;
}
.slider .bx-wrapper .bx-prev:hover {
opacity: 0.6;
}
.slider .bx-wrapper .bx-next {
background: #000 url("img/right-arrow-white.png") no-repeat 10px 12px;
right: 0px;
opacity: 0.3;
}
.slider .bx-wrapper .bx-next:hover {
opacity: 0.6;
}
/*---End Image Slider Style--*/
.reservation {
margin-top: 25px;
}
.reservation p {
width: 70%;
text-align: center;
}
.one-half {
width: 44%;
float: left;
margin: 2% 0 3% 4%;
text-align: center;
}
.one-third {
width: 28%;
float: left;
margin: 2% 0 3% 4%;
text-align: center;
}
.left-col {
width: 60%;
float: left;
margin: 4% 0 4% 4%;
}
.sidebar {
width: 26%;
float: right;
margin: 4% 4%;
}
.sidebar img {
opacity: 1;
}
.clearfix {
clear: both;
}
/*---Start Parallax Section--*/
.parallax-1 {
background: url("../images/parallaxBG.jpg") fixed 100%;
text-align: center;
max-height: 300px
}
.parallax-inner {
padding-top: 90px;
padding-bottom: 300px;
}
.parallax-2 {
background: url("https://www.w3newbie.com/wp-content/uploads/black-pattern.jpg") repeat fixed 100%;
text-align: center;
}
.parallax-inner h3, .parallax-inner p{
color: #F1F1F1;
}
/*---End Parallax Section--*/
/*Start of Menu Gallery Section*/
section.paluto {
padding: 50px 0 0 ;
}
.box-paluto {
position: relative;
width: 100%;
height: 280px;
overflow: hidden;
background: #000;
box-shadow: 0 5px 15px rgba(0,0,0,.5);
transition: .5s;
}
.box-paluto:hover {
transform: translateY(-30px);
}
.box-paluto .imgBox-paluto {
position: relative;
}
.box-paluto .imgBox-paluto img {
transition: .5s;
width: 100%;
}
.box-paluto:hover .imgBox-paluto img {
opacity: .5;
transform: translateY(-20px);
}
.box-paluto .content-paluto{
position: absolute;
bottom: -30px;
left: 0;
padding: 20px;
box-sizing; border-box;
transition: .5s;
opacity: 0;
}
.box-paluto:hover .content-paluto{
opacity: 1;
bottom: 0;
}
.box-paluto .content-paluto h3{
font-size: 28px;
color: #fff;
font-weight: 700;
}
.box-paluto .content-paluto p{
font-size: 15px;
color: #fff;
font-weight: 400;
}
#media only screen and (max-width: 700px){
.box-paluto{
height: auto;
max-width: 100%;
margin: 6px 0;
}
}
#media only screen and (max-width: 500px){
.box-paluto{
max-height: 300px;
max-width: 300px;
margin: 15px 0;
}
}
/*End of Menu Gallery Section*/
/*Start of Social*/
.fa {
padding: 5px;
margin: 2px;
font-size: 15px;
width: 15px;
height: 15px;
border-radius: 25%;
text-align: center;
justify-content: center;
text-decoration: none;
border: 4px solid #d3d3d3;
transition: all 0.5s;
background: #fff;
}
.fa:hover {
-webkit-animation: expand 0.5s ease-in-out;
-moz-animation: expand 0.5s ease-in-out;
animation: expand 0.5s ease-in-out;
color: #fff;
}
#keyframes expand {
33% { transform: scale(1.1); }
66% { transform: scale(0.9); }
100% { transform: scale(1.0); }
}
#-webkit-keyframes expand {
33% { transform: scale(1.1); }
66% { transform: scale(0.9); }
100% { transform: scale(1.0); }
}
#-moz-keyframes expand {
33% { transform: scale(1.1); }
66% { transform: scale(0.9); }
100% { transform: scale(1.0); }
}
.fa-facebook {
color: #3B5998;
}
.fa-facebook:hover {
background: #3B5998;
}
/*End of Social*/
/*---Start Footer--*/
footer {
background: #fffdf9;
opacity: 0.9;
width: 100%;
/*margin-top: 5%;*/
padding: 1% 0;
overflow: auto;
}
footer p{
color: #fff;
text-align: center;
font-size: 12px;
background-image: linear-gradient(to left, #d0d5de, #001947 40%, #001947 60%, #d0d5de 100%);
padding: 7px 0;
}
iframe {
width: 60%;
height: 400px;
}
/*---Start Media Queries--*/
#media screen and (max-width: 768px) {
.slider .bx-wrapper .bx-controls {
display: none;
}
.parallax-inner {
display: none;
}
.one-third {
width: 100%;
margin: 4% 0;
}
.one-half {
display: none;
}
h1 {
font-size: 125%;
}
.left-col {
width: 100%;
margin: 0 0 3% 0;
}
.sidebar {
width: 100%;
margin: 0;
}
.sidebar img {
max-width: 75%;
height: auto;
}
h3 {
padding-top: 3%;
}
.social-container {
display: block;
}
footer{
margin-top: 15px;
}
.reservation p {
margin-top: 155px;
width: 80%;
}
iframe {
width: 80%;
height: 400px;
}
}
/*nav.css*/
#import url(https://fonts.googleapis.com/css?family=Questrial);
/*--- Nav Font --*/
/*--- Start Navigation Style --*/
.nav-outer {
width: 100%;
height: 67px;
background: #fffdf9;
position: fixed !important;
z-index: 1;
}
.nav-wrap {
max-width: 100%;
margin: 0 auto;
}
nav {
margin-top: 0;
background: #fffdf9;
font-family: 'Times New Roman', Times, serif;
}
.nav ul {
overflow:hidden;
list-style:none;
}
.nav-button:hover {
cursor:pointer;
}
.navigation {
clear: both;
width: 100%;
position: relative;
}
.nav a {
color: #494949;
text-transform: uppercase;
text-decoration:none;
}
body .nav .nav-menu li a {
display:inline-block;
margin-top: 10px;
padding:15px 20px;
color: #494949;
font-size: 19px;
}
.nav.yoga .nav-menu li.active a {
color: #494949;
text-decoration: underline;
}
.nav.yoga .nav-menu li a:hover {
color: #494949;
text-decoration: underline;
}
.nav.yoga .nav-toggled {
min-height:36px;
border-radius:6px;
margin-top: -7px;
}
.nav.yoga .nav-toggled-controls {
display:block;
height:40px;
text-align:left;
position:relative;
}
.nav.yoga .nav-toggled-title {
position:relative;
top:9px;
left:15px;
font-size:16px;
}
.nav.yoga .nav-button {
display:block;
position:absolute;
right:15px;
top:8px;
background: #0a0c42;
}
.nav.yoga .nav-button span {
display:block;
margin-top:4px;
height:2px;
background: #0a0c42;
width:24px;
}
.nav-toggled-controls{
border-bottom: 0px solid #0a0c42;
}
.nav.yoga .nav-toggled ul li a {
display:block;
width:100%;
background-color: #505E67;
text-align:left;
padding:10px 0px 10px 15px;
border-bottom:1px solid #FFF;
text-align: center;
font-size: 16px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.nav.yoga .nav-toggled ul li ul a {
font-size: 15px;
text-transform: none;
}
.nav.yoga .nav-toggled ul li.active a {
background-color: #F5F5F5;
color: #505E67;
}
.nav.yoga .nav-toggled ul li a:hover {
background: #F5F5F5;
color: #505E67;
}
.nav.yoga .nav-toggled ul li {
position: relative;
}
.toggle-sm:after {
position: absolute;
right: 15px;
top: 10px;
font-size: 18px;
line-height: 25px;
}
.toggle-sm:after {
content: '+';
cursor: pointer;
}
.toggle-sm.open:after {
content: '-';
cursor: pointer;
}
.nav .nav-menu {
text-align: center;
overflow: visible;
min-height: 56px;
padding-left: 0;
margin: 0;
}
#media (min-width: 823px) {
.nav {
float: right;
}
.logo {
float: left;
}
}
#media screen and (max-width: 822px) {
body .nav .nav-menu li a {
margin-top: 4px;
}
.logo img {
max-width: 135px !important;
margin-bottom: 3px;
}
.nav-outer {
height: 21px;
}
.nav.yoga .nav-toggled-controls {
top: -40px;
margin-bottom: -36px;
}
.nav-clear {
padding-top: 37px;
margin-bottom: -15px;
}
}
.logo img {
max-height: 100px;
height: auto;
margin-left: 30px;
margin-bottom: 5px;
background-color: #002859;
z-index: 2;
position: absolute;
padding: 70px 10px 50px 10px;
background-image: linear-gradient(#253688, #060729);
}
.navigation:after {
content: "";
display: table;
clear: both;
}
.nav .nav-menu li {
display:inline-block;
padding:0px;
margin:0px !important;
position: relative;
}
.nav-button:hover {
cursor:pointer;
}
.nav .nav-toggled ul {
display:none;
margin:0px ;
padding:0px ;
position: relative;
}
.nav .nav-menu > li > ul {
position: absolute;
z-index: 10000000000;
top: 50px;
text-align: left;
background: #505E67;
width: 100%;
padding-left: 0;
display: none;
}
.nav.yoga .nav-menu > li > ul a {
padding: 11px 15px;
font-size: 18px;
font-weight: normal;
text-transform: none;
}
.nav .nav-menu > li > ul li {
position: relative;
width: 100%;
text-align: center;
}
.nav .nav-menu > li > ul > li ul {
position: absolute;
right: -100%;
top: 0;
width: 100%;
padding-left: 0;
background: #505E67;
}
.nav .nav-menu > li > ul > li ul a {
white-space: nowrap;
}
.nav ul {
overflow: visible;
}
.has-children {
position: relative;
}
.has-children:after {
content: '+';
color: #FFF;
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
cursor: pointer;
}
.has-children:hover:after {
content: '-';
color: #FFF;
cursor: pointer;
}
body .nav .nav-menu li a {
padding: 15px 30px;
}
.clicker {
width: 45px;
height: 45px;
position: absolute;
right: 0;
z-index: 30000;
}
.nav-clear {
clear: both;
padding-top: 67px;
}
/*--- End Navigation Style --*/
/*--------------------MEDIA!!!---------------*/
#media screen and (max-width: 768px) {
#banner-wrapper {
position: relative;
-ms-overflow-x: hidden;
overflow-x: hidden;
}
.nav-menu {
display: none;
}
}
add your bootstrap css at the top
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sabreen's Seafood Market & Restaurant</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
rel="stylesheet" >
<link href="css/jquery.bxslider.css" rel="stylesheet" />
<link href="css/styles.css" rel="stylesheet">
<link href="css/nav.css" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="images/seafood-favicon.png"/>
</head>
As you have not posted the full code here , I can suggest you to do this
List out all the properties that are overlapping when you add the external CSS File.
for suppose i have a <div class="firstDiv" id="firstDivId"></div>
1.Overwrite the properties which are affecting using !important property.
In file1 i have
.firstDiv{
width:33%;
}
which is overridden by bootstrap css
.firstDiv{
width:100%;
}
In file1 you update the property using !important
.firstDiv{
width:33%!important;
}
2.download the css file , attach to your project then update the bootstrap.css file with :not selector
In bootstrap.css property should be like
.firstDiv:not('#firstDivId'){
width:33%;
}
Hope this may help you.
Working on a mobile first approach and have encountered a strange re-alignment issue while expanding from mobile (480) to tablet view (768px).
The final layout is supposed to look like this:
However, I see this:
I understand that this is a CSS display issue, I can get Display: inline-block to work for the text segment to align with the album artwork (I have to reduce the width of the div though), but I cannot get the Display: inline-block to apply to the third div and to get it to align on the right hand side of the text box. Here's the HTML (removed unnecessary code for this question). The three relevant classes are'album-artwork', 'info-bar-container' and 'dig-box' (the lightning bolt). What is the best way to go about fixing this problem?
Thank you for your help!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<link rel="icon" href="assets/img/favicon.ico" />
<title>UNCVRD</title>
<!-- Bootstrap Core CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<!-- Font awesome icons -->
<link href="assets/css/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<!-- Custom Css -->
<link href="assets/css/custom.css" rel="stylesheet">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<!-- Ionicons -->
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet">
<!-- HTML5 shiv and REspond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Music Feed -->
<section id="music-feed">
<div class="song-container">
<div class="album-artwork">
<img class="sc-artwork" src="https://i1.sndcdn.com/artworks-000182929734-focihg-t500x500.jpg">
<div class="album-dark-overlay">
<div class="ranking-triangle"></div>
<i class="icon ion-ios-play"></i>
</div>
</div>
<div class="info-bar-container">
<div class="info-bar">
<div class="info-bar-text">
<div class="artist-name">Echos - Gold</div>
<div class="curator-name">Curated by <a class="curator-link" href="">UNCVRD</a></div>
</div>
</div>
<div class="dig-box">
<i class="icon ion-ios-bolt balanced"></i>
</div>
</div>
</div>
</section>
</section>
<!-- Bootstrap Core Javascript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="assets/js/jquery-3.1.1.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>
CSS stylesheet!
/* Reference Palette
Background: #dedede
Grey font: #b9b9b9
*/
/* ==== General ==== */
html {
font-family: 'Open Sans', sans-serif;
}
body {
font-family: 'Open Sans', sans-serif;
font-size: 16px;
background: #dedede;
font-family: 'Open Sans', sans-serif;
}
h4 {
margin: 0;
padding: 0;
}
/* ==== Navigation Bar ==== */
.navbar {
position: relative;
margin-bottom: 16px;
}
.navbar-toggle {
padding: 0;
border: none;
border-radius: none;
margin: 13px 0 0 16px;
}
.navbar-toggle .icon-bar {
background-color: black;
}
.navbar-brand {
position: absolute;
left: 50%;
margin-left: -53.5px !important;
padding: 0;
display: block;
font-size: 30px;
color: black;
}
.dropdown-menu {
color: black;
}
.navbar .nav > li > a {
color: black;
border-top: 1px solid #dedede;
}
ul.nav.navbar-nav.navbar-right {
margin-bottom: 0;
margin-top: -7.5px;
}
.container-fluid > .navbar-collapse {
margin-top: 3.25px;
}
/* ==== FEED ==== */
#feed {
width: 480px;
margin: auto;
}
/* ==== Playlist Mode ==== */
.playlist-header {
margin-bottom: 16px;
}
.playlist-select {
margin-bottom: 16px;
display: flex;
max-width: 260px;
}
.discovery-mode {
padding-right: 8px;
padding-left: 8px;
min-width: 130px;
font-size: 14px;
height: 30px;
background-color: white;
text-align: center;
vertical-align: middle;
line-height: 30px;
}
.playlist-choice {
flex: 1;
min-width: 130px;
height: 30px;
font-size: 14px;
border: 2px solid #fff;
text-align: center;
vertical-align: middle;
line-height: 26px;
}
/* ==== Music Feed ==== */
#music-feed {
margin-top: 16px;
width: 448px;
}
.song-container {
width: 100%;
height: 220px;
margin-bottom: 16px;
}
.song-container:last-child {
margin-bottom: 82px;
}
.album-artwork {
width: 100%;
height: 155px;
overflow: hidden;
position: relative;
}
.sc-artwork {
position: absolute;
left: -1000%;
right: -1000%;
top: -1000%;
bottom: -1000%;
margin: auto;
min-height: 100%;
min-width: 100%;
}
.info-bar-container {
display: flex;
}
.album-dark-overlay {
/* background-color: rgba(0, 0, 0, 0.25);*/
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
line-height: 77.5px;
color: #dedede;
}
.ranking-triangle {
width: 0;
height: 0;
position: relative;
border-style: solid;
border-width: 38px 38px 0 0;
border-color: #fff transparent transparent transparent;
}
.ranking {
top: 0;
right: 0;
width: 38px;
text-align: left;
}
.info-bar {
width: 90%;
max-width: 484px;
height: 65px;
background-color: white;
display: table;
}
.dig-box {
width: 10%;
background-color: white;
text-align: center;
line-height: 65px;
max-height: 65px;
}
.ion-ios-bolt {
color: #dedede;
font-size: 30px;
}
.ion-ios-bolt:hover {
color: black;
-o-transition: .5s;
-ms-transition: .5s;
-moz-transition: .5s;
-webkit-transition: .5s;
/* ...and now for the proper property */
transition: .5s;
}
.ion-ios-play {
font-size: 80px;
color: white;
opacity: 1;
}
.ion-ios-play:hover {
color: #b9b9b9;
-o-transition: .5s;
-ms-transition: .5s;
-moz-transition: .5s;
-webkit-transition: .5s;
/* ...and now for the proper property */
transition: .5s;
}
.info-bar-text {
display: table-cell;
vertical-align: middle;
white-space: nowrap;
text-overflow: ellipsis;
}
#music-feed .artist-name {
font-size: 16px;
font-weight: 600;
margin-left: 16px;
}
#music-feed .curator-name {
font-size: 14px;
color: #b9b9b9;
margin-left: 16px;
}
.curator-link {
color: black;
}
.curator-link:hover {
color: black;
text-decoration: none;
}
/* ==== Progress Bar ==== */
#progress-bar-container {
position: fixed;
bottom: 60px;
left: 0;
}
#progress-bar-container .container-fluid {
margin: 0;
padding: 0;
height: 6px;
}
.progress-background {
width: 100%;
height: 6px;
background-color: #b9b9b9;
position: fixed;
}
.progress-bar {
width: 40%;
height: 6px;
background-color: #000;
position: fixed;
z-index: 1;
}
/* ==== Bottom Music Bar ==== */
#music-bar {
width: 100%;
height: 60px;
background: white;
position: fixed;
bottom: 0;
left: 0;
}
#music-bar .container-fluid {
padding: 0;
height: 60px;
}
.music-control-container {
font-size: 28px;
height: 60px;
display: inline-flex;
line-height: 60px;
text-align: center;
vertical-align: middle;
}
#music-bar .ion-ios-rewind {
margin-left: 16px;
}
#music-bar .ion-pause {
margin: 0 12px;
}
#music-bar .ion-ios-fastforward {
margin-right: 0px;
}
#music-bar .album-artwork {
float: right;
height: 30px;
width: 30px;
margin: 15px 0 15px 15px;
padding: 0;
position: relative;
}
.music-control-container img {
width: auto;
height: auto;
vertical-align: top;
width: 100%;
height: 100%;
}
#music-bar .song-name {
font-size: 13px;
font-weight: 600;
margin-left: 15px;
}
/* ==== Custom Media Queries ==== */
#media only screen and (min-width: 768px) {
#feed {
width: 768px;
margin: auto;
}
#music-feed {
width: 736px;
}
.song-container {
height: 160px;
}
.album-artwork {
width: 160px;
height: 160px;
margin-right: -4px;
display: inline-block;
}
.info-bar-container {
width: 576px;
display: inline-block;
}
.info-bar {
max-width: 576px;
height: 160px;
}
.dig-box {
width: 10%;
background-color: white;
text-align: center;
line-height: 160px;
max-height: 160px;
}
}
You've set a width on your #music-feed which appears to be too thin to hold all the items, causing them to drop down to the next lines. Also your div.dig-box isn't set to "display: inline-block" so by default wants to occupy a line by itself.
From there onwards you have a bit more work to do but hope this helps.