So im fully aware of the amount of questions asked about "Sticky Footers", and have also referenced many, MANY different questions on here and websites about sticky footers. I've created a fresh template away from this project that work and have examples of how sticky footers operate, be it inside the wrapper or out...
However, i just cant seem to get it operate correctly within my solution.
Currently the footer appears to be "sticky", however on one of my main pages, the content (images and text) seem to overlap the footer, due to the footer not being pushed to the bottom correctly. It seems to sit just below the screen (Meaning you have to scroll slightly to see the footer) - But on this page it sits in that location, doesnt get pushed down and then the content overlaps.
I've tried everything, Removing 100% on HTML, BODY, WRAPPER, contentDiv, but basically, one thing works, which breaks another.
What im after is, ContentDiv = 100% (pushing down the footer). So i should be able to create a blank page, the footer be glued to the bottom, and if content increases it pushed it down... Simple right? But tearing out my hair with this :/
So, any help would be massively appreciated, as i have a short deadline to get this sorted.
Fiddle Demo
CSS
html
{ margin: 0px; padding: 0px; height:100%; }
body
{ margin: 0px; padding: 0px; height: 100%; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 12px; }
/* { margin: 0px; padding: 0px; height: 100%; font-family: 'Montserrat', sans-serif; font-size: 12px; } */
p { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 12px; }
h1 { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size:24px; }
h2 { margin:0px; padding:0px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; }
/* PAGE FORMATTING - START*/
span:hover { /* text-decoration: underline; */ }
a:link, a:visted { }
ahover, a:active { }
.link_nav_header{
padding:0px;
font-size:20px;
font-weight:bold;
color:#333333;
cursor:pointer;
}
.but_default
{
padding: 2px;
border: 1px solid #009900;
background-color: #33FF00;
/* background-color: #dddbdb; */ /* TWO COLOURS? */
}
.but_events-buybutton
{
padding:3px;
min-width:90%;
margin-bottom:5px;
color:#ffffff;
background-color:#378ec8;
}
.but_all
{
min-width:90%;
cursor: pointer;
margin: 2px;
}
/* HEADER - START */
.hdr_container
{
width:100%;
height:110px;
padding:0px;
margin:0px;
position:relative;
background-color:#0099ff;
color: #ffffff;
overflow: hidden;
}
#hdr_profile-icon {
margin-top: 1%;
margin-right: 1%;
float: right;
background-color: inherit;
}
/* NEW NAVIGATION */
#nav {
width: 100%;
padding: 0;
margin: 0 auto;
background-color: #333333;
position: absolute;
bottom: 0%;
}
#nav ul {
list-style: none;
/* width: 800px;*/ /* REMOVE TO STRETCH NAV TO FULL WIDTH */
width: 100%;
margin: 0 auto;
padding: 0;
}
#nav li {
float: left;
text-align: center;
}
#nav ul li{
width: 11%; /* STRETCHES NAV TO FULL WIDTH */
}
#nav li a {
padding: 8px 15px;
display: block;
text-decoration: none;
font-weight: bold;
color: white;
text-transform:uppercase
}
#nav li:first-child a {
background: red;
width: 10px;
font-weight: normal;
}
#nav li a:hover {
/* color: #c00; */
background-color: #0099ff;
}
#nav a:hover a:focus {
/* color: #c00; */
background-color: red;
}
/* MAIN CONTENT - START */
#wrapper {
clear: both;
/* margin: 0 auto; */
width: 100%;
height:100%;
min-height: 100%;
/* margin-bottom: -75px; */
z-index:10;
}
.contentDiv
{
clear: both;
width:65%;
min-width: 800px;
height:90%;
background-color:#ffffff;
margin-left:auto;
margin-right:auto;
/* z-index: -9999; */
}
/* TABLE - START */
.tbl_container-centered
{
width:100%;
height:100%;
min-height:100%;
/* padding-bottom: 20px; */
margin-left:auto;
margin-right:auto;
display:table;
overflow:auto;
/* margin-bottom: 75px; */
display: inline-table;
vertical-align: middle;
}
.tbl_containerpaneltext-centered
{
width:95%;
min-height:35%;
margin-left:auto;
margin-right:auto;
background-color:red;
}
.tbl_head-genericthread
{
min-height:3%;
max-height:3%;
text-align:center;
color:#ffffff;
background-color:#0099ff;
}
.tbl_events-head {
width: 100%;
height: 100%;
min-height: 100%;
border: 1px solid;
text-align: left;
border-collapse: collapse;
}
.tbl_grid-events
{
background-color: #ffffff;
}
.tbl_pickseats-famtable
{
width:100%;
background-color:#e1e1e1;
}
table#tbl_events{
height:100%;
min-height:100%;
border-collapse: collapse;
border-right: 1px solid #333333;
border-left: 1px solid #333333;
}
.link_moreinfo{
padding:0px;
font-size:14px;
font-weight:bold;
color:#0099ff;
cursor:pointer;
}
#event_row {
height: 140px;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
#basket2 {
background: red;
}
/* FOOTER CSS - START */
.footer_container
{
clear: both;
width:100%;
height:75px;
bottom:0;
background-color:#0099ff;
/* position:absolute; */
}
.footer_container, .wrapper:after {
/* .push must be the same height as footer */
height: 75px;
}
.wrapper:after {
content: "";
display: block;
}
.footer_global-bottom {
width: 100%;
margin: auto;
padding-top: 20px;
text-align: center;
color: white;
background: #333333;
}
.footer_global-bottom a {
color: white;
text-decoration: none;
}
/* ERROR HANDELING */
.error {
background: #ef7474;
border: 1px solid #f5aca6;
text-align: center;
}
.success
{
background: #74e963;
border: 1px solid #59e836;
text-align: center;
}
.alerts_box {
padding: 10px;
width: 250px;
position: absolute;
visibility: hidden;
font-size: 10px;
color:black;
}
.alerts {
width: 275px;
z-index: 2;
padding-bottom: 40px;
}
have you considered using this piece of code:
.footer_container {
position: fixed;
bottom: 0;
z-index: 100;
}
If you want full content being visible you can add to wrapper something like this:
margin-bottom: (footer-height)px;
Or use padding-bottom instead of margin-bottom.
in your #wrapper rule-set change height:100% to height:auto and remove min-height:100%.
jsFiddle
#wrapper {
clear: both;
width: 100%;
height:auto;
z-index:10;
}
I believe that setting the height to 100% is setting it to 100% of the browser window, not 100% of the content. I could be wrong about that though.
This will place the footer at the end of the content. On pages where the content is less than the height of the window, you can wrap the footer and give the footer wrapper a class like this:
.minContentFooter {
position: absolute;
bottom: 0;
}
If the case is that the content is loaded dynamically and you don't know if it will fill a browser window, then you will need a bit of javascript to have it both ways - either at the bottom of the content or the bottom of the window when there is minimal content.
Problem was solved, not by CSS, but by Javascript.
The problem was due to the page loading dynamic content from a table, it never knew how big the contentDiv was, so didnt know where to but the footer.
The sticky footer is achieved by setting CSS % heights, and also using javascript to help correct for pages with no content or those with dynamically loaded content.
The code below explains the active javascript:
var totalHeight = $('#header').height() + $(id).height();
var contentDivHeight = $('#content').height();
var wrap = $('#wrapper');
if (totalHeight >= contentDivHeight) {
wrap.removeClass('wrapper-height');
wrap.addClass('wrapper-minHeight');
} else {
wrap.addClass('wrapper-height');
wrap.removeClass('wrapper-minHeight');
}
The code checks the height of the header and the content contained within the content and if its over the footer switches to a css class enforcing min-heights rather than heights to allow the footer to flow to the end of the content.
Many Thanks for everyone's help.
Related
So here's my code:
#logo {
position:fixed;
color: white;
width: 100%;
padding: 5px;
left:0px;
top:0px;
height:50px;
width:100%;
background:#ffffff;
z-index: 1;
}
#page-container {
margin: auto;
width: 960px;
height: 100%!important;
background: #ffffff;
border-style: solid;
border-color: red;
}
html, body {
padding: 0;
}
body {
font-family: Arial, Helvetica, Verdana, Sans-serif;
font-size: 12px;
color: #000000;
background-color: #eef3f7;
}
#footer {
position:fixed!important;
position:absolute;
color: white;
clear: both;
width: 100%;
padding: 0;
left:0px;
bottom:0px;
height:30px;
background:#272695;
text-align:center;
}
I want to be able to set the page container height so that the footer over laps it all the way through. The issue I am getting is this:
What I want is to have my page-content rule to cover the whole top and bottom with no overlapping. I'm looking for something along the lines of this:
I honestly have tried everything I just don't know what the issue is.
Add this to your CSS.
body, html {
height: 100%;
}
The CSS height property is relative to it's parent and height defaults to auto. So to get your #page-container to be 100% you have to set the parent height.
So I have some wierd spacing at the bottom of the footer and im not sure whats causing it. the code is as follows:
scss:
html,
body {
margin:0;
padding:0;
height:100%;
}
#wrapper {
min-height:100%;
position:relative;
}
header {
padding:10px;
background:#EFDECD; //#5ee;
// text-align: center;
}
#content {
padding:10px;
// padding-bottom:80px; /* Height of the footer element */
}
footer {
display: block;
width:100%;
height:5em;
position:absolute;
bottom:0;
left:0;
background:#EFDECD; //#EFDECD
text-align: center;
overflow: hidden;
a{
padding: .75rem;
// position:relative;
top: 1.5em;
display: inline-block;
font-size: .72rem;
}
p{
font-size: .72rem;
}
}
video{
width: 100%;
height:auto;
}
.label{
margin-left: .5em;
margin-right: .5em;
}
table{
font-size: .75em;
}
.panel.callout a:not(.button):hover{
color: $anchor-font-color-hover;
}
.headtext{
display:inline-block;
font-size:3em;
margin-left: 1.5em;
text-align: center;
font-family:"Courier New";
font-weight: bold;
margin-left: 6em;
margin-right: 7em;
}
.img2{
// max-height: 20%;
max-width: 25%;
float:right;
display:inline-block;
}
.accorborder{
border: black dotted 1px;
}
h6{font-weight: bold;}
The site is in development and is at www.new.omegadesignla.com please inspect element to view and can also view source code there.
The problem comes from the <br> which is between <div id="wrapper">...</div> and <footer>...</footer>.
If you eliminate position:absolute from your footer rule, the white space below footer will disappear. Is there a specific reason you are using position:absolute?
I know this is probably really easy, but I am just about ready to throw my laptop out the window with this...
I have been trying to make a bit of javascript work within my one of my web pages, but failing this I made a back up of my previous code and tried to restore what it was before... but it has completely messed up my gallery page (I haven't touched this page) and it isn't linking up with my CSS - I really don't understand it.
The images in the gallery are supposed to be horizontal not vertical.
Please help, I am very new to Wordpress and understand my coding may be amateur
Link: Gallery
/*
Theme Name: tigertone
Theme URI: http://tigertonestudio.com
Description:
Version: 1.0
*/
#clear {
clear: both;
}
body {
margin:0;
padding:0;
height: 100%;
background: url('images/bg.png') repeat;
text-align:left;
font-family: "Verdana", Arial, Helvetica, sans-serif;
font-size:.8em;
}
#brushblack {
background: url('images/brushblack.png') repeat;
height: 100%;
}
#header{
width:1000px;
height:118px;
margin: 0 auto;
padding:50px 0 25px 0;
clear: both;
}
#content {
font-family:'aller', Arial, Helvetica, sans-serif;
margin:0 auto;
width:100%;
padding:0;
text-align:left;
vertical-align: middle;
}
.blackcontent {
background: url('images/bgdark.png') repeat;
width:100%;
padding:40px 0;
height:100%;
overflow:hidden;
margin:0 auto;
vertical-align: middle;
}
.content{
margin:0 auto;
width:1000px;
}
.entry {
color:#000000;
}
.ngg-albumoverview .ngg-album-compact { float: left; margin-right: 20px;}
.ngg-gallery{
width:100%;
float: left;
}
.ngg-gallery-thumbnail-box {
width: 25% !important;
float: left;
margin-bottom:10px;
border:5px
border-color:white;
}
===================
Classes Page
===================
.classes {
margin-bottom: 75px;
}
.classes {
width: 450px;
float: left;
margin: 10px 8px 0 0;
}
.classes:nth-child(4n+4) {
margin-right: 0;
}
.classes a {
text-decoration: none;
}
.classes h2,
.classes .classes-bio h2 {
font-weight: 700;
font-size: 1.5em;
text-transform: none;
margin: 15px 0 5px 12px;
}
.classes .classes-bio p {
color: #666;
line-height: 21px;
margin: 0 70px 18px 70px;
}
.classes .classes-bio p strong {
font-weight: 700;
}
.classes a.read-more {
color: #D1883E;
display: block;
margin: 12px 0 0 0px;
}
.classes a.read-more:hover {
text-decoration: underline;
}
.classes .classes-bio {
position: fixed;
width: 600px;
height: 90%;
display: none;
z-index: 9998;
padding-bottom: 10px;
background-color: #eaeaea;
}
.classes .classes-bio .close-button {
position: absolute;
top: -17px;
right: -17px;
z-index: 9999;
cursor: pointer;
}
.classes .classes-bio img.profile {
width: 442px;
margin: 25px 181px 8px;
}
.classes .classes-bio h2 {
text-align: center;
margin-bottom: 6px;
}
.classes .classes-bio {
font-size: 1.1em;
margin-bottom: 28px;
}
.classes .classes-bio p {
font-size: 0.9em;
color: #000;
text-align: center;
}
.mask {
position: absolute;
left: 0;
top: 0;
display: none;
z-index: 9997;
background-color: #000;
}
HTML:
<h1>Gallery</h1>
<div class="ngg-gallery">
<div class="ngg-galleryoverview">
<div class="ngg-gallery-thumbnail-box">
[nggallery id=1]
</div>
</div>
</p>
</div>
Line 396 of style.css has a missing }, could be causing your issues.
There are some un-commented comments in there too...
===================
Classes Page
===================
(and the other ones like it) Should be like this
/*
===================
Classes Page
===================*/
There is a part in your styles.css file that is listed like this:
a:link{
font-color:#000;
a:hover{
color:#D1883E}
It looks like you are missing a closing bracket after the first a:link style block.
Looks likes there's a problem with your global.js file. The jQuery library which comes with Wordpress is in no-conflict mode, which means you can't use the $ sign. Solution is to surround the code with
jQuery(document).ready(function ($) {
So, in your case, change the global.js file to:
jQuery(document).ready(function ($) {
$('.classes a').click(function(e) {
e.preventDefault();
// Get the dimensions of the user's screen
var maskHeight = $(document).height();
var maskWidth = $(window).width();
// Set the mask overlay to fill the entire screen
$('.mask').css({'width':maskWidth,'height':maskHeight});
// Fade in the mask overlay
$('.mask').fadeTo(600, 0.7);
// Get the dimensions of the user's browser
var winHeight = $(window).height();
var winWidth = $(window).width();
// Set the bio pop-up to be in the middle of the screen
$('.classes-bio').css('top', winHeight/2-$('.classes-bio').height()/2);
$('.classes-bio').css('left', winWidth/2-$('.classes-bio').width()/2);
// Fade in the bio pop-up
$(this).parent('.classes').find('.classes-bio').delay(610).fadeIn(600);
});
// Click the mask or close button to fade out the pop-up and the mask
$('.mask, img.close-button').click(function(e) {
$('.classes-bio').fadeOut(600);
$('.mask').delay(610).fadeOut(600);
});
});
See more here
I don't know if it will solve your problem, but you could give it a try!
I have a demo.
Why are list items overflow out of the white content area and how can i fix it?
body {
line-height: 1;
background:#7D93BD;
font-size: 22px;
}
#content {
width:80%;
height:auto;
margin-left:auto;
margin-right:auto;
padding: 10px 20px 30px 20px;
background-color:#F8F8F8;
color: #333333;
font-family: Helvetica, Arial, sans-serif;
}
#profileInfo {
position: relative;
top: 100px;
}
#profileInfo li {
list-style-type: none;
line-height: 1.4;
}
#profile_info_title {
font-weight: bold;
}
You need to remove top:100px from the #profileInfo ul - it's pushing that content down by 100px.
If you need #profileInfo to be pushed down by 100px, then use margin-top instead of top:
#profileInfo {
margin-top: 100px;
position: relative;
}
http://jsfiddle.net/AhSzg/2/
Remove position:relative from #profileInfo
Only use postion if you need it to act a different way that the default. Or remove the top:100px
So I got this website where everything were lined up perfectly, the header, body footer etc. Past week I tried to add a sidebar and I realized that it pushed my main content down.
So many question is, how can I make the margins/height of my sidebar independent of my main content? (Posted CSS code below)
DEMO:
Edit: http://oldtimesdaily.tumblr.com/
my tumblr with code. How it looks right now. The absolute position worked, the main content is back at top. But now all contents of my sidebar are jammed together, I guess absolute positionen removes all margins? What should I use instead to position the different contents on my sidebar?
#quote { /*style for quote division*/
position:relative;
width:375px;
height:70px;
border:1px solid black;
font-family:sans-serif;
font-size:95%;
padding:3px;
background-color:lightyellow;
}
#auth { /*style for quote author, if any*/
position:absolute;
bottom:3px;
right:10px;
}
#sidebar { /*editable*/
background: url('http://s10.postimg.org/uag5u79d1/vline.png') repeat-y left center;
background-color: white;
width: 260px;
position: relative;
top: 700px;
left: 55%;
}
#sidebar .sTitle {
padding: 0 0 10px 0;
position: relative;
margin: 0px 20px 0px;
color: #222;
font-size: 15px;
line-height: 1;
font-family: QuicksandBold, Helvetica, Arial, sans-serif;
font-weight: bold;
letter-spacing: 3px;
text-decoration: none;
border-bottom: 0px;
}
#sidebar .Categories {
font-size: 11px;
text-align: center;
padding: 3px 5px;
margin: 50px;
}
position: absolute;
will make the sidebar independent of the rest of the page