I have two divs floating next to each other: one has large headline text, and the other has a photo with a caption. The goal is to have the headline text vertically centered regardless of what the div height ends up being.
I've tried several methods to achieve this, but it's being pretty stubborn. I've included my code in the following codepen as reference:
http://codepen.io/ckatz/pen/KaBNxm
HTML:
<div class="container_16">
<div class="grid_8 headline">
<span class="gold"><strong>We have a special way of helping</strong>/span><br> each individual find their success.</p>
</div>
<div class="grid_8">
<div>
<div class="wp-caption alignnone" style="width: 100%">
<img src="http://placehold.it/500x500" alt="" width="100%" height="auto">
<p class="wp-caption-text">photo caption</p>
</div>
</div>
</div>
CSS:
.container_16 {
width: 90%;
}
.container_16 .grid_8 {
width: 47%;
display: inline;
float: left;
position: relative;
margin-left: 10px;
margin-right: 10px;
}
p.wp-caption-text {
text-align: center;
font-weight: bold;
font-style: normal;
margin: 1em;
padding: 0 0 1em 0;
}
I use this method below. Let your container get it's height from the image, and then vertically center the text.
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
You can use flexbox and align-self on the child container. Try adding these styles:
.container_16 {
display: flex;
width: 90%;
}
.headline {
align-self: center;
}
You can apply the following CSS to get the text vertically aligned.
.gold {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
This will keep it aligned regardless of the div height.
Instead float, use display:(inline-block,table,table-cell, flex) + vertical-align or margin :
inline-block + vertical-align
#import url('https://fonts.googleapis.com/css?family=Montserrat');
body {
font-family: 'Montserrat', Arial, Helvetica, sans-serif;
font-weight: normal;
}
p {
font-size: 1em;
line-height: 1.4em;
}
.container_16 {
width: 90%;
}
.container_16 .grid_8 {
width: 47%;
display: inline-block;
vertical-align:middle;
position: relative;
}
.headline {
font-size: 3em;
}
.gold {
color: #ffb500;
}
p.wp-caption-text {
text-align: center;
font-weight: bold;
font-style: normal;
margin: 1em;
padding: 0 0 1em 0;
}
<div class="container_16">
<div class="grid_8 headline">
<p>
<span class="gold">
<strong>We have a special way of helping</strong>
</span>
<br> each individual find their success.
</p>
</div>
<div class="grid_8">
<div>
<div class="wp-caption alignnone" style="width: 100%px">
<img src="http://placehold.it/500x500" alt="" width="100%" height="auto">
<p class="wp-caption-text">This is a caption for the photo here.</p>
</div>
</div>
</div>
display:table-cell and vertical-align
#import url('https://fonts.googleapis.com/css?family=Montserrat');
body {
font-family: 'Montserrat', Arial, Helvetica, sans-serif;
font-weight: normal;
}
p {
font-size: 1em;
line-height: 1.4em;
}
.container_16 {
width: 90%;
display:table;
table-layout:fixed;
}
.container_16 .grid_8 {
width: 47%;
display: table-cell;
vertical-align: middle;
position: relative;
padding-left: 10px;
padding-right: 10px;
}
.headline {
font-size: 3em;
}
.gold {
color: #ffb500;
}
p.wp-caption-text {
text-align: center;
font-weight: bold;
font-style: normal;
margin: 1em;
padding: 0 0 1em 0;
}
<div class="container_16">
<div class="grid_8 headline">
<p>
<span class="gold"><strong>We have a special way of helping</strong></span>
<br>each individual find their success.
</p>
</div>
<div class="grid_8">
<div>
<div class="wp-caption alignnone" style="width: 100%px">
<img src="http://placehold.it/500x500" alt="" width="100%" height="auto">
<p class="wp-caption-text">This is a caption for the photo here.</p>
</div>
</div>
</div>
display:flex and margin:auto 0;
#import url('https://fonts.googleapis.com/css?family=Montserrat');
body {
font-family: 'Montserrat', Arial, Helvetica, sans-serif;
font-weight: normal;
}
p {
font-size: 1em;
line-height: 1.4em;
}
.container_16 {
width: 90%;
display:flex;
}
.container_16 .grid_8 {
width: 47%;
margin:auto 0;
position: relative;
margin-left: 10px;
margin-right: 10px;
}
.headline {
font-size: 3em;
}
.gold {
color: #ffb500;
}
p.wp-caption-text {
text-align: center;
font-weight: bold;
font-style: normal;
margin: 1em;
padding: 0 0 1em 0;
}
<div class="container_16">
<div class="grid_8 headline">
<p>
<span class="gold">
<strong>We have a special way of helping</strong>
</span>
<br> each individual find their success.
</p>
</div>
<div class="grid_8">
<div>
<div class="wp-caption alignnone" style="width: 100%px">
<img src="http://placehold.it/500x500" alt="" width="100%" height="auto">
<p class="wp-caption-text">This is a caption for the photo here.</p>
</div>
</div>
</div>
Simple solution using display: table-cell; adapted from this CSS Tricks article: Vertically Center Multi-Lined Text
<div class="parent">
<p>Multi <br>line</p>
</div>
.parent {
display: table;
}
.parent p {
display: table-cell;
vertical-align: middle;
}
Demo on JS Bin
Related
I am making my first webpage and I have the elements I want- I can't seem to get them to center on the page. I have tried margin: auto, text-align: center, and lots of toher things. Nothing has worked.
I want the header, an image , and a button at the end of my page, to be a central spine down my page. Any suggestions would be appreciated.
Thanks
Here is my code:
HTML:
<div class="container">
<h1 class="text-center"> My tribute to Ami Coxill Moore</h1>
</div>
<!-- picture of ami here -->
<div class="container">
<div class="row">
<div class="col-xs-4 col-xs-offset-4"></div>
<img class="img-resize img-center img-zero image-border img-responsive" src="https://i.imgur.com/Lc5nBon.jpg" alt="Ami laughing at her 26th Birthday">
</div>
</div>
CSS
body {margin-top: 100px;
background-color: #ff69b4;
font-family: "gerogia", serif;
color: #0000ff; }
h1 {
display: inline-block;
background-color: yellow;
font-size: 300%;
border: solid;
border-radius: 25px;
align: center;
padding-left: 40px;
padding-right: 40px;
float: center;
max width: 100%;
text-align: center;
marrgin: 0 auto;
float: center;}
div {
padding-bottom: 20px;
padding-right: 50px;
padding-left: 50px;}
.img-responsive {
margin: 0 auto;}
.img-resize {
max-width: 400px;
max-height: auto;}
you need to add the container text-align
<div class="container" style="text-align: center;">
the div that wraps your element is the responsible to align the element.
Define a class and call it for example .text-center and put inside it text-align: center,
once you want to center a text just give this class to the container element (parent element).
Hope this solve your issue.
body {margin-top: 100px;
background-color: #ff69b4;
font-family: "gerogia", serif;
color: #0000ff; }
.text-center {
text-align: center;
}
h1 {
display: inline-block;
background-color: yellow;
font-size: 300%;
border: solid;
border-radius: 25px;
padding-left: 40px;
padding-right: 40px;
max width: 100%;}
div {
padding-bottom: 20px;
padding-right: 50px;
padding-left: 50px;}
.img-resize {
max-width: 400px;
max-height: auto;}
<div class="container text-center">
<h1> My tribute to Ami Coxill Moore</h1>
</div>
<!-- picture of ami here -->
<div class="container text-center">
<div class="row">
<div class="col-xs-4 col-xs-offset-4"></div>
<img class="img-resize img-center img-zero image-border img-responsive" src="https://i.imgur.com/Lc5nBon.jpg" alt="Ami laughing at her 26th Birthday">
</div>
</div>
There are some mistake in your code, for example, you must use of max-width: 100%; no max width: 100%; or text-align: center; no align: center; value for float is left or right so float:center is wrong, and other mistakes.
see my code:
body {
margin-top: 100px;
background-color: #ff69b4;
font-family: "gerogia", serif;
color: #0000ff;
}
h1 {
background-color: yellow;
font-size: 300%;
border: 1px solid;
border-radius: 25px;
text-align: center;
padding-left: 40px;
padding-right: 40px;
max-width: 100%;
text-align: center;
margin: 0 auto;
}
div {
padding-bottom: 20px;
padding-right: 50px;
padding-left: 50px;
}
.row {
text-align: center;
}
.row img {
display: inline-block;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="container">
<h1 class="text-center"> My tribute to Ami Coxill Moore</h1>
</div>
<div class="container">
<div class="row">
<a href="#add-fastrack"><img class="img-resize img-center img-zero image-border img-responsive" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRDAYrQr9qgT2W00EV_CoCahFki3Vw4lSMNt81k9FCSTXoKT8TY2w" alt="Ami laughing at her 26th Birthday">
</a>
</div>
</div>
I am trying to have a three column section that has three different divs, each containing an h2 and a p element. I want to make the left when align right, the middle one align center and the right one align left. I achieved this using nth-of-type however I can't figure out how to get them in the right position so that everything lines up with each other.
body {
background-color: #EAE8EB;
}
wrap {
margin: auto;
}
#topbar {
width: 105%;
height: 50px;
background-color: #000;
margin-left: -2.5%;
margin-top: -10px;
}
#jumbotron {
width: 105%;
margin-left: -2.5%;
height: 900px;
background-repeat: no-repeat;
background-size: cover;
background-image: url('http://www.arcanemarketing.com/wp-content/uploads/2013/05/placeholder.png');
}
#recent {
margin: auto;
background-color: #3C5F7C;
width: 105%;
margin-left: -2.5%;
height: 250px;
margin-top: -20px;
}
#recent h1 {
text-align: center;
font-family: 'Alegreya Sans SC', sans-serif;
font-size: 38px;
font-weight: 700;
padding-top: 10px;
color: #EEF0F2;
}
#galleries {
width: 105%;
margin-left: -2.5%;
height: 250px;
background-color: #3c5f7c;
}
#galleries h2 {
font-size: 32px;
font-family: 'Alegreya Sans SC', sans-serif;
font-weight: 500;
color: #EEF0F2;
}
#galleries div:nth-of-type(1) h2 {
text-align: right;
}
#galleries div:nth-of-type(2) h2 {
text-align: center;
}
#galleries div:nth-of-type(3) h2 {
text-align: left;
}
#galleries p {
font-size: 18px;
font-family: 'Catamaran', sans-serif;
font-weight: 300;
color: #eef0f2;
max-width: 360px;
}
#galleries div:nth-of-type(1) p {
text-align: right;
margin: auto;
}
#galleries div:nth-of-type(2) p {
text-align: center;
margin: auto;
}
#galleries div:nth-of-type(3) p {
text-align: left;
margin: auto;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Alegreya+Sans+SC:400,500,700,300' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Catamaran:400,300,500' rel='stylesheet' type='text/css'>
<div id="wrap">
<div id="topbar">
</div>
<div id="menu">
</div>
<div id="logo">
</div>
<div id="jumbotron">
</div>
<div id="recent">
<h1>Recent Work</h1>
<div id="thumbnail"></div>
</div>
<div id="galleries">
<div class="row">
<div class="col-md-4">
<h2>Website Design</h2>
<p>Extensive experience with image editing software, html and css code, and a unique perspective of an IT major formerly in graphic design.</p>
</div>
<div class="col-md-4">
<h2>Software Engineering</h2>
<p>Information Technology second-semester Sophomore at State University of New York at Cobleskill. Passion for solving problems with logic and code.</p>
</div>
<div class="col-md-4">
<h2>Other Work</h2>
<p>Former graphic artist with a background in a hobbyist form of art known as forum signatures.</p>
</div>
</div>
</div>
<div id="sn">
</div>
</div>
Also I'm not sure how to get bootstrap to work in jsfiddle sorry :(
https://jsfiddle.net/5bep97xw/
The nth-child idea is the good one. but looks like you need to update the mediaqueries too and what is this 105% width ?
body {
background-color: #EAE8EB;
}
wrap {
margin: auto;
}
#topbar {
/* width: 105%; why ? */
height: 50px;
background-color: #000;
margin-left: -2.5%;
margin-top: -10px;
}
#jumbotron {
/* width: 105%;
margin-left: -2.5%;
height: 900px; why ? */
background-repeat: no-repeat;
background-size: cover;
background-image: url('http://www.arcanemarketing.com/wp-content/uploads/2013/05/placeholder.png');
}
#recent {
margin: auto;
background-color: #3C5F7C;
/* width: 105%;
margin-left: -2.5%;
height: 250px; why ? */
margin-top: -20px;
}
#recent h1 {
text-align: center;
font-family: 'Alegreya Sans SC', sans-serif;
font-size: 38px;
font-weight: 700;
padding-top: 10px;
color: #EEF0F2;
}
#galleries {
/* width: 105%;
margin-left: -2.5%;
min-height: 250px; do not fix an height and not too sure about margins and width */
background-color: #3c5f7c;
}
#galleries h2 {
font-size: 32px;
font-family: 'Alegreya Sans SC', sans-serif;
font-weight: 500;
color: #EEF0F2;
}
#galleries div:nth-of-type(1) h2 {
text-align: right;
}
#galleries div:nth-of-type(2) h2 {
text-align: center;
}
#galleries div:nth-of-type(3) h2 {
text-align: left;
}
#galleries p {
font-size: 18px;
font-family: 'Catamaran', sans-serif;
font-weight: 300;
color: #eef0f2;
/* max-width: 360px; better fix a max-width on parents container ? */
padding:1em;/* might be usefull */
margin:0;/* might be usefull */
}
#galleries div:nth-of-type(1) p {
text-align: right;
margin: auto;
}
#galleries div:nth-of-type(2) p {
text-align: center;
margin: auto;
}
#galleries div:nth-of-type(3) p {
text-align: left;
margin: auto;
}
#media (max-width:990px){
div div#galleries div[class] p,
div div#galleries div[class] h2 {
text-align:center; /* or left or right */
}
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Alegreya+Sans+SC:400,500,700,300' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Catamaran:400,300,500' rel='stylesheet' type='text/css'>
<div id="wrap">
<div id="topbar">
</div>
<div id="menu">
</div>
<div id="logo">
</div>
<div id="jumbotron">
</div>
<div id="recent">
<h1>Recent Work</h1>
<div id="thumbnail"></div>
</div>
<div id="galleries">
<div class="row">
<div class="col-md-4">
<h2>Website Design</h2>
<p>Extensive experience with image editing software, html and css code, and a unique perspective of an IT major formerly in graphic design.</p>
</div>
<div class="col-md-4">
<h2>Software Engineering</h2>
<p>Information Technology second-semester Sophomore at State University of New York at Cobleskill. Passion for solving problems with logic and code.</p>
</div>
<div class="col-md-4">
<h2>Other Work</h2>
<p>Former graphic artist with a background in a hobbyist form of art known as forum signatures.</p>
</div>
</div>
</div>
<div id="sn">
</div>
</div>
I need to get the image to change onmouseenter/hover to a different image. I looked around and found a lot of rollover solutions but that won't work for me because I need to scale the image on hover as well.
Also the last image in #recent appears to be broken, hovering over the #galleries section has a link to it and i can't figure out if that is because of col-md-offset-1 or something else.
<body>
<div id="wrap">
<div id="topbar">
</div>
<div id="menu">
</div>
<div id="logo">
</div>
<div id="jumbotron">
</div>
<div id="recent">
<h1>Recent Work</h1>
<div class="col-md-2 col-md-offset-1">
<a href="http://shniper1337.github.io/firstbootstrap/">
<img src="images/firstbootstrap.png" class="img-rounded"></a>
</div>
<div class="col-md-2">
<a href="http://shniper1337.github.io/pong/">
<img src="images/pong.png" class="img-rounded"></a>
</div>
<div class="col-md-2">
<a href="http://shniper1337.deviantart.com/art/Photomontage-490696483">
<img src="images/design.png" class="img-rounded"></a>
</div>
<div class="col-md-2">
<a href="http://shniper1337.deviantart.com/art/Website-design-WIP-571887134">
<img src="images/survivingearth.png" class="img-rounded">
</div>
<div class="col-md-2">
<a href="http://shniper1337.deviantart.com/art/Old-Law-Firm-545208961">
<img src="images/lawfirm.png" class="img-rounded">
</div>
</div>
<div id="galleries">
<div class="row">
<div class="col-md-4">
<h2>Website Design</h2>
<p>Extensive experience with image editing software, html and css code, and a unique perspective of an IT major formerly in graphic design.</p>
</div>
<div class="col-md-4">
<h2>Software Engineering</h2>
<p>Information Technology second-semester Sophomore at State University of New York at Cobleskill. Passion for solving problems with logic and code.</p>
</div>
<div class="col-md-4">
<h2>Other Work</h2>
<p>Former graphic artist with a background in a hobbyist form of art known as forum signatures.</p>
</div>
</div>
</div>
<div id="sn">
</div>
<div id="footer">
</div>
</div>
</body>
body {
background-color: #EAE8EB;
}
wrap {
margin: auto;
}
#topbar {
width: 100%;
height: 50px;
background-color: #000;
margin-top: -10px;
}
#jumbotron {
width: 100%;
height: 750px;
background-repeat: no-repeat;
background-size: cover;
background-image: url('http://www.arcanemarketing.com/wp-content/uploads/2013/05/placeholder.png');
}
#recent {
margin: auto;
background-color: #3C5F7C;
width: 100%;
height: 250px;
margin-top: -20px;
}
#recent h1 {
text-align: center;
font-family: 'Alegreya Sans SC', sans-serif;
font-size: 38px;
font-weight: 700;
padding-top: 10px;
color: #EEF0F2;
}
#recent img {
height: 155px;
box-shadow: 5px 5px 5px #111111;
margin-top: 10px;
position: relative;
}
#galleries {
background-color: #3c5f7c;
height: 200px;
}
.col-md-4 {
max-width: 27%;
margin-left: 3%;
}
.row {
margin-left: 6%;
}
#recent div:nth-of-type(1) img:hover {
background-image: url("images/firstbootstrapfull.png");
z-index: 1;
position: relative;
}
#recent div:nth-of-type(2) img:hover {
}
#recent div:nth-of-type(3) img:hover {
}
#recent div:nth-of-type(4) img:hover {
}
#recent div:nth-of-type(5) img:hover {
}
#galleries h2 {
font-size: 32px;
font-family: 'Alegreya Sans SC', sans-serif;
font-weight: 500;
color: #EEF0F2;
}
#galleries div:nth-of-type(1) h2 {
text-align: right;
}
#galleries div:nth-of-type(2) h2 {
text-align: center;
}
#galleries div:nth-of-type(3) h2 {
text-align: left;
}
#galleries p {
font-size: 18px;
font-family: 'Catamaran', sans-serif;
font-weight: 300;
color: #eef0f2;
}
#galleries div:nth-of-type(1) p {
text-align: right;
margin: auto;
}
#galleries div:nth-of-type(2) p {
text-align: center;
margin: auto;
}
#galleries div:nth-of-type(3) p {
text-align: left;
margin: auto;
}
#footer {
width: 100%;
height: 20px;
background-color: #000;
}
Here is a jsfiddle that appears to be broken
Solving this with css is preferred but not necessary.
You could add in something like this to your CSS
#randomDiv {
background-image: url('image.png');
height: 70px;
width: 120px;
}
#randomDiv:hover {
background-image: url('differenthoverimage.png');
width: 50px; // or whatever width you want
height: 50px; // or whatever height you want
}
And that should change the image and height/width.
(make sure to add a different id for each image you want to do this and set it in the HTML)
I'm trying to align several DIVS, Images and text and I can't figure this out..
Here's what I'm trying to achieve:
Heres' my HTML
<div class="section5">
<div class="outer">
<div class="container1">
<img src="icon.png" width="85">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
<div class="container2">
<img src="iphone.png" width="375">
<div class="subtitle2">Text</div>
</div>
</div>
</div>
Here is my CSS:
.section5{ height: 525px; background-color: #5e6172; text-align: center; position: relative;}
.outer{ width: 80%; background-color: #45da45; height: 100%; margin: 0 auto; position: relative;}
.title1{color: #ffffff; font-size: 2.6em; font-family: h35; }
.subtitle1{color: #ffffff; font-size: 1.5em; font-family: h35; margin-top: 0.25em; }
.subtitle2{color: #ffffff; font-size: 1.5em; font-family: h35; margin-top: 0.25em; }
.container1{display: block; background-color: #ccc; }
.container2{display: block; background-color: #fffc1e; }
Here is the JSFIDDLE:
http://jsfiddle.net/mib92/hogwohf8/
My current problems:
1) My text at the bottom needs to be on the right side of the image.. center like in my example image.
2) the bottom of my bottom picture must be align to the bottom of container2 AND the bottom of section5
3) While doing this, the container 1 must remain in the vertical middle of the remaining space of the section5.
Thank you
I hops it's help you.
.section5 {
height: 525px;
background-color: #5e6172;
text-align: center;
position: relative;
}
.outer {
width: 80%;
background-color: #45da45;
height: 100%;
margin: 0 auto;
position: relative;
}
.title1 {
color: #ffffff;
font-size: 2.6em;
font-family: h35;
}
.subtitle1 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.subtitle2 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.container1 {
display: block;
background-color: #ccc;
}
.container2 {
display: block;
background-color: #fffc1e;
}
.right-sied {
display: inline-block;
vertical-align: top;
width: 41%;
}
.left-sied {
display: inline-block;
width: 49%;
}
.left-sied img {
max-width: 100%;
}
<div class="section5">
<div class="outer">
<div class="container1">
<img src="icon.png" width="85">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
<div class="container2">
<div class="left-sied">
<img src="iphone.png" width="375">
</div>
<div class="right-sied">
<div class="subtitle2">Text</div>
</div>
</div>
</div>
</div>
Live Demo
check this:
.section5 {
height: 525px;
background-color: #5e6172;
text-align: center;
position: relative;
}
.outer {
width: 80%;
background-color: #45da45;
height: 100%;
margin: 0 auto;
position: relative;
}
.title1 {
color: #ffffff;
font-size: 2.6em;
font-family: h35;
}
.subtitle1 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.subtitle2 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.container1 {
display: block;
background-color: #ccc;
}
.container2 {
display: block;
background-color: #fffc1e;
}
.container1 .wrapper {
display: inline-block;
float: right;
}
.container2 img {
margin: 0 auto;
}
<div class="section5">
<div class="outer">
<div class="container1">
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg" width="85">
<div class="wrapper">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
</div>
<div class="container2">
<div class="subtitle2">Text</div>
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg" width="375">
</div>
</div>
</div>
I'm folowing this tutorial for making a footer but the result is not as expected:
My html and css are in this JSFiddle
or below:
<body>
<div class="wrapper">
<div id="container">
<div id="header">
<div class="wrap">
<div id="menuProfile">
<div id="logotext">K-Panel • Kerio Tools Management</div>
</div>
</div>
</div>
<div class="fix"></div>
<div id="subheader">
<div id="submenu" class="wrap">
<div id="logocliente">
<a href="<?php echo $this->baseUrl(); ?>/"><img height="50"
id="logoIscrittoTestata"
src="<?php echo $this->baseUrl(); ?>/KPanel_logo_2014_58x224.png"></a>
</div>
</div>
</div>
<div class="fix separatore"></div>
<div id="page">
<div id="right">
</div>
</div>
<div id="push"></div></div>
<div id="footer">
<strong>Freelands</strong> > Via Emilia Ponente, 479, 40132 Bologna (Italy) > Tel +39 051 7402558 > Fax +39 051 729153 > C.F. e P.IVA 03236491209 > <a
id="footerEmailAzienda" href="mailto:info#freelands.it">info#freelands.it</a>
</div>
CSS:
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td
{
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: middle;
background: transparent;
}
body {
font-family: Helvetica, Verdana, Arial, Tahoma;
font-size: 11px;
line-height: 1;
text-align: center;
color: #404040;
}
html,body {
height: 100%;
margin: 0px;
}
#container {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -50px;
}
#footer {
background-color: #0082C0;
color: #FFFFFF;
padding-top: 15px;
}
* {
margin: 0;
}
body, html {
width: 100%;
height: 100%;
font-size: 16px;
font-family: calibri, gill sans, arial;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -35px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 35px; /* .push must be the same height as .footer */
}
#footer{
font-size: 12px;
font-family: calibri, gill sans, arial;
color: black;
text-align: center;
width: 100%;
}
#header{
display:block;
clear:both;
margin-top:20px;
}
You need to add a position:fixed; to the footer to stay it fixed. To make it stay at the bottom, add a bottom:0;
WORKING DEMO
The Code change:
#footer{
font-size: 12px;
font-family: calibri, gill sans, arial;
color: black;
text-align: center;
width: 100%;
position:fixed;
bottom:0px;
}
Hope this helps.
For stick you footer at the bottom you need to make it position:fixed bottom:0; and add margin-top:(height of your footer);
#footer {
background-color: #0082C0;
color: #FFFFFF;
padding-top: 15px;
position:fixed;
bottom:0;
margin-top:30px; /* height of the footer */
}
JsFiddle