I tried to use a couple of posts that were here for resizing for mobile devices but i can't seem to get it working. The margins keep pushing all the elements together when you view the site on a mobile device
/* TEXT FORMATTING */
.introPar1 {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
margin-left: 400px;
margin-right: 400px;
font-size: 30px;
}
.introPar1 h1 {
text-align: center;
}
.contacts {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
margin-left: 400px;
margin-right: 400px;
font-size: 30px;
}
/* MOBILE FORMATTING */
#media (max-width: 1100px) {
introPar1 {
margin-right: 20px;
`enter code here`margin-left: 20px;
}
}
#media (max-width: 750px) {
body {
margin-right: 5vw;
margin-left: 5vw;
}
}
#media (max-width: 500px) {
body {
margin-right: 2vw;
margin-left: 2vw;
}
}
You are seeing this page on mobile devices like this
You need to change like this
then increase the nav bar width
(I tried width: 1520px; for Nav beacuse that is the background image size you were used)
There are a bunch of problems with your code. But the problem with the menu is because li is not taking the height of a. So the list items will stack one under another, and will li under li. Li being smaller than a.
Use display:block on a.
Also, I copied the code from your site, so it will be here if someone else comes looking for this answer. Tried to clean it up a bit but you have some styles that i don't understand, like .introPar1 { margin-left:400px;margin-right:400px}
Anyway, see code below
body img {
max-width: 100%;
height: auto;
}
/* TOP NAVIGATION */
nav ul li a {
text-decoration: none;
margin: 20px;
padding: 20px;
border-style: solid;
border-color: grey;
display: block;
}
nav ul li {
float: left;
}
nav ul {
list-style-type: none;
float: left;
}
nav {
background-color: #f2f2f2;
padding: 10px;
float: left;
width: 100%;
box-sizing: border-box;
}
/* NAV HOVER */
nav a:hover {
background-color: blue;
border-color: orange;
border-style: solid;
color: white;
transition: .3s;
}
/* BANNER */
.banner {
text-align: center;
}
.banner img {
border-style: solid;
border-width: 10px;
border-color: #87CEEB;
}
/* BODY ELEMENTS */
.home {
font-weight: bold;
font-size: 20px;
}
.temp {
text-align: center;
margin: auto;
padding: 20px;
}
/* BACKGROUND */
.bgimage img {
pointer-events: none;
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
opacity: 0.5;
position: fixed;
}
/* TEXT FORMATTING */
.introPar1 {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
font-size: 30px;
}
.introPar1 h1 {
text-align: center;
}
.contacts {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
font-size: 30px;
}
/* MOBILE FORMATTING */
#media (max-width: 1100px) {
introPar1 {
margin-right: 20px;
margin-left: 20px;
}
}
#media (max-width: 750px) {
body {
margin-right: 5vw;
margin-left: 5vw;
}
nav ul li a {
margin: 5px;
padding: 10px;
}
}
#media (max-width: 500px) {
body {
margin-right: 2vw;
margin-left: 2vw;
}
nav ul li {
width: 100%;
}
}
<div class="bgimage">
<img src="http://via.placeholder.com/1200x1000">
</div>
<nav>
<ul>
<li class="home">Crafts LLC</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
</nav>
<div class="banner"><img src="http://via.placeholder.com/350x150"></div>
<div class="Intro">
<article class="introPar1">
<h1><b><u>CRAFTS LLC</u></b></h1>
<br> Here at CRAFTS LLC, we offer you our 45 years of expertise of
<br> home repair advisory and remodeling services
<br>
<br> We are also here to help you with your estimation service needs
<br> and contractor referral services
<br>
<br> With CRAFTS LLC, you get both service and quality excellence.
<br> You need to look no further for your home repair and remodeling needs/solutions
<br>
</article>
</div>
<div class="contacts">
<p>Email to: craftsllc1#gmail.com or Call:813 347 7458</p>
</div>
Related
The responsive drop down menu work well here:
https://klia2.co/include/header.htm
but when insert to content page as below, the drop down menu not drop down when view in media screen.
https://klia2.co/index2.htm
compared the 2 links to understand the actual scenario.
Notice that the alignment of logo header and menu in content page also not tally.
Kindly assist to rectify the issue and all suggestion are most welcome and appreciated.
HTML PAGE - index2.htm
<body>
<div id="header"></div>
<div class="content">
<br>
<br>
** content **
<br>
<br>
<div id="footer"></div>
</div>
</body>
HTML PAGE - header.htm
<body>
<div class="content">
<header id="logo"></header>
<div class="navbar" id="nav">
Home
Facilities
Airlines Offices
<form class="search-box">
<input type="text" placeholder="Search..">
<button type="submit" class="search-icon"><i class="fa fa-search"></i></button>
</form>
<i class="fa fa-bars"></i>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("nav");
console.log(barIcon)
if (x.className === "navbar") {
x.className += " responsive";
var barIcon = document.getElementsByClassName('fa-bars')[0];
barIcon.classList.add("fa-times");
barIcon.classList.remove("fa-bars");
} else {
var closeIcon = document.getElementsByClassName('fa-times')[0];
closeIcon.classList.remove("fa-times");
closeIcon.classList.add("fa-bars");
x.className = "navbar";
}
}
</script>
</body>
CSS CODE - style1.css
/* CSS Reset */
body {font-family:Arial;
}
.content {
max-width: 1040px;
margin: auto;
}
/*--------------------------logo---------------------------------*/
#logo {
background: transparent url("images/airlineshq-logo.jpg") no-repeat scroll 0% 0%;
width: 1040px;
height: 150px;
border: 0;
margin-bottom: 0;
}
#media only screen and (max-width: 600px) {
#logo {
width: 100%;
}
}
/*--------------------------menu---------------------------------*/
.navbar {
overflow: hidden;
background-color: #0000ff;
}
.navbar a {
float: left;
display: block;
color: white;
text-align: center;
padding: 14px 14px;
text-decoration: none;
font-size: 17px;
height:18px;
}
.active {
background-color: #0033CC;
color: white;
}
.navbar .icon {
display: none;
}
.navbar a:hover, input:hover {
background-color: #dddddd;
color: black;
}
/* CSS for search box */
.navbar .search-box {
float: right;
position: relative;
margin-top: 3px;
padding-right: 30px;
display: flex;
}
.navbar .search-box input {
padding: 12px;
border: none;
width: 100%;
height: 100%;
padding: 10px;
}
.navbar .search-box button {
color: #999;
border: navajowhite;
padding: 10px;
}
#media screen and (max-width: 600px) {
.navbar a, .navbar .search-box, .navbar .search-icon {
display: none;
}
.navbar a.icon {
float: left;
display: block;
}
}
#media screen and (max-width: 600px) {
.navbar.responsive {position:relative;}
.navbar.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
.navbar.responsive a {
float: none;
display: block;
text-align: left;
}
.navbar.responsive .search-box {
float: none;
display: flex;
width: 90%;
padding: 4%;
border: 2px solid black;
}
.navbar.responsive .search-icon{
display: flex;
}
}
/*--------------------------body------------------------*/
/* Column container */
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
}
/* Create two unequal columns that sits next to each other */
/* Sidebar/left column */
.side {
-ms-flex: 30%; /* IE10 */
flex: 30%;
background-color: #f1f1f1;
padding: 20px;
}
/* Main column */
.main {
-ms-flex: 70%; /* IE10 */
flex: 70%;
background-color: white;
padding: 20px;
}
/* Fake image, just for this example */
.fakeimg {
background-color: #aaa;
width: 100%;
padding: 20px;
}
/* Footer */
.footer {
padding: 20px;
text-align: center;
background: #ddd;
}
/* Responsive layout - when the screen is less than 700px wide, make the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 700px) {
.row {
flex-direction: column-reverse;
}
}
/* Responsive layout - when the screen is less than 400px wide, make the navigation links stack on top of each other instead of next to each other
#media screen and (max-width: 400px) {
.navbar a {
float: none;
width: 100%;
}
}*/
Footer is the issue. Remove css, which breaks navbar styles. Also meta tags should be in the header. Screenshot https://prnt.sc/1t7vjgu
I have a HTML page where there are: header, nav, article and aside.
I want the header on the top as a bar and the nav, article and aside as 3 cols. When i wrote the css I put margins and widths of nav, article and aside which sum is 100% but aside on full screen is as a third col but when i resize the screen goes to new line. I read that the problem are the whitespaces and i tried to remove them but it doesn't work. I put body to flex and it worked but it did a single row with 4 cols (header, nav, article and aside). At this point i tried with a div as a container of nav, article and aside and put it to display:flex but it doesn't work. I don't what to do anymore.
Here the code HTML & CSS
nav {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 0;
width: 20%;
background-color: #f1f1f1;
float: left;
overflow: auto;
border-radius: 15px;
}
article {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 15px;
width: 52.5%;
background-color: #f1f1f1;
float: left;
overflow: auto;
border-radius: 5px;
}
aside {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 15px;
width: 20%;
background-color: #f1f1f1;
float: right;
overflow: auto;
border-radius: 5px;
}
<nav>
<a class="active" href="index.html">Homepage</a>
</nav>
<article>
<h1>Hai bisogno di ripetizioni?</h1>
<h2>Controlla subito le disponibilità qui sotto:</h2>
<div id="listAvailable"></div>
</article>
<aside>
Filtra le disponibilià:<br>
Data<br>
<div class="filter" id="days"></div>
Materia<br>
<div class="filter" id="subjects"></div>
<button onclick="filterAvailable()">Filtra</button>
</aside>
EDIT: The answer below is the right solution, if it doesn't work immediately try to delete cache and history because it was the reason why it didn't worked when i tried before to make the post. Anyway i had to add height: 100%; in aside and nav to make them wrap their content, otherwise their height would match the height of the div.flex (that is quite annoying).
EDIT2: There were other css code that make the site responsive, with this solution it doesn't work. The full css code is:
body {
background-image: url(../img/bg.gif);
margin: 0;
padding: 0;
}
header {
margin-bottom: 15px;
padding: 20px 10px;
background-image: url(../img/header2.gif);
overflow: hidden;
}
nav {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 0;
width: 20%;
background-color: #f1f1f1;
float: left;
overflow: auto;
border-radius: 15px;
height: 100%;
}
article {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 15px;
width: 52.5%;
background-color: #f1f1f1;
float: left;
overflow: auto;
border-radius: 5px;
}
aside {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 15px;
width: 20%;
background-color: #f1f1f1;
float: right;
overflow: auto;
border-radius: 5px;
height: 100%;
}
.flex{
display:flex;
}
header img.logo {
font-size: 25px;
font-weight: bold;
}
#formLogin {
float: right;
}
nav a {
display: block;
color: black;
padding: 16px;
text-decoration: none;
text-align: center;
}
nav a.active {
background-color: #00bff0;
color: white;
}
nav a:hover:not(.active) {
background-color: #555;
color: white;
}
/* Add media queries for responsiveness*/
#media screen and (max-width: 700px) {
article {
margin-top: 20px;
min-width: 550px;
}
nav {
align-items: center;
width: 100%;
height: auto;
position: relative;
}
nav a{
text-align: center;
height: auto;
float: left;
}
}
#media screen and (max-width: 500px) {
header {
align-items: center;
}
#formLogin {
float: none;
}
}
#media screen and (max-width: 400px) {
nav a {
text-align: center;
float: none;
}
}
To make the css still responsive you have to add this CSS code in the largest #media (the smaller ones will inherit it):
.flex {
display: block;
}
I hope this edit can helps someone in the future
if this is not answer, please show what you want to with picture.
nav {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 0;
width: 20%;
background-color: #f1f1f1;
float: left;
overflow: auto;
border-radius: 15px;
}
article {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 15px;
width: 52.5%;
background-color: #f1f1f1;
float: left;
overflow: auto;
border-radius: 5px;
}
aside {
margin-left: 0.5%;
margin-right: 0.5%;
padding: 15px;
width: 20%;
background-color: #f1f1f1;
float: right;
overflow: auto;
border-radius: 5px;
}
.flex{
display:flex;
}
<div class="flex">
<nav>
<a class="active" href="index.html">Homepage</a>
</nav>
<article>
<h1>Hai bisogno di ripetizioni?</h1>
<h2>Controlla subito le disponibilità qui sotto:</h2>
<div id="listAvailable"></div>
</article>
<aside>
Filtra le disponibilià:<br>
Data<br>
<div class="filter" id="days"></div>
Materia<br>
<div class="filter" id="subjects"></div>
<button onclick="filterAvailable()">Filtra</button>
</aside>
</div>
I have been working on a responsive web design, after adding CSS to make a link stay centered on a an image the webpage now displays any new html behind the image. I want to be able to add more things on my webpage but any new html I write disappears.
Link to JSFIDDLEhttps://jsfiddle.net/R4bbit2k17/7yuL4y1p/1/#&togetherjs=MEzytpw3kf`
Because your .banner-inner is using position: absolute in conjunction with taking up 100% of the width and height, you'll need to set a position other than static for your text element(s), along with giving them a z-index greater than the default of 0:
p {
background: red; /* Purely to highlight the text */
position: relative;
z-index: 1;
}
This causes your text to appear on top of your image, and can be seen in the following:
body {
font-family: helvetica;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #f4f4f4;
}
header {
background: black;
color: white;
padding-top: 20px;
min-height: 45px;
}
header a {
color: white;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
header ul {
margin: 0;
padding: 0;
}
header li {
float: left;
display: inline;
padding: 0 20px 0 20px;
}
header nav {
float: right;
margin-top: 5px;
}
#media only screen and (max-width:1000px) {
.centered {
font-size: 12pt!important;
}
}
#media only screen and (max-width:800px) {
.centered {
font-size: 11pt!important;
}
}
#media only screen and (max-width:600px) {
.centered {
font-size: 10pt!important;
}
}
#media only screen and (max-width:400px) {
.centered {
font-size: 9pt!important;
}
}
#media only screen and (max-width:200px) {
.centered {
font-size: 8pt!important;
}
}
.banner-inner {
width: 100%;
height: 100%;
position: absolute;
text-align: center;
color: white;
}
.centered {
position: absolute;
margin-left: auto;
margin-right: auto;
width: 100%;
height: auto;
margin-top: 20%;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-size: 12pt;
}
.img {
width: 100%;
height: auto;
float: left;
}
p {
background: red;
position: relative;
z-index: 1;
}
<body>
<header>
<div id="header-inner">
<nav>
<ul>
<li>Home</li>
<li>Courses</li>
<li>About</li>
</ul>
</nav>
</div>
</header>
<section class="section-1">
<div class="banner-inner">
<img class="img" alt="" src="https://d2mt0dng9y3p4j.cloudfront.net/newandimproved/wp-content/uploads/2016/12/shop-with-a-sheriff-mockup.jpg">
<div class="centered">Start Learning</div>
</div>
</section>
<p>ANY HTML ADDED APPEARS BEHIND THE IMAGE AND I CANNOT FIGURE OUT HOW TO CHANGE IT TO APPEAR BENEATH THE IMAGE AS IT WOULD WITH A FRESH HTML PAGE</p>
</body>
Hope this helps!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want it to have a header at the top which spans the width of the page, a main content part which has side bars either side and then a footer underneath. Unfortunately I am not very good when it comes to fixed, relative absolute and the measurements etc. so it is really appreciative.
I did use some of the code from here: How to make a page with header and left-sidebar?
But I edited it so the measurements were done in em not px as it makes it more scalable on devices.
Here is my current HTML layout
#import url('https://fonts.googleapis.com/css?family=Roboto');<!-- Custom Font -->
#charset "utf-8" #font-face {
font-family: 'Roboto', sans-serif;
}
/*Layout for phones and tablets e.g. iPhone 5 and iPad*/
/*webpage fades in*/
html {
animation: fadein 2s;
position: relative;
min-height: 100%;
}
/*animation*/
#keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/*main colour settings for page*/
body {
color: black;
font-family: 'Roboto';
background-color: #FFF;
margin: 0 0 100px;
padding: 25px;
}
/*Links*/
a,
a:link,
a:visited {
color: black;
text-decoration: none;
transition: 1s;
}
/*Link hovering*/
nav a:hover {
text-decoration: none;
border: solid 1px black;
border-radius: 5px;
padding: 10px;
}
/*Main heading*/
h1 {
font-size: 3em;
max-width: 100%;
max-height: 100%;
text-align: center;
position: absolute;
left: 2em;
right: 0;
top: 0;
height: 2em;
}
/*Secondary heading*/
h2 {
font-size: 2em;
max-width: 100%;
max-height: 100%;
}
/*Text*/
p {
font-size: 0.75em;
}
/*Images*/
img {
max-width: 100%;
max-height: 100%;
margin: 0 auto;
text-align: center;
display: block;
}
#logo {
float: left;
margin-left: 10px;
margin-top: 5px;
max-height: 100px;
max-width: 100px;
}
canvas {
border: solid 1px black;
}
/*Footer*/
footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
overflow: hidden;
text-align: center;
}
button {
margin-bottom: 1em;
}
/*Main Body*/
#mainContent {
position: absolute;
left: 10em;
top: 8em;
right: 0;
bottom: 1em;
text-align: center;
}
#sideBar {
position: absolute;
left: 0;
top: 8em;
right: 0;
bottom: 0;
width: 10em;
text-align: center;
padding: 2em;
border-right: solid 1px black;
max-height: 2000px;
}
#sideBar img {
max-width: 100px;
max-height: 100px;
margin-bottom: 2em;
}
/*Light Switches*/
#lightSwitchOff {
display: inline;
margin-top: 10px;
}
#lightSwitchOn {
display: inline;
margin-top: 10px;
}
/*Layout for desktop with a min-width of 1024px*/
#media only screen and (min-width: 1024px) {
p,
li {
font-size: 1.5em;
}
h1 {
font-size: 2.75em;
}
h2 {
font-size: 2.25em;
}
#enter {
max-width: 60%;
max-height: 60%;
}
}
/*Layout for desktop with a min-width of 1280px (720p HD)*/
#media only screen and (min-width: 1280px) {
li {
font-size: 1.5em;
}
h1 {
font-size: 3em;
}
h2 {
font-size: 2.25em;
}
#enter {
max-width: 50%;
max-height: 50%;
}
}
/*Layout for desktop with a min-width of 1920px (1080p HD)*/
#media only screen and (min-width: 1920px) {
p {
font-size: 1.25em;
}
#enter {
max-width: 40%;
max-height: 40%;
}
}
/*Layout for desktop with a min-width of 200px e.g. iMac*/
#media only screen and (min-width: 2000px) {
p {
font-size: 2em;
}
}
<header>
<h1>Sliding Game</h1>
</header>
<!--Closes Header -->
<div id="leftSideBar">
<!-- Left Side Bar -->
<h2>Select Image:</h2>
<img src="images/dog.jpg" alt="Image Unvailable"></img>
<img src="images/italy.jpg" alt="Image Unvailable"></img>
<h2>Select Difficulty:</h2>
<p id="easy">Easy</p>
<p id="medium">Medium</p>
<p id="hard">Hard</p>
<button>Reset</button><br>
<button>Randomise</button>
<p>Timer:</p>
<div id="timer">0</div><br>
</div>
<!-- Closes Left Side Bar -->
<div id="mainContent">
<!-- Main Body -->
<canvas id="game" width="600px" height="600px">Cavas is not available on your browser</canvas><br>
<button id="start">Start</button>
<div style="display: none">
<img id="source" src="images/italy.jpg" alt="Image Unvailable">
</div>
</div>
<!-- Closes Main Content-->
<div id="rightSideBar">
<!-- Right Side Bar -->
<h2>Leaderboard</h2>
</div>
<!-- Closes Right Side Bar -->
<footer>
Website Created by Ryan Simms <br> 16024828#stu.mmu.ac.uk <br>
</footer>
<!-- Closes Footer -->
As for centering of elements on the webpage I would like you to recommend reading the following guide: Centering in CSS: Complete guide, and you can also use Flexbox for somewhat same result: Complete guide to Flexbox.
As for the header, I've made some code for you. You should checkout Bootstrap for easy positioning of elements on the webpage. They have specific classes for Navbars fixed bottom and top. Pretty easy framework!
.header {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
position: relative;
background: #353535;
width: 100%;
height: 50px;
margin: auto;
}
.text {
display: flex;
margin: auto;
color: orange;
}
.container {
display: flex;
flex-direction: row;
justify-content: space-around;
flex-wrap: wrap;
height: 300px;
}
.div1 {
display: flex;
height: 150px;
width: 32%;
background: #353535;
margin-top: 20px;
}
.div2 {
display: flex;
position: relative;
height: 150px;
width: 32%;
background: #353535;
margin-top: 20px;
}
.div3 {
display: flex;
position: relative;
height: 150px;
width: 32%;
background: #353535;
margin-top: 20px;
}
<div class="header">
<h3 class="text">Your text here</h3>
</div>
<div class="container">
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
</div class="container">
Whats the best way to get the footer im trying to make always stick to the bottom of the page no matter how much or how little text it on the page. I have tried several different ideas but with the new bootstrap it doesn't want to cooperate. I have tried fixed and it is not what I'm wanting.
Im wanting the bottom black footer bar to always align to the bottom of the page.
My CSS:
/* Chrome Frame Prompt
-------------------------------------------------- */
.chromeframe{ margin: .2em 0; background: #ECCC5B; color: #000000; margin-top: -55px; margin-bottom: 55px; padding: .2em 0; z-index: -100 ; text-align :center; }
/* Bootstrap Styles
-------------------------------------------------- */
.navbar-inverse { background-color: #3A3A3A; border-color: #3A3A3A; }
.navbar-inverse .navbar-brand { color: #BE1E2D; font-weight: bold; margin-top: 12px; padding-left: 40px; }
.navbar-inverse .navbar-toggle { margin-top: 20px; }
.navbar-inverse .navbar-nav>li>a { color: #FFFFFF; height: 75px; padding-top: 28px; }
.navbar-inverse .navbar-nav>li>a:hover { color: #BE1E2D; }
.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover, .navbar-inverse .navbar-nav>.open>a:focus { color: #BE1E2D; }
.dropdown-menu { background-color: #080808; border: none; border-radius: 0; -webkit-box-shadow: none; box-shadow: none; }
.dropdown-menu>li>a { line-height: 1.6; color: #FFFFFF; }
.dropdown-menu>li>a:hover { line-height: 1.6; color: #BE1E2D; }
/* Main Styles
-------------------------------------------------- */
html, body { position: relative; min-height: 100%; }
body { -webkit-font-smoothing: antialiased; font: normal 16px/1.5; color: #232525; padding-top: 50px; padding-bottom: 20px; }
.logo { float: left; }
.logo:hover { }
.main-container { padding-bottom: 100px; }
.main-row { padding-top: 15px; }
.footer { position: absolute; color: #999999; background-color: #000000; bottom: 0; width: 100%; height: 100px; }
.logo-footer { float: left; margin-top: 13px; }
.footer-nav { color: #999999; display: block; float: left; margin: 40px 0 0 15px; }
.footer-copy { float: right; margin: 40px 0 0 0; text-align: left; }
/* RESPONSIVE CSS
--------------------------------------------------*/
#media (max-width:1150px) {
}
#media (max-width:900px) {
}
#media (max-width:767px) {
.navbar-inverse .navbar-nav>li>a { height: 40px; padding-top: 11px; }
.footer-copy { float: none; text-align: center; }
}
#media (max-width:340px) {
}
A solution is to ensure your content is always at least the height of the screen, this will cause the footer to be pushed to the bottom of the screen if the window is large enough.
Wrap your page content (excluding footer) in another <div> and in its style, set min-height to 100%
The downside of this is that the footer now hangs off the window constantly, to fix that, allow the footer to "sink" back up into the content by setting margin-bottom to negative the size of the footer (i.e if your footer is 50px, margin-bottom: -50px).
Another quirk you'll find after that is the footer may overlap the page content, to fix that, insert an element into the wrapper div from earlier and make its height that of the footer.
For example:
body, html {
height: 100%;
margin: 0;
}
.wrapper {
min-height: 100%;
margin-bottom: -50px;
}
.push {
height: 50px;
}
.footer-pad {
height: 50px;
}
<div class="wrapper">
<div class="container>
Some content
</div>
<div class="footer-pad"></div>
</div>
<div class="footer">Footer</div>
A couple of important things to note are the html, body must be set to 100% height, and the body must have no margin or you'll get a constant scrollbar
http://jsfiddle.net/XJDLk/
I used this in my recent boostrap site. Hope it helps.
HTML
<div class="footer_wrapper">
<div class="container">
<div class="col-md-3 col-sm-3">
content
</div>
<div class="col-md-3 col-sm-3">
content
</div>
<div class="col-md-3 col-sm-3">
content
</div>
<div class="col-md-3 col-sm-3">
content
</div>
</div>
</div>
css
.footer_wrapper {
min-height: 270px;
background-color: #232323;
color: #8f8f8f;
bottom: 0;
padding-top: 0px;
width: 100%;
}