How not to make them collide in nav bar? - html

enter image description here
body{
margin: 0;
height: 100%;
// background-color:black;
background-image: url("3.jpg");
background-repeat: no-repeat;
background-size: cover;
// background-position: center;
background-attachment: fixed;
cursor: url("cursor.png"), auto;
}
.header {
margin: 0;
padding: 0;
}
ul {
list-style: none;
margin: 0;
padding: 0;
text-align:center;
width: 100%;
position: absolute;
background: transparent;
background: linear-gradient(rgba(195,162,94,.4), rgba(0,0,0,0.3));
overflow: hidden;
z-index: 1;
}
li {
display: inline-block;
// margin-left: 100px;
}
.logo img{
width: 135px;
height: auto;
position: absolute;
margin-top: 0px;
margin-left: 40px;
z-index: 2;
cursor: url("cursor.png"), auto;
}
li a{
width: 100px;
display: block;
// padding-left: 500px;
padding: 35px 15px;
font-size: 20px;
font-family: Sylfaen;
color: white;
text-align: center;
text-decoration: none;
cursor: url("cursor.png"), auto;
}
li a:hover{
color: rgba(96,49,18);
}
<div class="header">
<div class="logo">
<a href="#">
<img src="logo.gif">
</a>
</div>
<div class="navs">
<ul>
<li>Home</li>
<li>Game Info</li>
<li>Gameplay</li>
<li>Media</li>
</ul>
</div>
</div>
How not to make them collide in nav bar?
they collide when i zoom in..
I cant seem to understand how it works
and I cant seem to know what to do..
How not to make them collide when zooming in like there is a wall in there..
How not to make them collide in nav bar?
they collide when i zoom in..
I cant seem to understand how it works
and I cant seem to know what to do..
How not to make them collide when zooming in like there is a wall in there..

Add Padding to Your UL
Adding padding-left: 135px; to your ul which is the same width as your logo width. This will prevent the nav area content occupying the same space.
You could add a little more padding so that it does touch fully!
Make it Responsive
Ideally, you would want to make it responsive, so that when it reaches a certain width, the logo goes above the nav or whatever you feel looks best.
#media only screen and (max-width: 600px) {
.logo {
/*Your styles on small screen - example only*/
display:block
position:releative;
}
}
See Responsive Web Design - Media Queries
body{
margin: 0;
height: 100%;
// background-color:black;
background-image: url("3.jpg");
background-repeat: no-repeat;
background-size: cover;
// background-position: center;
background-attachment: fixed;
cursor: url("cursor.png"), auto;
}
.header {
margin: 0;
padding: 0;
}
ul {
list-style: none;
margin: 0;
padding-left: 135px;
text-align:center;
width: 100%;
position: absolute;
background: transparent;
background: linear-gradient(rgba(195,162,94,.4), rgba(0,0,0,0.3));
overflow: hidden;
z-index: 1;
}
li {
display: inline-block;
// margin-left: 100px;
}
.logo img{
width: 135px;
height: 135px;
height: auto;
position: absolute;
margin-top: 0px;
margin-left: 40px;
z-index: 2;
cursor: url("cursor.png"), auto;
}
li a{
width: 100px;
display: block;
// padding-left: 500px;
padding: 35px 15px;
font-size: 20px;
font-family: Sylfaen;
color: white;
text-align: center;
text-decoration: none;
cursor: url("cursor.png"), auto;
}
li a:hover{
color: rgba(96,49,18);
}
<div class="header">
<div class="logo">
<a href="#">
<img src="https://otherthings.files.wordpress.com/2016/02/emoji-books.jpg?w=135&h=135" width="135px" height="135px">
</a>
</div>
<div class="navs">
<ul>
<li>Home</li>
<li>Game Info</li>
<li>Gameplay</li>
<li>Media</li>
</ul>
</div>
</div>

Related

Remove spacing between navbar and image

I have a Navbar with logo and links spaced out appropriately, in the hero section I use an image with full width and height but if leaves a white space between the nav and hero section. I have searched for how to address this but cannot seem to figure it out.
How can I remove the space between the Nav and next section?
Example Image: https://ibb.co/7YcTg4p
*Solved - After adding overflow: auto; inside the #container-bg {} class the white space collapsed and now the nav follows the next section with any space issues.
<header>
<img
src="https://cdn.pixabay.com/photo/2017/09/26/21/45/spiral-
2790215__480.png"/>
<nav class="nav-container">
<ul>
<li>Home
</li>
<li>Portfolio</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
</header>
<div id="container-bg">
<div class="content-wrapper">
<h1>Sample text</h1>
<p>More sample text</p>
Contact
</div>
CSS
header img {
width: 40px;
position: relative;
left: 120px;
top: 15px;
}
.nav-container {
float: right;
}
.nav-container ul {
margin: 0;
}
.nav-container ul li {
display: inline-block;
}
.nav-container ul li a {
text-decoration: none;
padding-right: 60px;
position: relative;
font-size: large;
color: black;
top: 22px;
right: 120px;
margin: 0px 0px 0px 20px;
padding: 0px 4px 6px 4px;
}
#container-bg {
background: url(img/img-bg.jpg) no-repeat center center fixed;
background-size: cover;
background-attachment: fixed;
width: 100%;
height: 100%;
}
.content-wrapper {
margin: 0 auto;
width: 80%;
text-align: center;
position: relative;
top: 30%;
}
.content-wrapper a {
background-color: blue;
color: white;
border-radius: 15px;
text-decoration: none;
text-transform: uppercase;
border: 1px solid #ffffff;
padding: 12px 18px;
font-size: 22px;
cursor: pointer;
I think I did not understand the question but it may help
.content-wrapper {
margin: 0 auto;
width: 80%;
text-align: center;
position: relative;
top: 0%; // here is the trick
}
After adding overflow: auto; inside the #container-bg {} class the white space collapsed and now the nav follows the next section without any spacing or gap issues.

Navbar extending too far

My navbar (or something) is extending too far and creating a horizontal scrollbar. I see people asking about this, but I cannot find the answer for my situation. The smaller I make the screen the bigger the space gets. Right now I'm just looking at IE.11.
Can someone please help? Thank you in advance.
Below is the code where I think the problem is. (html, page css and parallax css).
<body>
<div class="wrapper">
<header class="lighthouse">
<nav class="main">
<div class="menu-icon"> <i class="fa fa-bars fa-2x"></i> </div>
<div class="top-nav-logo"> <img src="images/mlc-logo/mlcwhite.png" width="97" height="59" alt="Mission Lighthouse Church Logo"/></div>
<ul>
<li>HOME</li>
<li>WHO JESUS IS</li>
<li>WHO WE ARE</li>
<li>MEDIA</li>
<li>CONNECT</li>
</ul>
</nav>
<div class="logo"><img src="images/mlc-logo/mlc-main-320.png" width="280" height="167" alt="Mission Lighthouse Church Logo" data-enllax-ratio="-.8" data-enllax-type="foreground"/> </div>
<div class="seagull"><img src="images/Parallax/seagull2.png" alt="Seagulls" width="276" height="136" class="seagull" data-enllax-ratio="-3" data-enllax-direction="horizontal" data-enllax-type="foreground"/></div>
<div class="welcome-home" data-enllax-ratio="-1.1" data-enllax-type="foreground">Welcome Home</div>
</header>
CSS:
html, html * {
padding: 0;
margin: 0;
}
body {
font-size: 62.5%;
}
.wrapper {
width: 100%;
background-color: #000000;
position: absolute;
}
.top-nav-logo {
display: block;
width: 100%;
margin: 10px 10px 0 20px;
position: fixed;
z-index: 100;
}
.menu-icon {
width: 50%;
box-sizing: border-box;
background-color: #000;
text-align: right;
padding: 15px 24px;
cursor: pointer;
color: #fff;
display: none;
}
nav.main {
display: inline-block;
position: fixed;
top: 0;
right: 0;
left: 0;
max-width: 1341px;
margin: 0 auto;
overflow: hidden;
width: 100%;
text-align: left;
z-index: 80;
}
nav ul {
list-style: none;
text-align: center;
background-color: rgba(0,0,0,0.0);
overflow: hidden;
color: #fff;
padding: 0;
margin: 0;
transition: 1s;
z-index: 80;
}
nav.blue ul {
background-color: rgba(0,34,73,0.95);
}
nav ul li {
display: inline-block;
padding: 20px;
}
nav ul li a {
display: inline-block;
color: #ffffff;
font-family: 'Montserrat', sans-serif;
font-weight: 500;
font-size: 1.7em;
text-decoration: none;
}
nav ul li a:visited {
color: rgba(240,183,110,1.00);
}
nav a:hover {
color: #F0F694;
text-decoration: none;
font-weight: 700;
transition: 1.7s;
-webkit-transition: 1.7s; /*Safari*/
}
CSS for Parallax:
.lighthouse {
width: 100%;
height: 768px;
position: relative;
background-image: url(../images/Parallax/front-header-4.jpg), url(../images/Parallax/2nd-header-background.jpg);
background-size: auto 768px, cover;
background-position: top center;
background-attachment: fixed;
background-repeat: no-repeat;
will-change: transform;
overflow: hidden;
}
.logo {
height: 140px;
width: 88%;
position: relative;
top: 170px;
margin: 0 auto;
text-align: center;
opacity: 0.65;
z-index: 20;
}
.seagull {
height: 123px;
width: auto;
position: relative;
left: -190px;
opacity: 0.8;
z-index: 10;
}
.welcome-home {
font-family: 'Kaushan Script', cursive;
font-size: 9.0em;
color: #004391;
position: relative;
text-align: center;
width: 98%;
top: 255px;
}
nav.main {
display: inline-block;
position: fixed;
top: 0;
right: 0;
left: 0;
max-width: 100%;
margin: 0 auto;
overflow: hidden;
width: 100%;
text-align: left;
z-index: 80;
}
Replace this code in your style sheet
You entered max-width:1341px; that is the reason it was expanded so far

Navigation bar flies to the bottom

I'm trying to create a navigation bar BELOW two icons/logos, but it flies to the bottom of the page, OR overlays the 2 logos. A live version is available at http://ddlgaming.com/giga/
This is my code so far:
(Please ignore some of the color:white, it's to help me see better.)
HTML:
<!DOCTYPE html>
<html>
<head>
<link href="css/mainframe.css" type="text/css" rel=stylesheet>
<script src="scripts/jquery.js"></script>
<body>
<!--Giga logo, top left--!>
<div id="gigalogomainbox">
<div id="gigalogobox">
<img id="gigalogo" src="images/gigalogo.png">
</div>
<div class="clearfix">
</div>
</div>
<!--Steam logo, top right--!>
<div id="steamlogomainbox">
<div id="steamlogobox">
<img id="steamlogo" src="images/steamlogo.png">
</div>
<div class="clearfix">
</div>
</div>
<!--navigation barrrrrr--!>
<div id="navbarbox">
<ul id="navbar">
<li>Home</li>
<li>Servers</li>
<li>Community</li>
<li>Store</li>
<li>Download</li>
<li>Contact</li>
</ul>
</div>
</body>
</html>
CSS:
.clearfix {
clear: both;
}
body
{
background-color: rgb(21,14,43);
background-image: url("../images/backgroundimage.jpg");
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
min-height: 100%;
background-position: center center;
overflow: hidden;
}
#gigalogomainbox
{
float: left;
width: 30%;
height: 50vw;
overflow: hidden;
transform: skewX(20deg);
}
#gigalogobox
{
margin: 0 3vw 0 5vw;
padding: 0 0 0 2vw;
background-color: white;
width: 80%;
height: 20%;
}
#gigalogo
{
width: 90%;
float: left;
margin: 2.5vw 2vw 0 0;
}
#steamlogomainbox
{
width: 10%;
height: 50vw;
float: right;
overflow: hidden;
}
#steamlogobox
{
margin: 0 -2vw 0 3vw;
padding: 0;
width: 100%;
height: 20%;
float: right;
background-color: white; /*000c21*/
transform: skewX(-20deg);
}
#steamlogo
{
width: 65%;
float: right;
margin: 3vw 2vw 0 0;
transform: skewX(20deg);
}
#placeholderbartop
{
float: left;
width: 60%;
margin: 0;
padding: 0;
height: 10vw;
}
#navbarbox
{
width: 100%;
}
#navbar, #navbar ul
{
width: 100%;
height: 5vw;
margin: 0;
color: white;
background-color: white;
display: inline-block;
}
#navbar li
{
color: white;
list-style: none;
display: inline-block;
padding: 1vw;
color: red;
font-size: 30px;
}
You've set a height of 50vw on your logos. So it's taking half the screen height (50vw = 50% of the view width), what you want is set the height as the same as your image height (50px? px = pixels). Then, it's pushing the rest to the bottom.
is this what you are looking for?
body
{
background-color: rgb(21,14,43);
background-image: url("../images/backgroundimage.jpg");
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
min-height: 100%;
background-position: center center;
overflow: hidden;
}
#navbarbox
{
width: 100%;
}
#navbar, #navbar ul
{
width: 90%;
height: 70px;
margin: 0;
color: white;
background-color: white;
display: inline-block;
}
#gi {
margin-top: -10px;
width:80px;
height: 50px;
line-height: 50px;
vertical-align:middle;
}
#steam{
margin-top: -10px;
width: 80px;
height: 60px;
line-height: 70px;
vertical-align: middle;
}
#navbar li
{
color: white;
list-style: none;
display: inline-block;
padding-top:15px;
padding-right: 1%;
color: red;
font-size: 80%;
}
<div id="navbarbox">
<ul id="navbar">
<li><img id="gi" src="http://ddlgaming.com/giga/images/gigalogo.png"></li>
<li>Home</li>
<li>Servers</li>
<li>Community</li>
<li>Store</li>
<li>Download</li>
<li>Contact</li>
<li><img id="steam" src="http://ddlgaming.com/giga/images/steamlogo.png"></li>
</ul>
</div>

How to Center my Nav bar, and put the social media icons on the side

https://jsfiddle.net/qnw7a9zk/
I'm attempting to put the nav bar in the center, and the social media icons on the side. I've looked up other solutions to this problem, but none also want to put the icons on the side.
If I try to float the nav bar to the left, and the icons to the right, it kind of works, but the nav bar isn't in the center, and if I were to change the size of the window (responsiveness) the bar kind of breaks.
I can only get the icons to the right, but not on the same row as the nav bar, and they are stuck below it.
<div class="wrapper">
<img class="logo" src="Logo.png" />
<nav>
<ul class="nav">
<li class="navlist">Properties</li>
<li class="navlist">The Team</li>
<li class="navlist">Contact Us</li>
</ul>
<div class="imgs">
<img src="Instagram.png" />
<img src="Facebook.png" />
<img src="Twitter.png" />
</div>
</nav>
</div>
<footer>
<p class="buttons">Real estate</p>
</footer>
</body>
body {
background-color: #ffffff;
margin: 0;
display: table;
height: 100%;
width: 100%;
background-image: url(nice.jpg);
background-size: 100% 100%;
overflow: auto;
}
.wrapper {
text-align: center;
padding: 0px;
height: auto;
width: 100%;
}
footer {
background-color: #cbb492;
display: table-row;
height: 2px;
text-align: center;
}
li a {
text-decoration: none;
font-variant: small-caps;
color: black;
}
li:hover {
background-color: #cbb492;
}
nav {
width: 100%;
position: absolute;
top: 0px;
padding-bottom: 2px;
padding-top: 2px;
background-color: whitesmoke;
}
.logo {
height: 28px;
width: 90px;
padding-top: 50px;
}
p {
color: white;
font-size: 6px;
text-align: left;
padding-left: 20px;
}
.navlist {
display: inline;
padding-left: 30px;
margin-left: 10px;
margin-right: 10px;
padding-right: 30px;
padding-top: 3px;
padding-bottom: 2.4px;
}
.nav {
list-style: none;
padding: 0;
width: 100%;
margin: 0;
top: 0px;
}
.imgs {
list-style: none;
margin: 0;
display: block;
padding-left: 0px;
float: right;
width: 30%;
}
.imgs img {
width: 9%;
height: 9%;
}
You should try to move the .imgs-div one level higher. Than it should be easier. One approach could be the flexbox model. So the wrapper-container gets
display: flex;
flex-direction: row;
justify-content: space-between;
I just did some more edits. Is this what you wanted to achive?
https://jsfiddle.net/qnw7a9zk/6/
You have given width:100% to .nav so it is taking full width and pushes images down. Keep the width ratio maintained in navigation and image. Like 80% navidation and 20 % images, see fiddle
https://jsfiddle.net/qnw7a9zk/5/
You may do it by display: inline-block
body {
background-color: #ffffff;
margin: 0;
display: table;
height: 100%;
width: 100%;
background-image: url(nice.jpg);
background-size: 100% 100%;
overflow: auto;
}
.wrapper {
text-align: center;
padding: 0px;
height: auto;
width: 100%;
}
footer {
background-color: #cbb492;
display: table-row;
height: 2px;
text-align: center;
}
li a {
text-decoration: none;
font-variant: small-caps;
color: black;
}
li:hover {
background-color: #cbb492;
}
nav {
padding-bottom: 2px;
padding-top: 2px;
background-color: whitesmoke;
text-align: center
}
.logo {
height: 28px;
width: 90px;
}
p {
color: white;
font-size: 6px;
text-align: left;
padding-left: 20px;
}
.navlist {
display: inline;
padding-left: 30px;
margin-left: 10px;
margin-right: 10px;
padding-right: 30px;
padding-top: 3px;
padding-bottom: 2.4px;
}
.nav {
list-style: none;
padding: 0;
margin: 0;
display: inline-block;
}
.imgs {
list-style: none;
margin: 0;
display: inline-block;
padding-left: 0;
}
<div class="wrapper">
<nav>
<ul class="nav">
<li class="navlist">Properties</li>
<li class="navlist">The Team</li>
<li class="navlist">Contact Us</li>
</ul>
<div class="imgs">
<img src="Instagram.png" />
<img src="Facebook.png" />
<img src="Twitter.png" />
</div>
</nav>
<img class="logo" src="Logo.png" />
</div>
<footer>
<p class="buttons">Real estate</p>
</footer>
</body>

Why does my DIV ovelay my text div when resized?

Few problems. It looks great when it's not re-sized. But when it's re-sized everything plays up.
Main issue is the nav; when it's resized it overlays the main text and collides with it. Also how would I go about sorting out the layout when it's resized? I want the header to always look good regardless of size.
Thank-you.
HTML
<div class="wrapper">
<div class="header">
<div class="company-text"> Kidderminster Electronic Recycling</div>
<nav>
Contact
FAQ
Recycling
Where we collect
Home
</nav>
<div class="clear"></div>
</div>
<div class="main-content">dfgf</div>
<div class="footer">xxzxczxczxcz</div>
</div>
CSS
body, html {
margin: 0 0;
height: 100%;
}
#font-face {
font-family: TCB_____;
src: url('TCB_____.ttf');
}
.wrapper {
width: 100%;
height: 100%;
background-color: yellow;
}
.header {
width: 100%;
background: black;
height: 20%;
}
nav {
background-color: #222;
padding: 0;
padding-right: 5%;
width: 45%;
display: inline-block;
float: right;
position: relative;
top: 50%;
transform: translateY(-50%);
}
nav a { color: #F9F9F9; display: block; float:right; padding: 10px; }
nav a:visited { color: #f9f9f9; }
nav a:hover { text-decoration: none; background: #27B3CF; }
nav a:active { position: relative; top: 0; }
a {
outline: 0;
text-decoration: none;
font-family: TCB_____; /* no .ttf */
text-transform: uppercase;
letter-spacing: 0.3em;
font-size: 1.0037500100376em;
}
.clear {
clear: both;
}
.company-text {
font-family: TCB_____; /* no .ttf */
font-size: 1.5em;
padding-left: 5%;
letter-spacing: 0.3em;
color: white;
text-transform: uppercase;
float: left;
width: 45%;
position: relative;
top: 50%;
transform: translateY(-50%);
}
.main-content {
background:url('all-electronics-recycling-home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 75%;
}
.footer {
height: 5%;
background: black;
width: 100%;
outline: 0;
text-decoration: none;
font-family: TCB_____; /* no .ttf */
text-transform: uppercase;
letter-spacing: 0.3em;
font-size: 0.8em;
color:white;
text-align: center;
}
LIVE DEMO
http://jsfiddle.net/48ajumza/
The #nav element is floated. So, it does not have a height. In order to give it a height, you'll need to drop something in the bottom of it that will clear floats. I used one of your divs with the class .clear.
<div class="wrapper">
<div class="header">
<div class="company-text"> Kidderminster Electronic Recycling</div>
<nav>
Contact
FAQ
Recycling
Where we collect
Home
<div class="clear"></div>
</nav>
<div class="clear"></div>
</div>
<div class="main-content">dfgf</div>
<div class="footer">xxzxczxczxcz</div>
</div>