Google Maps absolute positioning overlapping fixed position Navbar - html

Working on an Angular application for a small business and for the life of me cannot solve while Google Maps keeps overlapping the fixed position navbar on the mobile site. When I scroll down, the map overlaps the navbar which is not what I want. I want it to disappear behind it. I've tried setting the z-index on both elements, but nothing works.
Here is the html for the location.component.html
<div class="md-6-col" >
<div #gmap style="width: 100%;height: 450px;"></div>
</div>
Here is the html for the navbar.component.html
<nav class='navbar'>
<div class='navbar__logo'></div>
<ul class='navbar__list'>
<li class='navbar__item'>
<a class='navbar__link' routerLink='/home' routerLinkActive='navbar__link--active'>
<i class='navbar__icon navbar__icon--home'></i>
<p class='navbar__linktext'>Home</p>
</a>
</li>
<li class='navbar__item'>
<a class='navbar__link' routerLink='/location' routerLinkActive='navbar__link--active'>
<i class="navbar__icon navbar__icon--location"></i>
<p class='navbar__linktext'>Location</p>
</a>
</li>
<li class='navbar__item'>
<a class='navbar__link' routerLink='/contact' routerLinkActive='navbar__link--active'>
<i class="navbar__icon navbar__icon--location"></i>
<p class='navbar__linktext'>Contact</p>
</a>
</li>
</ul>
</nav>
Here is the css for navbar.component.css
.navbar {
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
background-color: #4F4F4F;
}
/*
.navbar__logo {
display: inline-block;
background-image: url('/assets/mobile_logo_150x150.png');
height: 150px;
width: 150px;
}
*/
.navbar__list {
height: 100%;
margin: 0;
padding: 0;
}
.navbar__item {
align-items: center;
display: inline-flex;
height: 100%;
vertical-align: middle;
width: 33%;
}
.navbar__link {
color: #ffffff;
height: 100%;
text-decoration-line: none;
width: 100%;
}
.navbar__link--active {
font-weight: 900;
background-color: #363636;
}
.navbar__icon {
background-position: center;
background-repeat: no-repeat;
background-size: contain;
display:block;
height: 30px;
width: 100%;
}
.navbar__icon--home {
background-image: url('/assets/home-icon.png');
}
.navbar__icon--location {
background-image: url('/assets/location-icon.png');
}
.navbar__linktext {
margin: 0;
}
#media screen and (min-width: 480px) {
.navbar {
text-align: right;
}
}

Where did you apply position: absolute for map?
Make sure you apply position: absolute property to map and position: relative to parent of map to make the z-index working.

Related

Body content in HTML not full screen although set width 100% in CSS? when responsive

In normal (not responsive yet) my website running good, but after I set responsive to (width: 1336px) for my web it's display screen like this although I've set width for this is 100%
/* Here is my CSS *style.css* */
* {
box-sizing: border-box;
}
body {
font-family: 'Montserrat', sans-serif;
margin: 0;
width: 100%;
}
/* style for header section */
h1 {
line-height: 65px;
font-size: 48px;
}
.header-container {
background-image: linear-gradient( 0deg, rgba(35, 39, 49, -0.18), rgba(35, 39, 49, 1.82)), url("images/bg-image.jpeg");
background-repeat: no-repeat;
background-size: cover;
box-sizing: border-box;
position: absolute;
width: 100%;
height: 743px;
left: -1px;
top: 0px;
}
.nav-bar {
position: absolute;
width: 1700px;
height: 135px;
left: 69px;
top: 17px;
filter: brightness(100%);
}
.header-logo {
float: left;
}
.nav-content {
list-style-type: none;
}
.menu-section {
width: 50%;
float: right;
margin-top: 34px;
}
.menu-item {
float: left;
display: block;
margin-right: 70px;
}
/* nav menu */
.nav-content li a {
text-decoration: none;
color: #fff;
font-size: 20px;
}
.nav-content li a:hover {
color: #00B9F7;
}
/* header title */
.header-title {
color: #fff;
text-align: center;
margin: auto;
width: 30%;
padding: 10px;
margin-top: 10%;
}
/* header video */
.header-video {
margin-left: 30%;
width: fit-content;
}
<!-- here is my HTML code *index.html* -->
<header class="header-container">
<div class="header-content">
<div class="nav-bar">
<div class="header-logo">
<a href="#">
<img id="image-logo-header" class="bottom img-logo" src="images/logo.png">
</a>
</div>
<div class="menu-section">
<div class="menu-btn-group">
<div class="menu-toggle"></div>
<div class="menu-close"></div>
</div>
<div class="navigation navbar-collapse ">
<nav role="navigation">
<ul class="nav-content">
<li class="menu-item"><a class="active-item" href="#">Home</a></li>
<li class="menu-item">Blog</li>
<li class="menu-item">About</li>
<li class="menu-item">Contact</li>
<li class="menu-item">Login</li>
<li class="menu-item">Sign up</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="header-title">
<h1>SHARE YOUR HOLIDDAY DREAM</h1>
</div>
<div class="header-video">
<img class="video-img" src="images/video-img.png">
</div>
</div>
</header>
Can anyone help me, please? your answer is my happiness, thank you so much
This is happening because in your code you have set background width to 100% that is working fine but when you are using resposive design the background image not filling the screen.
Because the background image is filling the 100% width of your responsive container but the blank space that you are seeing in right side is because of nav-bar, you have set its width fixed to 1700px.
To resolve this make your nav-bar responsive so that it can also set its width according to container.
You can use
.nav-bar {
position: absolute;
width: 100%;
height: 135px;
left: 69px;
top: 17px;
filter: brightness(100%);
}
width: 100% make your nav-bar responsive too.
Can you try using img: { width: 100vw };?
In css, verify the margins and padding.

Move element to the bottom of the div

I need the images and links that are in the footer to be at the bottom of the footer, and the footer needs to still be at the bottom of the page.
I have tried using position: absolute and bottom properties and played with the margin properties but nothing I do seems to work any help would be much appreciated here.
body {
padding: 0;
margin: 0;
}
.headerBackgroundImage {
/* The image used */
background-image: url("../Images/headerImage.jpg");
min-height: 318px;
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
position: relative;
}
/* Code that applies only to the logo to position it and make sure it is infront of the background */
#logo {
position: relative;
display: block;
margin-left: 850px;
width: 15%;
top: 20px;
}
/* Position the navigation bar container inside the image */
.container1 {
position: absolute;
bottom: 0px;
}
/* Another container for the second part of the navigation bar */
.container2 {
position: absolute;
bottom: 0px;
right: 0;
}
/* The navigation bar */
.topnav {
overflow: hidden;
}
/* The links/words in the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: underline;
font-size: 50px;
font-weight: bold;
}
/* What happens to the links/words in the navigation bar once it is hovered over */
.topnav a:hover {
text-decoration: none;
}
.ImageColumn {
float: right;
width: 780px;
}
#ImageColumnImages {
width: 100%;
height: 40%;
padding-bottom: 10px;
}
footer {
left: 0;
bottom: 0;
height: 318px;
width: 100%;
overflow: hidden;
position: static;
}
.footerBackgroundImage {
/* The image used */
background-image: url("../Images/FooterImage.png");
min-height: 318px;
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
position: relative;
}
#footerImages {
height: 100px;
width: 100px;
padding-bottom: 10px;
position: sticky;
bottom: 0;
}
.footerLinks a {
color: #f2f2f2;
font-size: 20px;
padding-right: 10px;
text-decoration: underline;
font-weight: bold;
}
.footerLinks a:hover {
text-decoration: none;
}
.test {
bottom: 0px;
}
<body>
<div class="headerBackgroundImage">
<img src="../Images/logo.png" id="logo">
<div class="container1">
<div class="topnav">
Attractions
Restaurants
</div>
</div>
<div class="container2">
<div class="topnav">
Hotels
Transport
</div>
</div>
</div>
<div class="ImageColumn">
<img src="../Images/indexImage1.png" id="ImageColumnImages">
<img src="../Images/indexImage2.png" id="ImageColumnImages">
<img src="../Images/indexImage3.png" id="ImageColumnImages">
<img src="../Images/indexImage4.png" id="ImageColumnImages">
</div>
<footer>
<div class="test">
<div class="footerBackgroundImage">
<img src="../Images/facebook.png" id="footerImages">
<img src="../Images/instagram.png" id="footerImages">
<img src="../Images/twitter.png" id="footerImages">
<div class="footerLinks">
Contact Us
Refrences
</div>
</div>
</div>
</footer>
</body>
Using display: flex on the footer makes this work. By aligning the content with flex-end it positions itself on the bottom of the page.
Learning grids and flex boxes really makes life easier.
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
footer {
/*Added display flex and align-items*/
display: flex;
align-items: flex-end;
height: 318px;
width: 100%;
overflow: hidden;
position: static;
}
.test {
/*Set the div test to 100%*/
width: 100%;
}
.footerBackgroundImage {
...
/*added background color for testing purposes */
background-color: #e3e3e3;
}
body {
padding: 0;
margin: 0;
}
.headerBackgroundImage {
/* The image used */
background-image: url("../Images/headerImage.jpg");
min-height: 318px;
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
position: relative;
}
/* Code that applies only to the logo to position it and make sure it is infront of the background */
#logo {
position: relative;
display: block;
margin-left: 850px;
width: 15%;
top: 20px;
}
/* Position the navigation bar container inside the image */
.container1 {
position: absolute;
bottom: 0px;
}
/* Another container for the second part of the navigation bar */
.container2 {
position: absolute;
bottom: 0px;
right: 0;
}
/* The navigation bar */
.topnav {
overflow: hidden;
}
/* The links/words in the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: underline;
font-size: 50px;
font-weight: bold;
}
/* What happens to the links/words in the navigation bar once it is hovered over */
.topnav a:hover {
text-decoration: none;
}
.ImageColumn {
float: right;
width: 780px;
}
#ImageColumnImages {
width: 100%;
height: 40%;
padding-bottom: 10px;
}
footer {
display: flex;
height: 318px;
width: 100%;
overflow: hidden;
position: static;
align-items: flex-end;
}
.test {
width: 100%;
}
.footerBackgroundImage {
/* The image used */
background-image: url("../Images/FooterImage.png");
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
background-color: #e3e3e3;
width: 100%;
}
.footerImages {
height: 100px;
width: 100px;
padding-bottom: 10px;
}
.footerLinks a {
color: #f2f2f2;
font-size: 20px;
padding-right: 10px;
text-decoration: underline;
font-weight: bold;
}
.footerLinks a:hover {
text-decoration: none;
}
.test {
bottom: 0px;
}
<body>
<div class="headerBackgroundImage">
<img src="../Images/logo.png" id="logo">
<div class="container1">
<div class="topnav">
Attractions
Restaurants
</div>
</div>
<div class="container2">
<div class="topnav">
Hotels
Transport
</div>
</div>
</div>
<div class="ImageColumn">
<img src="../Images/indexImage1.png" id="ImageColumnImages">
<img src="../Images/indexImage2.png" id="ImageColumnImages">
<img src="../Images/indexImage3.png" id="ImageColumnImages">
<img src="../Images/indexImage4.png" id="ImageColumnImages">
</div>
<footer>
<div class="test">
<div class="footerBackgroundImage">
<img src="../Images/facebook.png" class="footerImages">
<img src="../Images/instagram.png" class="footerImages">
<img src="../Images/twitter.png" class="footerImages">
<div class="footerLinks">
Contact Us
Refrences
</div>
</div>
</div>
</footer>
</body>
Set the footer to have margin: 100%;. That should put it to the bottom.

Fixed div top of web page broken result

I have a fixed header with a full screen background image under that my sections. what i am trying to do is if i have a alert it will echo above the whole page pushing down the header and hero. but it either wont show up or when i do get it to show it wont stay fixed and scrolls with the page.
.sitrep {
top 0;
height: 50px;
width: 100%;
position: fixed;
z-index: 10000;
}
.siteHeader {
min-height: 76px;
height: 76px;
overflow: visible;
background-color: #000;
color: #f4f4f4;
position: fixed;
top: 0;
z-index: 10000;
}
#hero {
height: 100vh;
}
.hero {
background: url(images/hero-bg.jpg) no-repeat top center;
background-color: #000;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}
#hero-content {
position: absolute;
width: 100%;
bottom: 0%;
}
#hero-content a {
background-color: #131313;
padding-top: 10px;
height: 40px;
display: block;
font-size: 12px;
text-align: center;
text-transform: uppercase;
text-decoration: none;
}
#hero-content img {
display: block;
margin-top: 2px;
max-height: 145px;
margin-right: auto;
margin-left: auto;
margin-bottom: 53px;
padding: 5px;
}
<div class="sitrep">
<div class="alert-status">
<div class="info">
<span class="closebtn" onclick="this.parentElement.style.display='none';">×</span>
<strong>Announcement!</strong> anouncment goes here.
</div>
</div>
</div>
<div id="siteHeader">my header</div>
<!-- Hero Unit -->
<div id="hero" class="hero">
<div id="hero-content">
<img src="content/images/logo-dt.png" class="img-responsive">
<a class="button" role="button" href="#base">Learn more</a>
</div>
</div>
You are mixing up classes and ID's.
In your HTML, you give the element the ID of sitrep, whereas you are giving the styles to the elements with the class of siterep.
Try either of the following options and you'll be set :
Changing the element attribute: <div id="sitrep"> to <div class="sitrep">
Changing the CSS to fit the proper elements: .sitrep { to #sitrep {
Happy coding !

How to center button on HTML?

I am new to this so please excuse me.
I am working on my first website coding and, I am having so much difficulties with centering my button. I want to place the button on the middle of the window.
I will attach the code below:
/* Hide Scroll */
html, body {
overflow:hidden;
}
/* Home Page - Background Image */
body {
background: url(Image-2.jpg);
background-repeat: no-repeat;
background-size: cover;
position: relative;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
}
/* Mains */
#Mains-Logo {
margin-top: 42px;
margin-left: 80px;
}
#Mains-Basket {
float: right;
margin-top: 48px;
margin-right: 96px;
}
#Mains-SP {
text-align: center;
margin-top: 785px;
margin-left:810px;
}
/* Button */
.Button-SN {
text-align: center;
min-height: 100%;
min-width: auto;
}
.SN {
border: 5px solid #fcfcfc;
padding: 8px 25px;
margin: auto;
}
<body>
<img id="Mains-Logo" src="Logo.png">
<img id="Mains-Basket" src="Basket.png">
<!-- THIS RIGHT HERE -->
<div class="Button-SN">
<a class="SN" href="#">SHOP NOW</a>
</div>
<!-- END -->
</body>
<footer>
<img id="Mains-SP" src="SP.png">
</footer>
This question has already been answered in stack overflow, here are some useful links to solve your problem.
align text in middle/center of page and button on bottom/center
How to center a button within a div?
trying to align html button at the center of the my page
How to center html element in browser window?
Remove the wrapper .Button-SN.
Add:
.SN{
position:absolute;
display: inline-block;
top:50%;
left:50%;
width:150px;
border: 5px solid #fcfcfc;
line-height: 40px;
margin-top:-20px;
margin-left:-75px;
}
Use clear:both to clear floated direction.
.Button-SN {
clear: both;
min-height: 100%;
min-width: auto;
text-align: center;
}
Try adding this to your button CSS:
display: flex;
justify-content: center; /*centers items on the line (the x-axis by default)*/
align-items: center; /*centers items on the cross-axis (y by default)*/
position:absolute;
Let me know how you get on!
Thanks
Method #01:
Wrap both images in a div and set layout of parent with overflow: hidden.
/* Hide Scroll */
html, body {
overflow:hidden;
}
/* Home Page - Background Image */
body {
background: url(Image-2.jpg);
background-repeat: no-repeat;
background-size: cover;
position: relative;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
}
/* Mains */
.image-holder {
overflow: hidden;
}
#Mains-Logo {
margin-top: 42px;
margin-left: 80px;
}
#Mains-Basket {
float: right;
margin-top: 48px;
margin-right: 96px;
}
#Mains-SP {
text-align: center;
margin-top: 785px;
margin-left:810px;
}
/* Button */
.Button-SN {
text-align: center;
min-height: 100%;
min-width: auto;
}
.SN {
border: 5px solid #fcfcfc;
display: inline-block;
vertical-align: top;
padding: 8px 25px;
margin: auto;
}
<body>
<div class="image-holder">
<img id="Mains-Logo" src="Logo.png">
<img id="Mains-Basket" src="Basket.png">
</div>
<!-- THIS RIGHT HERE -->
<div class="Button-SN">
<a class="SN" href="#">SHOP NOW</a>
</div>
<!-- END -->
</body>
<footer>
<img id="Mains-SP" src="SP.png">
</footer>
Method #02:
Add clear: both to the styles of .Button-SN.
/* Hide Scroll */
html, body {
overflow:hidden;
}
/* Home Page - Background Image */
body {
background: url(Image-2.jpg);
background-repeat: no-repeat;
background-size: cover;
position: relative;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
}
/* Mains */
#Mains-Logo {
margin-top: 42px;
margin-left: 80px;
}
#Mains-Basket {
float: right;
margin-top: 48px;
margin-right: 96px;
}
#Mains-SP {
text-align: center;
margin-top: 785px;
margin-left:810px;
}
/* Button */
.Button-SN {
text-align: center;
min-height: 100%;
min-width: auto;
clear: both;
}
.SN {
border: 5px solid #fcfcfc;
display: inline-block;
vertical-align: top;
padding: 8px 25px;
margin: auto;
}
<body>
<img id="Mains-Logo" src="Logo.png">
<img id="Mains-Basket" src="Basket.png">
<!-- THIS RIGHT HERE -->
<div class="Button-SN">
<a class="SN" href="#">SHOP NOW</a>
</div>
<!-- END -->
</body>
<footer>
<img id="Mains-SP" src="SP.png">
</footer>
Try
.Button-SN {
text-align: center;
margin: 0 auto;
}
You can try this:
vertical-align:middle;

Making social network icons horizontal

I'm having difficult making my social icons horizontal. I thought floating them left would do the trick or making the element an inline-block. I'm stuck so any help is appreciated. Thank you!
<!-- Social network icons -->
<div id="social">
<ul class="soclist">
<li><a class="youtube" href="img/youtube-logo.png" target="_blank" title="youtube"></a></li>
<li><a class="twitter" href="img/twitter-logo.png" target="_blank" title="twitter"></a></li>
</ul>
</div>
CSS:
/* Social Sidebar */
ul.soclist li {
display: inline-block
}
#social {
position: fixed;
top: 2px;
right: 73px;
width: 43px;
display: block;
}
a.youtube {
width: 48px;
height: 48px;
background: url(../img/youtube-logo.png) no-repeat;
display: block;
}
a.twitter {
width: 48px;
height: 48px;
background: url(../img/twitter-logo.png) no-repeat;
display: block;
}
Remove the "width: 43px;" from #social.
Try to remove the display:block from a:
a.youtube {
width: 48px;
height: 48px;
background: url(../img/youtube-logo.png) no-repeat;
/*display:block;*/
}
a.twitter {
width: 48px;
height: 48px;
background: url(../img/twitter-logo.png) no-repeat;
/*display:block;*/
}
here is an example inlining your links (without images )