how to add footer after background-img? - html

I tried to add the footer, but it adds on top of the background-image at the bottom of my page. I tried to remove the "display:fixed" from footer, but the horizontal scroll shows up. How can I fix this?
I want the footer to be always visible on the screen when you scroll the page.
Here is more detail code snipet, I would appreciate if you guys can help with this.
html,
body {
height: 100%;
font-family: 'Google Sans',Roboto,Arial,sans-serif;
font-size: 16px;
margin: 0;
padding: 0;
body {
background-image: url("/img/bg-new-edit.jpg");
background-position: center center;
background-repeat: no-repeat;
width: 100vw;
height: 100vh;
background-size: cover;
position: relative;
}
/* Basic styling */
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
h2 {
font-weight: 350;
margin: 580px 40px;
}
footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
color: gray;
text-align: center;
background-color: white;
}
}
<body>
<nav>
<ul class="menu">
<li class="logo"><img class="logo" src="img/TARRAHJEWELRY-LOGO.png"></li>
<li class="item">Home</li>
<li class="item">About</li>
<li class="item has-submenu dropdown">
<a tabindex="0">Bridal Jewelry</a>
<ul class="submenu dropdown-content">
<li class="subitem">Engagement</li>
<li class="subitem">Men Wedding</li>
<li class="subitem">Women Wedding</li>
</ul>
</li>
<li class="item has-submenu dropdown">
<a tabindex="0">Collection</a>
<ul class="submenu dropdown-content">
<li class="subitem">Ring</li>
<li class="subitem">Necklace</li>
<li class="subitem">Earring</li>
<li class="subitem">Bracelet</li>
</ul>
</li>
<li class="item">Contact
</li>
<li class="item button">My Account</li>
<li class="item button">Cart</li>
<li class="toggle"><i class="fas fa-bars"></i></li>
</ul>
</nav>
<h2>We believe people who live life in their special way,<br> deserve unique jewelry.</h2>
<footer><p>Footer</p></footer>
<div class="clearfix"></div>
</body>

select the footer
footer {
bottom: 0;
position: fixed
}
note that this will cause a scroll bar to appear
to remove the scroll bar
body {
overflow: hidden
}
That should solve your problem

Related

is there answer to (") these inverted commas in my navbar section without being given by me in html and css?

when i realized through Firefox inspector showing overflow in body element," is present in the page.I removed it(from inspector) but problem remains after refreshing the page.I tried using min-max h,w,still no changes.I am not able to catch the keyword i need solution.
code:
#navbar {
display: flex;
align-items: center;
position: relative;
top:0px;
margin-top: -18px;
}
#navbar::before {
content: "";
background-color: black;
height: 100%;
width: 100%;
position: absolute;
top:0px;
left:0px;
z-index: -1;
opacity: 1;
}
/* Nav Bar:Logo And Image */
#logo {
margin: 11px 30px;
}
<nav id="navbar">
<div class="logo">
<img src="logo1.png" alt="w8.com" id="img1">
</div>
<ul>
<li class="item">Home</li>
<li class="item">Top Searches</li>
<li class="item">About Us</li>
<li class="item">Places</li>
</ul>
</nav>
This is the portion where it is showing inverted commas in the top left corner.
**>**And this is the code from the inspector:
<body>"
<!-- <style>
#img1{
height: 66px;
margin: 8px 12px;
border-radius: 36px;
}
</style> -->
<nav id="navbar">
<div class="logo">
<img src="logo1.png" alt="w8.com" id="img1">
</div>
<ul>
<li class="item">Home</li>
<li class="item">Top Searches</li>
<li class="item">About Us</li>
<li class="item">Places</li>
</ul>
</nav>
i tried removing and rewriting the code but it didn't help.And about overflow i am not able do fix overflow.

How do I move the grouped buttons to the center of the navbar?

I'm trying to make the links appear in the center and when I resize the page to show on mobile I want them to be placed next to each other.
Now there's 3 big blocks on top of each other on mobile. These have to be next to each other and smaller.
.navbar {
overflow: hidden;
background-color: #333;
position: fixed;
bottom: 0;
width: 100%;
}
.container {
overflow: hidden;
background-color: #333;
position: fixed;
bottom: 0;
width: 100%;
}
.navbar a {
display: block;
color: #f2f2f2;
text-align: center;
padding: 32px 32px;
text-decoration: none;
font-size: 17px;
}
.navbar a:hover {
background: #f1f1f1;
color: black;
}
.navbar a.active {
background-color: #4CAF50;
color: white;
}
.main {
padding: 16px;
margin-bottom: 30px;
}
<div class="navbar">
<div class="row">
<li class="nav-link">
QR-Scanner
</li>
<li class="nav-link">
QR-Scanner
</li>
<li class="nav-link">
QR-Scanner
</li>
</div>
</div>
In the code I provided you can see the code of the html page and de CSS. The images contain the view of the mobile version and how it looks on a normal browser on my laptop.
<div class="navbar">
<ul class="row">
<li class="nav-link col-md-4"> QR-Scanner </li>
<li class="nav-link col-md-4"> QR-Scanner </li>
<li class="nav-link col-md-4"> QR-Scanner </li>
</u>
</div>
First of all, your code is incorrect.
There is no nav and ul tag, and your class navbar is in the wrong place.
Your list should be:
<nav class="navbar">
<ul class="navbar-nav">
<li class="nav-link">
QR-Scanner
</li>
<li class="nav-link">
QR-Scanner
</li>
<li class="nav-link">
QR-Scanner
</li>
</ul>
</nav>
Next, you need to change styles in your responsive CSS.
.navbar-nav{
text-align: center;
}
.nav-link{
display: inline-block;
}
Here is the reference:
https://getbootstrap.com/docs/4.3/components/navbar/
Cheers.

Text overflowing off of screen

I am trying to make a navbar but my text is flowing off of the screen even though I have overflow: hidden on my ul
Here is my snippet
.header {
background-image: url('img/bg.jpg');
background-size: 100%;
background-repeat: no-repeat;
color: white;
width: 100vw;
height: 100vh;
}
.heading {
display: inline-block;
font-size: 3em;
}
.nav-items {
overflow: hidden;
}
<div class="header">
<div class="nav">
<!-- <img src="img/logo.png" alt="logo" class="logo"> -->
<ul class="nav-items">
<li class="nav-item">Home</li>
<li class="nav-item">About</li>
<li class="nav-item">Portfolio</li>
<li class="nav-item">Contact</li>
</ul>
</div>
<h1 class="heading" id="heading"></h1>
</div>

Make parent container the height of a hovered child container

I have searched for the answer to this but out of the questions/answers I found none of them worked in my case.
What I have is a "Mega Menu" with links down the left side, when one of the links are hovered with the mouse it expands to the right showing hidden links with images. What I would like to do is have the left side "hoverable" link area expand to be the same size as the right side area that contains the images.
Currently the left side is a fixed height and when I attempted to apply clear: both overflow: hidden as the other answers on questions suggested it broke the layout. I am hoping there is a pure CSS way of doing what I need. I could write it in JS but would prefer not to if its not needed. I have included a codepen that shows what I have currently.
https://codepen.io/anon/pen/wGZjpp?editors=1100
<div class="megaMenuWrapper">
<div class="megaMenuContainer" style="display: block;">
<ul id="menu-main-menu" class="menu">
<div class="background"><span class="megamenu-title">SHOP BY CATEGORY</span>
<li class="category-item" id="menu-item-3">Showers
<ul class="sub-menu right-side">
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-4">
<img src="http://placekitten.com/180/180">Shower Stalls
</li>
<li id="menu-item-8">
<img src="http://placekitten.com/180/180">Shower Bases
</li>
</ul>
</li>
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-5">
<img src="http://placekitten.com/180/180">Shower Walls
</li>
</ul>
</li>
</ul>
</li>
<li class="category-item" id="menu-item-9">Toilets
<ul class="sub-menu right-side">
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-10">
<img src="http://placekitten.com/180/180">Bidets
</li>
<li id="menu-item-11">
<img src="http://placekitten.com/180/180">Portable Toilets
</li>
</ul>
</li>
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-17">
<img src="http://placekitten.com/180/180">Bed Pans
</li>
</ul>
</li>
</ul>
</li>
<li class="category-item" id="menu-item-16">Bathtubs
<ul class="sub-menu right-side">
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-18">
<img src="http://placekitten.com/180/180">Clawfoot
</li>
</ul>
</li>
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-19">
<img src="http://placekitten.com/180/180">Copper
</li>
</ul>
</li>
</ul>
</li>
<li class="category-item" id="menu-item-20">Sinks
<ul class="sub-menu right-side">
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-21">
<img src="http://placekitten.com/180/180">Modern
</li>
</ul>
</li>
</ul>
</li>
<li class="category-item" id="menu-item-25">Bathroom Accessories
<ul class="sub-menu right-side">
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-22">
<img src="http://placekitten.com/180/180">Bathtub Faucets
</li>
<li id="menu-item-27">
<img src="http://placekitten.com/180/180">Shower Curtains
</li>
</ul>
</li>
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-23">
<img src="http://placekitten.com/180/180">Toilet Brushes
</li>
<li id="menu-item-28">
<img src="http://placekitten.com/180/180">Vanities
</li>
</ul>
</li>
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-24">
<img src="http://placekitten.com/180/180">Toilet Seats
</li>
</ul>
</li>
<li class="menu-item">
<ul class="sub-menu">
<li id="menu-item-26">
<img src="http://placekitten.com/180/180">Mirrors
</li>
</ul>
</li>
</ul>
</li>
</div>
</ul>
</div>
</div>
CSS:
body{
background: #ddd;
}
ul#mainnav>li>a:not(.last) {
border-right: 1px solid #fff;
}
ul#mainnav>li>a {
padding: 5px 15px;
margin-top: 20px;
}
.megaMenuWrapper {
position: relative;
margin-top:30px;
}
.megaMenuContainer {
position: absolute;
width: 100%;
/* display: none; */
z-index: 2;
/* height: auto; */
}
ul#menu-main-menu {
width: 100%;
height: 100%;
position: relative;
margin:0;
list-style: none;
}
ul#menu-main-menu .background > li:first-of-type {
margin-top: 5px;
}
.background {
width: 20%;
height: 100%;
background: rgb(255, 255, 255);
border-right: 2px solid #000;
}
.column.menu-item {
padding: 1%;
width: 23%;
}
ul.sub-menu {
list-style: none;
margin: 0;
}
.right-side {
position: absolute;
top: 0;
left: 20%;
height: auto;
right: 0;
width: 80%;
display: none;
}
.right-side li.menu-item {
float: left;
width: 23%;
padding: 1%;
height: 100%;
}
.megamenu-title {
color: #545454;
margin-top: 20px;
display: inline-block;
width: 100%;
margin-left: 20px;
font-weight: bold;
}
li.category-item a{
padding: 5px 0px 5px 20px;
display: block;
}
li.category-item a:hover {
background-color: white;
color: #3C3C3C !important;
text-decoration: none;
}
li.category-item a:hover + ul,
.right-side:hover
{
display: block;
background: rgb(255, 255, 255);
border-left: 1px solid #000;
}
ul#menu-main-menu li.menu-item ul.sub-menu li a {
color: #3c3c3c;
padding: 0;
text-align: center;
}
ul#menu-main-menu li.menu-item ul.sub-menu li a:hover {
background: none;
}
ul#menu-main-menu li.menu-item ul.sub-menu li img {
display: block;
margin: 0 auto;
}
ul#menu-main-menu li a {
color: #4C4C4C;
}
UPDATE:
This is ultimately the jQuery that I have ended up going with. Unless someone answers with a pure CSS solution.
$('.category-item').hover(
function() {
var height = $(this).children('.right-side').outerHeight();
$('.megaMenuContainer').height(height);
},
function() {
$('.megaMenuContainer').css('height', '');
}
);
the idea is the following :
.megaMenuContainer {
height:auto;
}
.category-item {
height:2em;
}
.category-item:hover {
height:3em;
}
in fact if you put the height of the parent equal to auto the height of the child element will follow it.
This is not possible with pure CSS like I wanted with the current structure so I decided to go with the jQuery solution below.
$('.category-item').hover(
function() {
var height = $(this).children('.right-side').outerHeight();
$('.megaMenuContainer').height(height);
},
function() {
$('.megaMenuContainer').css('height', '');
}
);

How to center ul

I'm trying to get a ul horizontally centered within the space but no matter what I try it remains left aligned.
<nav>
<div id="home">
<ul id="topnav">
<li class="home">home</li>
<li class="products">products</li>
<li class="support">support</li>
<li class="wtb">where to buy</li>
<li class="webstore">web store</li>
<li class="contact">contact us</li>
<li class="facebook"><a href="#" target="_blank"
title="Hauppauge Computer Works">facebook</a></li>
</ul>
</div>
</nav>
CSS:
CSS file here
ul#topnav {
padding: 0px;
list-style: none;
margin-right: auto;
margin-left: auto;
margin-top: 0px;
margin-bottom: 0px;
position: relative;
left: auto;
width: 123px;
}