Extra space above footer - html

I previously had an issue with floating 3 divs in my footer area which got resolved here by re-ordering the divs and adding an 'overflow:hidden' to my enclosing footer div. Now though I seem to have an extra space (like an extra return) coming between the preceding div and my footer. Just wondering what would be causing this - I had previously set a top margin of 10px to my footer div. Have now removed this but still a large extra space. Ideally I want to set the space (height) to 1opx.
Thanks for any suggestions. Here's the html...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>K Blondel Design :: Carpentry & Funiture Design :: Brighton</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="oneColFixCtr.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Abel|Cutive+Mono|Nothing+You+Could+Do' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<div class="subcontainer">
<div class="header">
<div id="mainNav">
<ul id="mainNav">
<li>Home</li>
<li>About Us</li>
<li>Our Work </li>
<li>Contact Us </li>
</ul>
</div>
<div class="contact">
E : click here
<br />
T : 07585 607521
</div>
</div>
<div class="lineborder">
</div>
<div class="sidebar-logo"><img src="Images/k-blondel-design-logo.png" width="64" height="108" alt="K Blondel Design logo" />
</div>
<div id="contentright">
<div class="galleryimg"><div class="photo"><img src="Images/winebar-furniture-01.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
<div class="galleryimg"><div class="photo"><img src="Images/wooden-outdoor-seating.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
<div class="galleryimg"><div class="photo"><img src="Images/wooden-shelving.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
<div class="galleryimg"><div class="photo"><img src="Images/wooden-winerack.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
</div>
<div id="content">
<h1>Instructions </h1>
<p>At K Blondel Design we aim to fill the gap between the over exuberant furniture maker and the general carpenter. Trained in the art of creating affordable and elegant solutions to 3D problems.</p>
<p>As a small business we are able to deliver a personal one to one design service, talking through various design and material possibilities and arriving at an affordable, bespoke and stylish solution.</p>
<p>From design through to construction and installation we specialise in storage solutions, furniture and interiors for both the domestic and commercial markets. </p>
<p>Based in Brighton we have 20 years' design and commercial experience and an ever-growing client list spanning Sussex, Hampshire, London and Kent.</p>
<!-- end .content -->
</div>
<div class="lineborder"></div>
<div id="footer">
<div class="footercolleft">
Carpentry<br/>
Furniture Design<br/>
Interior Design & Decoration
</div>
<div class="footercoladdress">
Copyright © 2014 Kevin Blondel Design<br />1 Park Terrace, Brighton BN1 0GT
</div>
<div class="footercolright">
Storage Solutions<br/>
Decking & Wooden Flooring<br/>
Shop Fitting / Commercial Interiors
</div>
</div>
<!-- end .subcontainer --></div>
<!-- end .container --></div>
</body>
</html>
and the css...
#charset "UTF-8";
body {
font: 100%/1.4;
background-color:#FFF;
margin: 0;
padding: 0;
color: #000;
}
/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 10px;
padding-left: 40px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
h1 {
font-family: 'Abel', Arial, sans-serif;
font-size:24px;
font-weight: normal;
}
h2 {
font-family: 'Abel', Arial, sans-serif;
font-size:18px;
}
p {
font-family: 'Cutive Mono', Georgia, serif;
font-size:13px;
line-height:1.4em;
font-weight:600;
}
#home #homelink,
#aboutus #aboutuslink,
#ourwork #ourworklink,
#contactus #contactuslink {
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:17px;
text-decoration:none;
border-bottom: solid 6px #494949;
}
#mainNav {
margin: 0;
padding: 0;
list-style: none;
}
#mainNav li {
float: left;
padding: 50px 14px 0 14px;
}
#mainNav a {
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:17px;
text-decoration:none;
padding: 0 20px 0 20px;
}
#mainNav a:hover {
color:#FFF;
background-color: #494949;
}
img {
border: none;
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color: #494949;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #494949;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}
/* ~~ this fixed width container surrounds all other elements ~~ */
.container {
width: 1352px;
background-image:url(Images/sktchbook-bgd.jpg);
background-repeat:no-repeat;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
}
.header {
width: 950px;
height: 72px;
margin-left:90px;
margin-right: 90px;
}
.header img{
border:none;
}
.lineborder {
width: 950px;
background-color:#494949;
height: 1px;
margin-left:110px;
margin-right:110px;
}
.contact {
float: right;
padding: 27px 0 0 0;
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:17px;
}
.sidebar-logo {
float: left;
width: 70px;
}
.subcontainer {
width: 1150px;
min-height: 880px;
margin: 0 auto;
/* the auto value on the sides, coupled with the width, centers the layout */
}
/* ~~ This is the layout information. ~~
1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
*/
#content {
padding: 40px 0;
width: 420px;
margin-left:90px;
margin-right:90px;
min-height:475px;
}
#contentright {
float: right;
padding: 40px 0;
width: 420px;
margin-right:90px;
}
.galleryimg {
display: inline-block;
vertical-align: top;
margin: 0 40px 30px 0;
}
.photo {
-moz-box-shadow: 2px 2px 2px 0px #888;
-webkit-box-shadow: 2px 2px 2px 0px #888;
box-shadow: 2px 2px 2px 0px #888;
}
.photo img {
border: 10px solid #fff;
background-color: #fff;
position: relative;
}
/* ~~ miscellaneous float/clear classes ~~ */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the overflow:hidden on the .container is removed */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
#footer {
padding: 0 0 0 20px;
width: 950px;
height: 150px;
margin-left:90px;
margin-right: 90px;
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:14px;
line-height: 1.5em;
overflow:hidden;
}
#footer a {
text-decoration:none;
padding: 0 5px 0 5px;
}
#footer a:hover {
color:#FFF;
background-color: #494949;
}
.footercolleft {
padding: 0;
margin: 0;
float: left;
width: 200px;
overflow:hidden;
}
.footercolright {
padding: 0;
width: 200px;
overflow:hidden;
}
.footercoladdress {
float:right;
padding: 0 5px 0 5px;
text-align: right;
width:250px;
}

It's coming from the bottom padding on #contentright:
You can fix that by setting the bottom padding to 0:
#contentright {
/* Your existing styles plus...*/
padding-bottom: 0;
}
Then you can apply your 10px margin-top back to your footer:
#footer {
/* Your existing styles plus...*/
margin-top: 10px;
}
Demo

Related

Place 2 Boxes [div's] side by side

I want to place the two boxes at the bottom of link, the both article-boxes (div.content), side by side like you see, but without the big distance between them. How to fix this?
Here is relevant code :
div.content {
text-align: justify;
color: #939393;
padding: 25px 90px;
margin: 0px auto 45px;
width: 960px;
border: 2px solid #F27F0E;
}
<div class="content-small" style="float: left;">
<h2></h2>
<ol class="posts"></ol>
</div>
<div class="content-small" style="float: right;">
<h2></h2>
<ol class="posts"></ol>
</div>
Using inline styles (putting the style tag inside of the element) is never a good thing, it's best practice to keep everything in a separate stylesheet and a lot more practical too.
In regards to your question you pretty much have the code already in your stylesheet, just remove the inline styles and put the both divs inside of a parent div.
HTML:
<div class="content-bottom">
<div class="content-small"></div>
<div class="content-small"></div>
</div>
Now we just need to add a little css to center everything with your current layout.
CSS:
.content-bottom {
margin: 0 auto;
width: 1144px;
}
You're probably going to want to adjust the widths and margins for the content-small classes now to your preference.
Hope this helps!
You need to apply float left to both boxes and set your margin-right to appropriate value.
delete style from this :
<div class="content-small" style="float: left;"></div>
<div class="content-small" style="float: right;"></div>
so that they become :
<div class="content-small"></div>
<div class="content-small"></div>
and then change your css like this:
div.content-small {
text-align: justify;
color: #939393;
padding: 25px 50px;
margin: 0px auto 45px;
width: 450px;
border: 2px solid #F27F0E;
float:left; /* add this */
margin-right:40px; /* add this and change value acc */
}
You can also try placing margin on each box separately to achieve your desired result
How about adding an enclosing div around the two article boxes like below. Setting its width to 1144px matches with the total width of the content boxes above.
<div style="width: 1144px; margin: 0 auto 0 auto">
<div class="content-small" style="float: left;">
...
</div>
<div class="content-small" style="float: right;">
...
</div>
</div>
create a wrapper for these 2 div
<div class="wrapper-new" style="margin:0 auto; width:...px;">
<div class="content-small" style="float: left;">...</div>
<div class="content-small" style="float: right;">...</div>
</div>
![enter image description here][1]
This is how you need to do it. The bottom two article boxes should be inside a div with fixed width 1144px and both content-small should be float:left, 2nd one with a margin-left:36px;
That's it! Run the code snippet in Full page and you can see your desired result.
NB: I've removed jQuery from the snippet. If you find my answer useful please mark it as accepted. Thanks! :)
body {
font-family: Arial, sans-serif;
font-size: 16px;
color: #fff;
background: #1A1A1A;
}
div.content {
text-align: justify;
color: #939393;
padding: 25px 90px;
margin: 0 auto 45px auto;
width: 960px;
border: 2px solid #F27F0E;
}
div.bottom-content {
padding: 25px 0;
margin: 0 auto 45px auto;
width: 1144px;
}
div.content-small {
text-align: justify;
color: #939393;
padding: 25px 50px;
margin: 0;
width: 450px;
border: 2px solid #F27F0E;
}
a {
text-decoration: none;
color: #6B6B6B;
}
a:hover {
border-bottom: 1px dotted #F27F0E;
}
dt {
font-weight: bold;
display: block;
float: left;
width: 150px;
color: #bbb;
}
img {
border: 1px solid rgba(51, 51, 51, 0.1);
}
div.date {
width: 100px;
padding-bottom: 14px;
margin-left: -120px;
float: left;
}
div.date p {
padding: 5px 10px;
margin-bottom: 0;
text-align: right;
font-family: Arial, sans-serif;
}
div.center {
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
margin: 0 auto 45px auto;
}
.icon {
display: inline-block;
height: 64px;
width: 64px;
text-indent: -9999em;
margin: 0 1em;
}
#github {
background-color: #4183c4;
background-image: url(http://tekkkz.com/css/github.png);
}
#twitter {
background-color: #00aced;
background-image: url(http://tekkkz.com/css/twitter.png);
}
.posts,
.posts li {
list-style-type: none;
margin-left: 0;
padding-left: 0;
}
.posts li {
margin-bottom: 1em;
}
.title {
font-size: 1.2em;
}
.date {
font-style: italic;
font-size: 0.8em;
color: #bbb;
}
h1 {
font-family: Arial, sans-serif;
font-size: 3em;
font-weight: bold;
text-align: center;
color: #fff;
}
h2,
h3 {
font-family: Arial, sans-serif;
font-weight: bold;
margin: 10px 0;
color: #fff;
}
footer {
text-align: center;
font-size: 0.9em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="author" content="Martin Fischer">
<meta name="description" content="Personal Profile of Tekkkz (Martin Fischer)">
<meta name="keywords" content="pc, personal, profile, web, tekkkz, microcontroller, programming, gaming, avr, atml, s4, s4league, aeriagames, english, german">
<meta name="robots" content="FOLLOW,INDEX">
<title>Tekkkz - Personal Profile</title>
</head>
<body>
<header>
<h1>Tekkkz (Martin Fischer)</h1>
</header>
<div class="center">
Twitter
GitHub
</div>
<div class="content">
<h2>ABOUT</h2>
<dl>
<dt><img src="http://tekkkz.com/css/profile.jpg" alt="profile" height="135em" /></dt>
<dd>
<p>I am Martin Fischer, otherwise known online as Tekkkz. I am 17 years old and currently a student at the 'Winckelmann Gymnasium Stendal'.</p>
<p>My educational interests include mathematics and science, especially physics and chemistry. My extracurricular interests include everything that has to do with electronics, from simple soldering up to programming microcontrollers and develop complex
PCB's, general programming in C and C++ as well as linux and servers.</p>
<p>See my CV.</p>
</dd>
<dl>
</div>
<div class="content">
<h2>CONTACT</h2>
<dl>
<dt>Email</dt>
<dd>martin#Tekkkz.com</dd>
<dt>IRC</dt>
<dd>Tekkkz on Freenode</dd>
<dt>ICQ</dt>
<dd>ICQ Number: 612184097</dd>
</dl>
</div>
<div class="bottom-content">
<div class="content-small" style="float: left;">
<h2>ARTICLES</h2>
<ol class="posts">
<li>
“EUzebox with ATmega1284”
<span class="date">—February 06, 2015</span>
<br />
<span class="description">Instruction set to build an EUzebox with an ATmega1284</span>
</li>
</ol>
</div>
<div class="content-small" style="float: left; margin-left:36px;">
<h2>ARTICLES</h2>
<ol class="posts">
<li>
“EUzebox with ATmega1284”
<span class="date">—February 06, 2015</span>
<br />
<span class="description">Instruction set to build an EUzebox with an ATmega1284</span>
</li>
</ol>
</div>
</div>
</body>
</html>

My Website Won't Align Properly On Zoom In and Out

I'm new to creating websites and can't seem to find out why the alignment of my website doesn't work properly.
On all three of my computer monitors, the website looks fine:
http://www.spectanium.com
But I looked at it on my one friends computer and it looked wrong.
I have a main body and then space on both the right and left, but depending on the monitor I use, there has been varying space and it looks bad...
Can anyone take a look at my code and see what I'm doing wrong?
index.html -->
<html>
<head>
<title>Spectanium Studios</title>
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<body>
<div id="header">
</div>
<div id="menu">
<ul>
Homepage<li>Products</li>
<li>About Us</li>
</ul>
</div>
<div id="content">
<div id="updatesCol">
<h2>Recent Updates</h2>
<h3> * Website Created *</h3>
<p></p>
<p style="font-size:small">Website is now done!</p>
</div>
<div id="contentCol">
<h2>Welcome to Spectanium!</h2>
<p>
<em>So far we have to do a few things before we are ready to roll!</em>
</p>
<h3>Game Stuff:</h3>
<ol>
<li>Finish the actual game.</li>
<li>Get final graphics.</li>
<li>Get final music.</li>
<li>Find out distribution method.</li>
</ol>
<h3>Website Stuff:</h3>
<ol>
<li>Write descriptions for about us.</li>
<li>Improve it</li>
<li>Make it pretty</li>
</ol>
</div>
<div style="clear: both;"></div>
</div>
<div id="footer">
<p></p>
<p> © 2014 Spectanium Studios</p>
</div>
</body>
</html>
default.css -->
body {
margin: 20px 0;
padding: 0;
background: black;
background-image:url('images/background.png');
background-size:100%;
background-repeat:repeat-y;
width:190%;
font: normal "Courier New", Courier, Courier, sans-serif;
}
h1, h2, h3 {
color: #B13413;
}
h2 {
font-size: 1.6em;
}
h3 {
margin: 0;
font-size: 1em;
}
p, ul, ol, blockquote {
margin-top: 0;
}
a:link {
border-bottom: 1px dotted #CCCCCC;
text-decoration: none;
color: #3284B5;
}
a:hover {
border: none;
}
img {
border: none;
}
/* Header */
#header {
width: 890px;
height: 273px;
margin: 4px 0 4px 300px;
background: url(images/header.png) no-repeat;
}
/* Menu */
#menu {
background: url(images/topborder.png) repeat-x;
width: 950px;
height: 41px;
margin: 0 auto;
margin-left:275px;
background-color: #a1a1a1;
}
#menu ul {
margin: 0;
padding: 0;
list-style: none;
text-decoration:none;
}
#menu li {
display: inline;
text-decoration:none;
}
#menu a {
display: block;
float: left;
height: 28px;
padding: 15px 20px 0 20px;
text-decoration: none;
color: black;
font-weight:bold;
border-bottom: 0 dotted #DDDDDD;
}
#menu a:hover{
height:8px;
color: #B13413;
}
/* Content */
#content {
background: url(images/bottomborder.png) repeat-x;
width: 950px;
background-color: white;
margin-left:275px;
height: 1000px;
}
#updatesCol {
float: right;
width: 250px;
height:1000px;
border-left:1px black solid;
text-align:center;
}
#contentCol {
float: left;
width: 500px;
padding: 20px 0 0 0;
margin-left:25px;
}
/* Footer */
#footer {
width: 950px;
margin: 0 auto;
margin-left:275px;
padding: 10px 0;
font-size: smaller;
background: url(images/bottomborder.png) repeat-x;
clear:both;
}
#footer * {
color: #666666;
}
This is how it's displaying to me, running on 1920x1080.
http://s30.postimg.org/s3w6clowg/hello.jpg
Problem is your backgorund. It's set to repeat-y but the width it's 1450, so it will repeat-y but won't extend further than that.
Also it'll look a bit to the left because you set all the margins in pixels, like the header:
4px 0 4px 300px .
So no matter what it'll be pushed from the left to the right of 300px. If my resolution is high it'll show a huge gap on the RIGHT side of the page.
This is because you are using margin-left to align the whole website so when it scales up it is still aligned to the left. Use margin: 0 auto; to center your website. If you want the website to stay aligned to the left like it currently is however then use a percentage instead. You probably should also set a background color or having a repeating background to avoid the black background when the page is wider than your background image.
Try this.
body{
background-position-x:center;
}
body > div{
margin:auto !important;
}
Now the content is centered I assure you. But it won't feel centered as the blackened area in the background-image you are using is not centered horizontally. You can see the green line is longer than the red line. Correct that and you're good to go.
My suggestion is that you use an image on background which doesn't have blackened area and achieve that by css
You have specified a absolute margin-left which is causing the problem.
I changed some parts of your css file and it works fine for me.
basically replace absolute margins with
margin-left:auto
margin-right:auto
Changes in default.css
body {
margin: 20px 0;
padding: 0;
background: black;
background-image:url('http://www.spectanium.com/images/background.png');
background-size:100%;
background-repeat:repeat-y;
width:100%;
font: normal "Courier New", Courier, Courier, sans-serif;
}
#header {
width: 890px;
height: 280px;
margin-left:auto;
margin-right:auto;
background: url(http://www.spectanium.com/images/header.png) no-repeat;
}
#menu {
background: url(http://www.spectanium.com/images/topborder.png) repeat-x;
width: 950px;
height: 51px;
margin-left:auto;
margin-right:auto;
background-color: #a1a1a1;
}
#content {
background: url(images/bottomborder.png) repeat-x;
width: 950px;
background-color: white;
margin-left:auto;
margin-right:auto;
height: 1000px;
}
/* Footer */
#footer {
width: 950px;
margin: 0 auto;
margin-left:auto;
margin-right:auto;
padding: 10px 0;
font-size: smaller;
background: url(http://www.spectanium.com/images/bottomborder.png) repeat-x;
clear:both;
}

Float drop with div tags in footer

I'm trying to float a div to the right of my footer after 2 other divs (ie 3 columns) and want them to line up horizontally but the one I'm floating right keeps dropping down below the 2 on the left. Can anyone help with this?
Here's the code...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>K Blondel Design :: Carpentry & Funiture Design :: Brighton</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="oneColFixCtr.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Abel|Cutive+Mono|Nothing+You+Could+Do' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<div class="subcontainer">
<div class="header">
<div id="mainNav">
<ul id="mainNav">
<li>Home</li>
<li>About Us</li>
<li>Our Work </li>
<li>Contact Us </li>
</ul>
</div>
<div class="contact">
E : click here
<br />
T : 07585 607521
</div>
</div>
<div class="lineborder">
</div>
<div class="sidebar-logo"><img src="Images/k-blondel-design-logo.png" width="64" height="108" alt="K Blondel Design logo" />
</div>
<div id="contentright">
<div class="galleryimg"><div class="photo"><img src="Images/winebar-furniture-01.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
<div class="galleryimg"><div class="photo"><img src="Images/wooden-outdoor-seating.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
<div class="galleryimg"><div class="photo"><img src="Images/wooden-shelving.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
<div class="galleryimg"><div class="photo"><img src="Images/wooden-winerack.jpg" width="145" height="200" alt="Winchester winebar" /></div></div>
</div>
<div id="content">
<h1>Instructions </h1>
<p>At K Blondel Design we aim to fill the gap between the over exuberant furniture maker and the general carpenter. Trained in the art of creating affordable and elegant solutions to 3D problems.</p>
<p>As a small business we are able to deliver a personal one to one design service, talking through various design and material possibilities and arriving at an affordable, bespoke and stylish solution.</p>
<p>From design through to construction and installation we specialise in storage solutions, furniture and interiors for both the domestic and commercial markets. </p>
<p>Based in Brighton we have 20 years' design and commercial experience and an ever-growing client list spanning Sussex, Hampshire, London and Kent.</p>
<p>
<!-- end .content --></p>
</div>
<div class="lineborder"></div>
<div id="footer">
<div class="footercolleft">
Carpentry<br/>
Furniture Design<br/>
Interior Design & Decoration
</div>
<div class="footercolright">
Storage Solutions<br/>
Decking & Wooden Flooring<br/>
Shop Fitting / Commercial Interiors
</div>
<div class="footercoladdress">
Copyright © 2014 Kevin Blondel Design<br />1 Park Terrace, Brighton BN1 0GT
</div>
</div>
<!-- end .subcontainer --></div>
<!-- end .container --></div>
</body>
</html>
and here's the css...
#charset "UTF-8";
body {
font: 100%/1.4;
background-color:#FFF;
margin: 0;
padding: 0;
color: #000;
}
/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 10px;
padding-left: 40px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
h1 {
font-family: 'Abel', Arial, sans-serif;
font-size:24px;
font-weight: normal;
}
h2 {
font-family: 'Abel', Arial, sans-serif;
font-size:18px;
}
p {
font-family: 'Cutive Mono', Georgia, serif;
font-size:13px;
line-height:1.4em;
font-weight:600;
}
#home #homelink,
#aboutus #aboutuslink,
#ourwork #ourworklink,
#contactus #contactuslink {
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:17px;
text-decoration:none;
border-bottom: solid 6px #494949;
}
#mainNav {
margin: 0;
padding: 0;
list-style: none;
}
#mainNav li {
float: left;
padding: 50px 14px 0 14px;
}
#mainNav a {
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:17px;
text-decoration:none;
padding: 0 20px 0 20px;
}
#mainNav a:hover {
color:#FFF;
background-color: #494949;
}
img {
border: none;
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color: #494949;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #494949;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}
/* ~~ this fixed width container surrounds all other elements ~~ */
.container {
width: 1352px;
background-image:url(Images/sktchbook-bgd.jpg);
background-repeat:no-repeat;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
}
.header {
width: 950px;
height: 72px;
margin-left:90px;
margin-right: 90px;
}
.header img{
border:none;
}
.lineborder {
width: 950px;
background-color:#494949;
height: 1px;
margin-left:110px;
margin-right:110px;
}
.contact {
float: right;
padding: 27px 0 0 0;
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:17px;
}
.sidebar-logo {
float: left;
width: 70px;
}
.subcontainer {
width: 1150px;
min-height: 880px;
margin: 0 auto;
/* the auto value on the sides, coupled with the width, centers the layout */
}
/* ~~ This is the layout information. ~~
1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
*/
#content {
padding: 40px 0;
width: 420px;
margin-left:90px;
margin-right:90px;
min-height:475px;
}
#contentright {
float: right;
padding: 40px 0;
width: 420px;
margin-right:90px;
}
.galleryimg {
display: inline-block;
vertical-align: top;
margin: 0 40px 30px 0;
}
.photo {
-moz-box-shadow: 2px 2px 2px 0px #888;
-webkit-box-shadow: 2px 2px 2px 0px #888;
box-shadow: 2px 2px 2px 0px #888;
}
.photo img {
border: 10px solid #fff;
background-color: #fff;
position: relative;
}
/* ~~ miscellaneous float/clear classes ~~ */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the overflow:hidden on the .container is removed */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
#footer {
padding: 10px 0 0 20px;
width: 950px;
height: 150px;
margin-left:90px;
margin-right: 90px;
font-family: 'Abel', Arial, sans-serif;
color: #494949;
font-size:14px;
line-height: 1.5em;
}
#footer a {
text-decoration:none;
padding: 0 5px 0 5px;
}
#footer a:hover {
color:#FFF;
background-color: #494949;
}
.footercolleft {
padding: 0;
margin: 0;
float: left;
width: 200px;
overflow:hidden;
}
.footercolright {
padding: 0;
width: 200px;
overflow:hidden;
}
.footercoladdress {
float:right;
padding: 0 5px 0 5px;
text-align: right;
width:250px;
}
Many thanks!
When floating two items to the right, the one that comes first will actually go to the far right. And since you aren't floating the 'middle' column, it has a margin on the right that pushes the address column down.
DEMO
Switch the order of your html:
<div id="footer">
<div class="footercolleft">
Carpentry<br/>
Furniture Design<br/>
Interior Design & Decoration
</div>
<div class="footercoladdress">
Copyright © 2014 Kevin Blondel Design<br />1 Park Terrace, Brighton BN1 0GT
</div>
<div class="footercolright">
Storage Solutions<br/>
Decking & Wooden Flooring<br/>
Shop Fitting / Commercial Interiors
</div>
</div>
Thanks for the above comments. It was fixed as suggested above by re-ordering the html so that the right floating div came in between the 2 left hand columns. I also added another 'overflow: hidden' to the #footer properties.

what is the point to have padding 2px top and bottom

In declaration "#message a" I have a style padding that looks like this
padding: 2px 15px;
so what is the point to have padding top and bottom when there is no change in appearance. Even if I change padding to
"padding: 100px 15px;"
this 100px doesn't make any change in appearance. This 15px is correct and make some change in appearance.
<!DOCTYPE>
<html>
<head>
<title>Chapter 3: Expandable Rows</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
body
{
margin:5px;
padding: 0;
font-family: Arial, sans-serif;
font-size: small;
text-align: center;
width: 768px;
}
#register
{
float: left;
width: 100%;
margin:0;
padding: 0;
list-style: none;
color: #690;
background: #BDDB62;
}
#register a
{
text-decoration: none;
color: #360;
}
#reg
{
float: left;
margin: 0;
padding: 8px 14px;
}
#find
{
float: right;
margin: 0;
padding: 8px 14px;
}
#message
{
clear:both;
font-weight: bold;
font-size:110%;
color:#fff;
text-align: center;
background: #92B91C;
}
#message p
{
margin: 0;
padding: 8px 14px;
}
#message strong
{
text-transform: uppercase;
}
#message a
{
margin: 0 0 0 6px;
padding: 2px 15px;
text-decoration: none;
font-weight: normal;
color: #fff;
}
</style>
</head>
<body>
<ul id="register">
<li id="reg">Not registered? Register now!</li>
<li id="find">Find a store</li>
</ul>
<div id="message">
<p><strong>Special this week:</strong> $2 shipping on all orders! LEARN MORE</p>
</div>`enter code here`
</body>
</html>
The anchor tag is an inline element so it will not display vertical padding.
While padding can be applied to all sides of an inline element, only
left and right padding will have an effect on surrounding content.
To see the vertical padding applied change the a to display:inline-block.
#message a{
padding: 2px 15px;
display: inline-block;
}
Example http://jsfiddle.net/sL7kT/
See this article on how CSS properties are applied to inline elements.
Simply a tag cannot be adjusted by width, height , padding etc..
Add: display: inline-block; to make anchor inline block.
#message a {
display: inline-block;
padding: 100px 10px;
}
Demo: http://jsfiddle.net/eAxsh/
you have your a tag in paragraph tag so its abide to the line height of its parents which is your paragraph tag.. so if you give the vertical padding it wont applyl.. rather use inline-block on your a tag

How is font-size not working here?

Following advice in The 6 Most Important CSS Techniques You Need To Know, I set my body's font-size to 62.5%, the container div's font-size to 1.4 em (slight variation from the article). p.tags and p.published's font-size is set to 1em.
However, this doesn't work for me. Both the normal text and text in p.tags and p.published comes out to be the same size (16.8px as computed by Firebug). Can you explain why my code isn't working? I am testing in Firefox 3.6.3. The sample page shown by the author works just fine in the very same browser.
I've reproduced the entire page below—apologies for the length of it, but I thought it better to not leave out anything.
<html>
<head>
<title>Title</title>
<style type="text/css">
body {
font-family: Georgia, "Century Schoolbook", "Times New Roman", Serif;
font-size: 62.5%;
background-color: #2B3856; /* Dark slate blue */
}
h1, h2, h3, h4, h5, h6 {
font-family: Verdana, Helvetica, Tahoma, "Sans Serif";
color: #2B3856;
margin-top: 2px;
}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
text-decoration: none;
color: #2B3856;
}
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
text-decoration: underline;
}
div#container {
width: 800px;
font-size: 1.4em;
margin: 5px auto;
background-color: #E3E4FA; /* Lavender */
}
#sidebar {
width: 200px;
float: right;
margin: 0px;
padding: 0px;
}
#sidebar div {
padding: 0 5px 5px;
}
#sidebar div.shadowbox { margin-right: 5px; }
#content {
width: 600px;
float: left;
margin: 0px;
padding: 0px;
}
#header {
/*background-color: white;*/
background-color: #2B3856; /* #E3E4FA; Lavender */
margin-bottom: 5px;
height: 100px;
}
#header h1 {
color: #B93B8F; /* Plum */
line-height: 100px;
text-align: center;
font-size: 45px;
}
#description {
color: #7D1B7E /* Dark Orchid */
}
a {
text-decoration: underline;
color: #153E7E;
}
a:hover {
text-decoration: none;
}
div#posts {
padding: 0px;
font-size: 1.2em;
margin: 0px;
}
div#posts div.post {
padding: 5px;
margin: 0px 5px 15px 5px;
}
p.tags, p.published {
font-size: 1em;
}
.shadowbox {
background: repeat 0 0 url('http://www.jawsalgorhythmics.com/images/darkness-100x100-10pct.png');
}
.justifycenter { text-align: center; }
.floatright { float:right; }
.floatleft { float: left; }
.clearright { clear: right; }
.clearleft { clear:left; }
.clearboth { clear: both; }
.halfsidebarwidth { width: 82px; }
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>Odds 'n Ends</h1>
</div> <!-- header -->
<div id="sidebar">
<div class="shadowbox">
<br /><p class="justifycenter"><img width="64" height="64" src="{PortraitURL-64}" /></p>
<div class="floatleft halfsidebarwidth">Archives</div>
<div class="floatleft halfsidebarwidth">RSS</div>
<div class="clearboth"></div>
</div>
</div> <!-- sidebar -->
<div id="content">
<div id="posts">
<div class="post shadowbox">
<span class="quote">
"It does not matter how slow you go so long as you do not stop."
<div class="source">Wisdom of Confucius</div>
</span>
<p class="tags">Tags: #wisdom </p>
<p class="published">Posted: Nov 08, 2006 at 2:27 pm
Permalink Short URL</p>
</div>
</div> <!-- posts -->
</div> <!-- content -->
<div class="clearboth"></div>
<div id="footer" style="text-align: justify;">
<h1>The footer</h1>
</div>
</div> <!-- container -->
</body>
</html>
Your <p class="tags"> and <p class="published"> elements are inside the container div, which has a font size of 1.4em, and also inside in the posts div, which has a font size of 1.2em. I think that setting the font size of the paragraphs to 1em doesn't really do anything, as the em unit is cumulative. So if your "root" font size is 62.5%, it's going to be increased 40% for the first div, and increased another 20% for the second div. Your two paragraphs will also have this font size, as they aren't increasing or decreasing the size.
Basically, if you want the "tags" and "published" paragraphs to have smaller text, give them a size of less than one, e.g. 0.9em. This will give them a size 10% less than other elements in the same parent div.
Graham was right, I set;
p.tags, p.published {
font-size: 0.5em;
}
And that changed the font size. Updated Jsfiddle here.
The EM is calculated from the base size of the body font. Look here for an explanation on how this works :)