Really simple issue. Fished around the site a bit, nothing seems to work.
I have a sticky navigation on the bottom of my site that isn't sticking to the bottom! It isn't respecting my height rules and is overflowing without regards.
Things I've tried:
Clearfix
Overflow
Table display
Tried everything i know of honestly.
What i'm aiming for visually:
Fiddle Link
CSS / HTML / Demo
.fn {
width: 100%;
height: 100%;
max-height: 41px;
bottom: 0;
left: 0;
position: absolute;
background-color: #fff;
}
.fn ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
.fn li {
display: inline-block;
}
.fn a {
display: block;
padding: 10px 5px 10px 30px;
text-decoration: none;
font-family: "Raleway", sans-serif;
font-size: 1.15em;
letter-spacing: 0.05em;
color: #000;
}
.fn .first {
margin-right: 45.5px;
background-image: url(http://s28.postimg.org/f3f2a8mnd/fi2.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
top: -14px;
position: relative;
}
.fn .mid {
height: 55px;
bottom: 0;
margin: 0 auto;
z-index: 9998;
}
.fn .mid img {
height: 100%;
display: inline-block;
}
.fn .second {
margin-left: 45.5px;
background-image: url(http://s28.postimg.org/ag908gzah/fi1.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
top: -14px;
position: relative;
}
<div class="fn">
<ul>
<li> Resume
</li>
<li class="mid">
<img src="http://s18.postimg.org/v70ga0bvt/image.png"></img>
</li>
<li> Contact
</li>
</ul>
</div>
You have to change absolute position to fixed and vertical align li elements top.
.fn {
width: 100%;
height: 100%;
max-height: 50px;
bottom: 0;
left: 0;
position: fixed;
background-color: #fff;
}
.fn ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
.fn li {
display: inline-block;
vertical-align: top;
}
.fn a {
display: block;
padding: 10px 5px 10px 30px;
text-decoration: none;
font-family:"Raleway", sans-serif;
font-size: 1.15em;
letter-spacing: 0.05em;
color: #000;
}
.fn .first {
margin-right: 45.5px;
background-image: url(http://s28.postimg.org/f3f2a8mnd/fi2.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
position: relative;
}
.fn .mid {
height: 55px;
bottom: 0;
margin: 0 auto;
z-index: 9998;
}
.fn .mid img {
height: 100%;
display: inline-block;
}
.fn .second {
margin-left: 45.5px;
background-image: url(http://s28.postimg.org/ag908gzah/fi1.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
position: relative;
}
.fn li:first-child, .fn li:last-child {
padding-top: 10px;
}
Fiddle: http://jsfiddle.net/mcwo8qvz/7/
hello just make your fn class div to position fixed and expand your max-height to 55 px
here is jsfiddel = http://jsfiddle.net/mcwo8qvz/2/
.fn {
width: 100%;
height: 100%;
max-height: 55px;
bottom: 0;
left: 0;
position: fixed;
background-color: #fff;
}
Related
I want to do something like this: Preview
The idea is to make the responsive image before and after the H1 tag in CSS. But the only thing I managed is to put a normal line JSFiddle.
<h1 ><i class="logo"></i><span>HELLO WORLD</span></h1>
<style>
h1 {
position: relative;
color: #fff;
font-family: sans-serif;
font-size: 4.6rem;
font-weight: 700;
line-height: 4.6rem;
letter-spacing: .02rem;
margin: 0 auto 5rem;
padding: 0 1rem;
text-align: center;
text-transform: uppercase;
}
h1 span {
display: inline-block;
position: relative;
padding: 0 20px;
}
h1 span:before, h1 span:after {
content: '';
display: block;
width: 500px;
position: absolute;
top: 0.73em;
border-top: 1px solid white;
}
h1 span:before {
right: 100%;
}
h1 span:after {
left: 100%;
}
</style>
I managed somehow to get the images before and after the h1 tag, but they aren't responsive JSFiddle.
<h1 class="heading"><i class="logo"></i>Welcome World</h1>
<style>
h1{
display: block;
}
h1.heading {
position: relative;
color: #fff;
font-family: sans-serif;
font-size: 4.6rem;
font-weight: 700;
line-height: 4.6rem;
letter-spacing: .02rem;
text-align: center;
text-transform: uppercase;
width: 100%;
margin: 0;
margin-top: 30px;
padding: 0;
}
h1.heading:before {
display: inline-block;
margin: 0 20px 8px 0;
content: " ";
text-shadow: none;
background: url(https://i.imgur.com/fcoggcZ.png) no-repeat;
width: 100%;
height: 87px;
position: absolute;
left: 0%;
}
h1.heading:after {
display: inline-block;
margin: 0 20px 8px 0;
content: " ";
text-shadow: none;
background: url(https://i.imgur.com/KCzu3hE.png) no-repeat;
width: 100%;
height: 87px;
position: absolute;
right: -83rem;
}
</style>
Sorry for the code, it's a little messy, i'm still beginner at it.
You just needed to fix the widths of the before and after elements. They were 100% so were taking up the full width of the title.
I also dropped the font-size. You'll have to take care of that with media queries if you want it to grow on larger screens etc.
body {
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
background: #000;
}
h1{
display: block;
}
h1.heading {
position: relative;
color: #fff;
font-family: sans-serif;
font-size: 1.5rem;
font-weight: 700;
line-height: 87px;
letter-spacing: .02rem;
text-align: center;
text-transform: uppercase;
width: 100%;
margin: 0;
margin-top: 30px;
padding: 0;
}
h1.heading:before {
display: inline-block;
margin: 0 20px 8px 0;
content: " ";
text-shadow: none;
background: url(https://i.imgur.com/fcoggcZ.png) no-repeat right center;
width: 30%;
height: 87px;
position: absolute;
left: 0;
}
h1.heading:after {
display: inline-block;
margin: 0;
content: " ";
text-shadow: none;
background: url(https://i.imgur.com/KCzu3hE.png) no-repeat left center;
width: 30%;
height: 87px;
position: absolute;
right: 0;
}
<h1 class="heading"><i class="logo"></i>Welcome World</h1>
EDIT
I get too into these...
A safer bet would be to wrap the text in a span, then drop off your position absolutes. that way you, if space gets too tight - it will go onto another line.
body {
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
background: #000;
}
h1{
display: block;
}
h1.heading {
position: relative;
color: #fff;
font-family: sans-serif;
font-size: 1.5rem;
font-weight: 700;
letter-spacing: .02rem;
text-align: center;
text-transform: uppercase;
width: 100%;
margin: 0;
margin-top: 30px;
padding: 0;
}
h1.heading:before {
display: inline-block;
margin: 0;
content: " ";
text-shadow: none;
background: url(https://i.imgur.com/fcoggcZ.png) no-repeat right center;
width: 30%;
height: 87px;
left: 0;
vertical-align:middle;
}
h1.heading:after {
display: inline-block;
margin: 0;
content: " ";
text-shadow: none;
background: url(https://i.imgur.com/KCzu3hE.png) no-repeat left center;
width: 30%;
height: 87px;
display:inline-block;
vertical-align:middle;
}
h1.heading span {
width:40%;
display:inline-block;
vertical-align:middle;
}
<h1 class="heading"><span>Welcome World</span></h1>
For the fun, you can also simplify your code with the use of flexbox, which is completely compatible with pseudo elements.
The nice thing is that the images position will adjust to the title width, so you could define a max-width to the h1 div & let flexbox handle the rest.
body {
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
background: #000;
}
h1{
display: flex;
color: #fff;
font-family: sans-serif;
letter-spacing: .02rem;
text-align: center;
text-transform: uppercase;
min-height: 87px;
}
h1:before,
h1:after {
content: " ";
flex: 1;
}
h1 div {
padding: 0 20px;
align-self: center;
}
h1:before {
background: url(https://i.imgur.com/fcoggcZ.png) no-repeat right 20px center;
}
h1:after {
background: url(https://i.imgur.com/KCzu3hE.png) no-repeat left 20px center;
}
<h1><div>Welcome World</div></h1>
<h1><div>Hey</div></h1>
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
I'm currently working on a website and have encountered an interesting problem. I have a container which holds my navbar. For some reason, this container displays behind its contents (Which it should) but mouse interaction acts as if it's in front of its contents.
JSFiddle of my current code
https://jsfiddle.net/qzsxpgrq/
HTML
<div id="navbar">
<div id="bar">
<div id="navLeft">
<div class="navL navbutton">About</div>
<div class="navL navbutton">The Team</div>
</div>
<div id="navLogo">
<div id="logo">
<img src="http://www.epicyoobed.com/res/img/navLogo.png"/>
</div>
</div>
<div id="navRight">
<div class="navR navbutton">Programs</div>
<div class="navR navbutton">Contact</div>
</div>
</div>
</div>
CSS
html {
height: 100%;
font-family: arial;
}
body {
margin: 0;
padding: 0;
background-color: #BBB;
}
#navbar {
margin: 0;
padding: 0;
height: 80px;
width: 100%;
position: fixed;
display: block;
z-index: 1;
}
#bar {
display: block;
position: fixed;
width: 100%;
height: 40px;
background-image: url("http://www.epicyoobed.com/res/img/nav.png");
}
#navRight {
margin: 0;
padding: 0;
height: 40px;
width: 45%;
position: absolute;
display: block;
float: left;
top: 0;
right: 0;
}
#navbar div div a {
display: block;
text-decoration: none;
padding-top: 5px;
color: #000;
width: 100%;
height: 100%;
font-size: 20px;
}
.current {
background-image: url("http://www.epicyoobed.com/res/img/nav_sel.png");
background-repeat: repeat-x;
}
.navL {
float: right;
}
.navR {
float: left;
}
.navbutton {
display: block;
position: relative;
width: 150px;
height: 100%;
text-align: center;
}
.navbutton:hover {
background-image: url("http://www.epicyoobed.com/res/img/nav_sel.png");
background-repeat: repeat-x;
}
#navLogo {
margin: auto;
height: 40px;
width: 100%;
position: absolute;
display: block;
z-index: 2;
}
#logo {
margin: auto;
height: 80px;
width: 80px;
}
#navLeft {
margin: 0;
padding: 0;
height: 40px;
width: 45%;
position: absolute;
display: block;
float: right;
}
Xetanai Try adding a z-index of 3 to the #navLeft and navRight.
#navLeft {
margin: 0;
padding: 0;
height: 40px;
width: 45%;
position: absolute;
display: block;
float: right;
z-index:3;
}
#navRight {
margin: 0;
padding: 0;
height: 40px;
width: 45%;
position: absolute;
display: block;
float: left;
top: 0;
right: 0;
z-index:3;
}
The issue you're experiencing is because the logo is 100% width and has a z-index of 2. Effectively placing it above the left and right containers.
I have this problem where Firefox and IE refuse to render a border behind an image no matter what I do, while Chrome and Opera do fine. I've moved the div containing the arrow all over the place, even tried to force it with z-index, but it won't budge. Any advice?
Chrome/Opera and IE/Firefox:
I have a JSFiddle setup here: http://jsfiddle.net/3Lqoxv2r/
CSS:
html {
height: 100%;
background: #eee;
}
body {
background: url(../img/background.jpg);
background-repeat: no-repeat;
background-size: cover;
margin: 0px;
height: 100%;
overflow: hidden;
background-position: center;
font-family: Helvetica;
}
body.welcome {
background: url(../img/welcome_background.jpg);
background-size: cover;
background-position: center;
}
p {
margin: 0px;
}
::-webkit-scrollbar {
width: 1px;
}
.wrapper {
overflow-y: scroll;
height: calc(100% - 90px);
}
header {
position: static;
top: 0;
height: 60px;
}
header .logo {
float: left;
width: 256px;
}
header .logo .container {
padding: 0 0 0 128px;
height: 60px;
background: white;
}
header .logo .container img {
margin: 13px 0 0 0;
width: 63px;
height: 66px;
filter: hue-rotate(0deg);
-webkit-filter: hue-rotate(0deg);
-moz-filter: hue-rotate(0deg);
-o-filter: hue-rotate(0deg);
-ms-filter: hue-rotate(0deg);
}
header .menu {
float: left;
background: white;
width: calc(100% - 256px);
height: 100%;
}
header .menu nav {
float: left;
}
header .menu nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}
header .menu nav ul li {
float: left;
width: 128px;
line-height: 57px;
letter-spacing: -2px;
text-align: center;
font-size: 19px;
text-transform: uppercase;
color: #8a8a8a;
border-top: 3px solid white;
}
header .menu nav ul li.active {
color: #f05555;
border-top: 3px solid #f05555;
}
header .menu .container {
float: right;
padding-right: 128px;
}
.before {
content: "";
position: absolute;
top: 60px;
left: 130px;
border-top: 23px solid white;
border-left: 28px solid transparent;
border-right: 28px solid transparent;
}
div.content {
width: 100%;
height: calc(100% - 90px);
}
div.content .menu {
height: 50px;
}
div.content .container {
overflow-y: scroll;
height: 100%;
margin: 0 128px 0 128px;
width: calc(100% - 256px);
background: white;
}
footer {
position: static;
bottom: 0;
height: 30px;
background: white;
padding: 0 0 0 128px;
line-height: 30px;
font-size: 10px;
color: #8a8a8a;
}
You have used position: static for header tag. Use position: relative instead, it will work in ff and IE11.
If you are viewing it on JSFiddle you'll have to make the results window bigger to see what I am talking about. The logo should be right over top of the half circle and header and the nav should be centered in the header and right aligned.
Here is the fiddle - http://jsfiddle.net/sPEXp/1/
HTML
<div class="header">
<div class="container">
<img class="logo" src="img/onewaylogo.png">
<nav>
Home
About
Let's Partner
Contact
</nav>
</div>
</div>
CSS
.header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: #f6f6f6;
z-index: 10000;
height: 100px;
}
.header .container {
position: relative;
height: 100px;
width: 85%;
margin: 0 auto;
text-align: center;
}
.header:after {
content: '';
position: relative;
bottom: 0;
display: block;
margin: 0 auto;
background: #f6f6f6;
width: 150px;
height: 75px;
border-radius: 0 0 75px 75px;
}
.header .logo,
.header nav a {
line-height: 100px;
}
.header nav {
float: right;
position: relative;
width: 320px;
}
.logo {
position: relative;
top: 50px;
display: inline-block;
width: 150px;
height: 100px;
z-index: 100000;
margin: 0 auto;
}
.header nav a {
color: #aaa;
font-weight: 700;
margin: 0 0 0 20px;
font-size: .95em;
}
.header nav a:hover {
color: #333;
}
Fiddle Working
You can center elements by setting its width and position to absolute
In this case:
.logo {
position: absolute;
margin: 0 50%;
width: 150px;
left: -75px; // total width half (75px)
...
}