How is font-size not working here? - html

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 :)

Related

How to center an entire webpage and position 4 divs side by side with only CSS3 and without BOOTSTRAP

I have this situation for a academic interview. It's a challenge and instead of spinning my wheels, for monday's final interview, I need help.
I have the following givens:
HTML PAGE that I cannot touch
CSS file where I do everything
An image that represents what the final product needs to be
Now, I'm not asking anyone to do this for me, but rather guide me to complete the task like I would if we were at work collaborating. Help me to think and pair program.
This is a finalist interview that I've been selected for academia. It would be a swan song for my career... but I want to show them that I can reach out for help and work together vice sit there guessing and struggling.
Here's the image:
Here's the HTML that cannot be touched:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>The HTML</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<!-- page BEGIN -->
<div class="page-wrapper">
<!-- header BEGIN -->
<div class="page-header-wrapper wrapper">
<header class="page-header inner">
<nav class="main-nav">
<ul class="main-nav-menu menu">
<li class="menu-item">
<a class="menu-link active-path" href="/">Home</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">News</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">Features</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">Events</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">Contact</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">About</a>
</li>
</ul>
</nav>
</header>
</div>
<!-- header END -->
<!-- content BEGIN -->
<main class="content">
<!-- top feature BEGIN -->
<div class="top-feature-wrapper wrapper">
<section class="top-feature inner">
<header class="top-feature-header">
<h1>Top Feature</h1>
</header>
<article>
<img class="top-feature-image" src="img/top-feature.png" alt="Top feature placeholder image">
<header class="top-feature-story-header">
<h2>Some text goes here...and here...and here</h2>
<h3>By the great people of...</h3>
</header>
</article>
</section>
</div>
<!-- top feature END -->
<!-- featured stories BEGIN -->
<div class="featured-stories-wrapper wrapper">
<section class="featured-stories inner">
<header class="featured-stories-header">
<h1>Featured<br> Stories</h1>
</header>
<ul>
<li>
<article class="featured-story">
<img class="featured-story-image" src="img/feature.png" alt="Featured story placeholder image">
<span class="story-type">Feature</span>
<header class="featured-story-header">
<h2>Earth Week events begin next week</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
<li>
<article class="featured-story">
<img class="featured-story-image" src="img/feature.png" alt="Featured story placeholder image">
<span class="story-type">Photo Collection</span>
<header class="featured-story-header">
<h2>Photo: 'Big Data' kickoff</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
<li>
<article class="featured-story">
<img class="featured-story-image" src="img/feature.png" alt="Featured story placeholder image">
<span class="story-type">Feature</span>
<header class="featured-story-header">
<h2>Holocaust Survivor to Speak</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
<li>
<article class="featured-story">
<img class="featured-story-image" src="img/feature.png" alt="Featured story placeholder image">
<span class="story-type">Photo Collection</span>
<header class="featured-story-header">
<h2>'Beautiful Terror' on display through April 22</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
</ul>
</section>
</div>
<!-- featured stories END -->
</main>
<!-- content END -->
</div>
<!-- page END -->
</body>
</html>
And now the CSS file that I've been working on.
#charset "utf-8";
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 100;
}
/* headings */
h1, h2, h3, h4, h5, h6 {
line-height: 1.4em;
margin: 20px 0 .4em;
color: #000;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.6em;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1.1em;
}
h6 {
font-size: 1em;
}
/* Main Settings/RESET */
html, body, address, blockquote, div, dl, form, h1, h2, h3, h4, h5, h6, ol, p, pre, table, ul,
dd, dt, li, tbody, td, tfoot, th, thead, tr, button, del, ins, map, object,
a, abbr, acronym, b, bdo, big, br, cite, code, dfn, em, i, img, kbd, q, samp, small, span,
strong, sub, sup, tt, var, legend, fieldset {
/* This disables text size adjustment on iPhone */
-webkit-text-size-adjust: none;
margin: 0;
padding: 0;
}
/* Set HTML5 elements to BLOCK */
article, aside, details, figcaption, figure, footer, header, hgroup,
menu, nav, section {
display: block;
}
/* NAVBAR */
.main-nav {
list-style: none;
margin-bottom: 10px;
width: 100%;
text-align: center;
background-color: #fff;
height:38px;
}
.main-nav ul {
list-style-type: none;
margin: 0px;
padding: 0;
width: 100%;
}
.main-nav li {
margin: 0px;
}
.main-nav li a {
padding: 10px;
font-weight: normal;
font-size: 22px;
text-decoration: none;
color: #003f87;
background-color: #fff;
float: left
}
.main-nav li a:hover {
color: #FFFFFF;
background-color: #35af3b;
}
/************************************************************************************
GENERAL STYLING
*************************************************************************************/
body {
background: #fff;
font: 1.05em/150% Arial, Helvetica, sans-serif;
color: #cccccc;
}
a {
color: #026acb;
text-decoration: none;
outline: none;
}
a:hover {
text-decoration: underline;
background-color: #c6db01;
}
p {
margin: 0 0 1.2em;
padding: 0;
}
/* DIV STRUCTURE */
.page-wrapper > .page-header-wrapper {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
div .top-feature-wrapper {
padding-bottom: 60px;
}
div .top-feature-story-header {
padding-left: 10px;
}
div .top-feature-image {
margin-bottom: -30px;
}
div .featured-stories-wrapper .featured-stories {
background-color: #f1f1f1;
}
div .top-feature-wrapper h1 {
font-size: 42px;
padding-left: 10px;
color: #003f87;
}
div .featured-stories-wrapper h1 {
font-size: 42px;
padding-left: 10px;
color: #003f87;
}
div .featured-stories ul {
list-style: none;
}
/* HEADERS */
header h2 {
top: -30px;
padding-left: 10px;
background-color: #0097de;
line-height: 35pt;
width: 750px;
font-size: 22px;
color: #fff;
}
header h3 {
top: -30px;
padding-left: 10px;
background-color: #003f87;
line-height: 35pt;
font-family: "Times New Roman", Georgia, Serif;
width: 300px;
font-size: 18px;
font-style: italic;
color: #fff;
}
/* list */
ul, ol {
margin: 1em 0 1.4em 24px;
padding: 0;
line-height: 140%;
}
li {
margin: 0 0 .5em 0;
padding: 0;
}
/************************************************************************************
STRUCTURE
*************************************************************************************/
.page-wrapper {
border-top: #003f87 solid 10px;
}
/************************************************************************************
HEADER
*************************************************************************************/
header {
position: relative;
}
/* Active Link */
.main-nav .menu-link.active-path {
color: #FFFFFF;
background-color: #35af3b;
}
/* Flexible Images */
img {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}
/* Media Queries */
#media screen and (max-width: 650px) {
#header {
height: auto;
}
page-header-wrapper {
height: auto;
}
#main-nav {
position: static;
}
#site-description {
margin: 0 0 15px;
position: static;
}
#content {
width: auto;
float: none;
margin: 20px 0;
}
}
#media screen and (max-width: 480px) {
html {
-webkit-text-size-adjust: none;
}
#main-nav a {
font-size: 90%;
padding: 10px 8px;
}
}
The CSS I was given was up to this comment:
/* Main Settings/RESET */
Here's the problem...
When you run this, and you'll need normalize.min.css... everything is PULLED TO THE LEFT. I have tried like heck to center the page-wrapper using the obvious code:
max-width: 1920px; --the width of the image
margin: 0 auto;
But it will not move!
So, I'm seeking not the solution, per se, but collab to help me "see" the solution. Force me to work the problem as you would and I'll post UPDATE 1, UPDATE 2, etc...
Thank you everyone and I will acknowledge Stackoverflow's assistance at my finalist interview at 1PM PDT. This has to go with me, and I'll need to explain the CSS as well.
Help me work the problem and allow me to LEARN.
OF NOTE: They recommend using SASS or LESS, but it's not required. Perhaps therein lies the "solution".
UPDATE 1: Solution for center is:
body {
background: #fff;
font: 1.05em/150% Arial, Helvetica, sans-serif;
color: #cccccc;
/* Added the following which WORKED! */
display: flex;
justify-content: center;
}
UPDATE 2:
This solution from Adrian works correctly as well.
https://codepen.io/anon/pen/qPjeRE
I've tried both: Each has it's benefits... with VXp's, which I like immediately, it was quick and just looks great. Only issue and this is not a roadblock, but the blue strip across the top, no longer extends full with of the browser. Again, it's a non-issue...and will not hurt me.
The only issue with Adrian's is that when I placed the code in my code here on my machine, the menu dropped to a SIDEBAR menu, list style but with no bullets.
It actually look cool! I need to vote for both of you because both of your solutions work well and I will acknowledge.
Secondly, I need to adjust the FEATURE stories so that they are side-by-side and I used list-style: none; but they remain, the way they look.
I know that list-style moves ul's to side-by-side but I need to understand CSS Specificity. I'm using ALL CLASSES and elements to isolate which is needed. This is a real challenge to understand.
I know that ID's take priority, elements are next then classes.
I truly appreciate everyone's help... Oh, another answer just came in. I'll save this and look.
UPDATE 3: SUCCESS!!! Now for the responsiveness factor...
EVERYONE! Please see the completed CSS and give it a try. With help from Adrian and VXp, I've been successful.
BUT the following roadblocks remain:
1. The bottom GRAY does NOT extend left and right
2. The page is NOT responsive and again, I cannot use BOOTSTRAP and cannot touch the HTML code at all.
3. I've incorporated FLEXBOX and find it is working, but... nothing is responsive. That is my final roadblock.
I've fixed the bottom FEATURED STORIES section from research from Adrian and VXp's solutions.
NOW; the main.css solution thus far:
#charset "utf-8";
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 100;
}
/* headings */
h1, h2, h3, h4, h5, h6 {
line-height: 1.4em;
margin: 20px 0 .4em;
color: #000;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.6em;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1.1em;
}
h6 {
font-size: 1em;
}
/* Main Settings/RESET */
html, body, address, blockquote, div, dl, form, h1, h2, h3, h4, h5, h6, ol, p, pre, table, ul,
dd, dt, li, tbody, td, tfoot, th, thead, tr, button, del, ins, map, object,
a, abbr, acronym, b, bdo, big, br, cite, code, dfn, em, i, img, kbd, q, samp, small, span,
strong, sub, sup, tt, var, legend, fieldset {
/* This disables text size adjustment on iPhone */
-webkit-text-size-adjust: none;
margin: 0;
padding: 0;
}
/* Set HTML5 elements to BLOCK */
article, aside, details, figcaption, figure, footer, header, hgroup,
menu, nav, section {
display: block;
}
/* NAVBAR */
.main-nav {
list-style: none;
margin-bottom: 10px;
width: 100%;
text-align: center;
background-color: #fff;
height: 43px;
}
.main-nav ul {
list-style-type: none;
margin: 0px;
padding: 0;
width: 100%;
}
.main-nav li {
margin: 0px;
}
.main-nav li a {
padding: 10px;
font-weight: normal;
font-size: 22px;
text-decoration: none;
color: #003f87;
background-color: #fff;
float: left
}
.main-nav li a:hover {
color: #FFFFFF;
background-color: #35af3b;
}
/************************************************************************************
GENERAL STYLING
*************************************************************************************/
body {
background: #fff;
font: 1.05em/150% Arial, Helvetica, sans-serif;
color: #cccccc;
display: flex;
justify-content: center;
border-top: #003f87 solid 10px;
}
a {
color: #026acb;
text-decoration: none;
outline: none;
}
a:hover {
text-decoration: underline;
background-color: #c6db01;
}
p {
margin: 0 0 1.2em;
padding: 0;
}
/* DIV STRUCTURE */
/* Added on 9302017 */
div .featured-stories-wrapper {
}
/* Added on 9292017 */
div .top-feature-wrapper {
padding-bottom: 60px;
}
div .top-feature-story-header h2 {
padding-left: 10px;
background-color: #0097de;
width: 750px;
font-size: 22px;
color: #fff;
margin-left: 20px;
}
div .top-feature-story-header h3 {
padding-left: 10px;
background-color: #003f87;
font-family: "Times New Roman", Georgia, Serif;
width: 300px;
font-size: 18px;
font-style: italic;
color: #fff;
margin-left: 20px;
}
div .top-feature-image {
margin-bottom: -30px;
}
/* Featured Stories */
div .featured-stories-wrapper {
background-color: #f1f1f1;
}
div .top-feature-wrapper h1 {
font-size: 42px;
background-color: #c6db02;
color: #003f87;
width: 400px;
padding-top: 10px;
padding-left: 30px;
padding-right: 14px;
padding-bottom: 10px;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0% 100%, 5% 50%, 0% 0%);
clip-path: polygon(100% 0, 100% 100%, 0% 100%, 5% 50%, 0% 0%);
}
div .featured-stories-wrapper h1 {
font-size: 42px;
padding-left: 10px;
color: #003f87;
}
header.featured-story-header h2 {
width: 210px;
line-height: 1.3em;
color: #000;
font-size: 22px;
}
header.featured-story-header h3 {
width: 215px;
line-height: 1.5em;
color: #000;
font-size: 16px;
}
/* span for GREEN POLYGON */
span.story-type {
position:relative;
top: -36px;
margin-left: -18px;
background-color: #c6db02;
color: #003f87;
text-align:right;
font-size: 18px;
padding-top: 10px;
padding-left: 30px;
padding-right: 14px;
padding-bottom: 10px;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0% 100%, 10% 50%, 0% 0%);
clip-path: polygon(100% 0, 100% 100%, 0% 100%, 10% 50%, 0% 0%);
}
div .featured-stories ul {
list-style: none;
column-count: 4;
column-gap: 38px;
width: 1050px;
}
div .featured-stories ul li {
width: 200px;
}
/************************************************************************************
FEATURED STORIES
*************************************************************************************/
/* HEADERS */
header h2 {
top: -30px;
padding-left: 10px;
line-height: 35pt;
}
header h3 {
top: -30px;
padding-left: 10px;
line-height: 35pt;
}
/* list */
ul, ol {
margin: 1em 0 1.4em 24px;
padding: 0;
line-height: 140%;
}
li {
margin: 0 0 .5em 0;
padding: 0;
}
/************************************************************************************
STRUCTURE
*************************************************************************************/
/************************************************************************************
HEADER
*************************************************************************************/
header {
position: relative;
}
/* Active Link */
.main-nav .menu-link.active-path {
color: #FFFFFF;
background-color: #35af3b;
}
/* Flexible Images */
img {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}
/* Media Queries */
#media screen and (max-width: 650px) {
header {
height: auto;
}
.page-wrapper {
width: 980px;
margin: 0 auto;
}
.page-header-wrapper {
height: auto;
}
.main-nav {
position: static;
}
.featured-stories-wrapper {
margin: 0 0 15px;
position: static;
}
.content {
width: auto;
float: none;
margin: 20px 0;
}
}
#media screen and (max-width: 480px) {
html {
-webkit-text-size-adjust: none;
}
#main-nav a {
font-size: 90%;
padding: 10px 8px;
}
}
You can use the power of flexbox on the parent to make the magic happen.
body {
display: flex;
justify-content: center;
}
Since the div.page-wrapper is the only direct child of the parent body, this works like a charm.
Perhaps your monitor is full HD and setting the page to its full width doesn't seem to work for you. Set the wrapper to smaller width, like this:
/************************************************************************************
STRUCTURE
*************************************************************************************/
body {
border-top: #003f87 solid 10px;
}
.page-wrapper {
width: 1260px;
margin:auto;
}
The only difference would be, that you have to move border-top to Body element for it to cover full screen.
Demo: https://codepen.io/anon/pen/qPjeRE
edit:
Some extra code to help you with your further tasks:
/************************************************************************************
STRUCTURE
*************************************************************************************/
body { border-top: #003f87 solid 10px;}
.page-wrapper {width: 1260px; margin:auto;}
.featured-story {width: 22%; float:left; margin:1%; border: 1px dashed #f00; }
.featured-story h2, .featured-story h3 {width: auto; font-size: 15px; line-height: 25px; background: none;color: black; }
.featured-story h2 {font-weight: bold;}
.featured-story h3 {font-style:normal;}
DEMO: https://codepen.io/anon/pen/xXrvmV?editors=1100
I see other users are addressing solutions to your problem. I wanted to stress this point that you tried:
I have tried like heck to center the page-wrapper using the obvious
code:
max-width: 1920px; --the width of the image margin: 0 auto; But it
will not move!
You have a good point, but the wrong target and the wrong size. The page-wrapper div is covering the whole width of the viewport, so you can't center it. You can center it's children, there's a .content div that wraps all the content (but the header). You can center it using the margin technique you tried:
.content {
max-width: 800px;
margin: 0 auto;
}
You need to set a width or max-width smaller than the viewport width, and set both margins left and right to auto. You can use both width and max-width to keep it responsive:
.content {
width: 100%;
max-width: 800px;
margin: 0 auto;
}
Remember that it only works to center block elements.
So here's the snippet with .content as showed before:
#charset "utf-8";
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 100;
}
/* headings */
h1, h2, h3, h4, h5, h6 {
line-height: 1.4em;
margin: 20px 0 .4em;
color: #000;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.6em;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1.1em;
}
h6 {
font-size: 1em;
}
/* Main Settings/RESET */
html, body, address, blockquote, div, dl, form, h1, h2, h3, h4, h5, h6, ol, p, pre, table, ul,
dd, dt, li, tbody, td, tfoot, th, thead, tr, button, del, ins, map, object,
a, abbr, acronym, b, bdo, big, br, cite, code, dfn, em, i, img, kbd, q, samp, small, span,
strong, sub, sup, tt, var, legend, fieldset {
/* This disables text size adjustment on iPhone */
-webkit-text-size-adjust: none;
margin: 0;
padding: 0;
}
/* Set HTML5 elements to BLOCK */
article, aside, details, figcaption, figure, footer, header, hgroup,
menu, nav, section {
display: block;
}
/* NAVBAR */
.main-nav {
list-style: none;
margin-bottom: 10px;
width: 100%;
text-align: center;
background-color: #fff;
height:38px;
}
.main-nav ul {
list-style-type: none;
margin: 0px;
padding: 0;
width: 100%;
}
.main-nav li {
margin: 0px;
}
.main-nav li a {
padding: 10px;
font-weight: normal;
font-size: 22px;
text-decoration: none;
color: #003f87;
background-color: #fff;
float: left
}
.main-nav li a:hover {
color: #FFFFFF;
background-color: #35af3b;
}
/************************************************************************************
GENERAL STYLING
*************************************************************************************/
html,body {
background: #fff;
font: 1.05em/150% Arial, Helvetica, sans-serif;
color: #cccccc;
}
a {
color: #026acb;
text-decoration: none;
outline: none;
}
a:hover {
text-decoration: underline;
background-color: #c6db01;
}
p {
margin: 0 0 1.2em;
padding: 0;
}
/* DIV STRUCTURE */
.content {
width: 100%;
max-width: 800px;
margin: 0 auto;
}
.page-wrapper > .page-header-wrapper {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
div .top-feature-wrapper {
padding-bottom: 60px;
}
div .top-feature-story-header {
padding-left: 10px;
}
div .top-feature-image {
margin-bottom: -30px;
}
div .featured-stories-wrapper .featured-stories {
background-color: #f1f1f1;
}
div .top-feature-wrapper h1 {
font-size: 42px;
padding-left: 10px;
color: #003f87;
}
div .featured-stories-wrapper h1 {
font-size: 42px;
padding-left: 10px;
color: #003f87;
}
div .featured-stories ul {
list-style: none;
}
/* HEADERS */
header h2 {
top: -30px;
padding-left: 10px;
background-color: #0097de;
line-height: 35pt;
width: 750px;
font-size: 22px;
color: #fff;
}
header h3 {
top: -30px;
padding-left: 10px;
background-color: #003f87;
line-height: 35pt;
font-family: "Times New Roman", Georgia, Serif;
width: 300px;
font-size: 18px;
font-style: italic;
color: #fff;
}
/* list */
ul, ol {
margin: 1em 0 1.4em 24px;
padding: 0;
line-height: 140%;
}
li {
margin: 0 0 .5em 0;
padding: 0;
}
/************************************************************************************
STRUCTURE
*************************************************************************************/
.page-wrapper {
border-top: #003f87 solid 10px;
}
/************************************************************************************
HEADER
*************************************************************************************/
header {
position: relative;
}
/* Active Link */
.main-nav .menu-link.active-path {
color: #FFFFFF;
background-color: #35af3b;
}
/* Flexible Images */
img {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}
/* Media Queries */
#media screen and (max-width: 650px) {
#header {
height: auto;
}
page-header-wrapper {
height: auto;
}
#main-nav {
position: static;
}
#site-description {
margin: 0 0 15px;
position: static;
}
#content {
width: auto;
float: none;
margin: 20px 0;
}
}
#media screen and (max-width: 480px) {
html {
-webkit-text-size-adjust: none;
}
#main-nav a {
font-size: 90%;
padding: 10px 8px;
}
}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>The HTML</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<!-- Your css file
<link rel="stylesheet" href="css/main.css">
-->
</head>
<body>
<!-- page BEGIN -->
<div class="page-wrapper">
<!-- header BEGIN -->
<div class="page-header-wrapper wrapper">
<header class="page-header inner">
<nav class="main-nav">
<ul class="main-nav-menu menu">
<li class="menu-item">
<a class="menu-link active-path" href="/">Home</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">News</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">Features</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">Events</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">Contact</a>
</li>
<li class="menu-item">
<a class="menu-link" href="/">About</a>
</li>
</ul>
</nav>
</header>
</div>
<!-- header END -->
<!-- content BEGIN -->
<main class="content">
<!-- top feature BEGIN -->
<div class="top-feature-wrapper wrapper">
<section class="top-feature inner">
<header class="top-feature-header">
<h1>Top Feature</h1>
</header>
<article>
<img class="top-feature-image" src="https://placeimg.com/800/480/nature" alt="Top feature placeholder image">
<header class="top-feature-story-header">
<h2>Some text goes here...and here...and here</h2>
<h3>By the great people of...</h3>
</header>
</article>
</section>
</div>
<!-- top feature END -->
<!-- featured stories BEGIN -->
<div class="featured-stories-wrapper wrapper">
<section class="featured-stories inner">
<header class="featured-stories-header">
<h1>Featured<br> Stories</h1>
</header>
<ul>
<li>
<article class="featured-story">
<img class="featured-story-image" src="https://placeimg.com/200/200/people" alt="Featured story placeholder image">
<span class="story-type">Feature</span>
<header class="featured-story-header">
<h2>Earth Week events begin next week</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
<li>
<article class="featured-story">
<img class="featured-story-image" src="https://placeimg.com/200/200/people" alt="Featured story placeholder image">
<span class="story-type">Photo Collection</span>
<header class="featured-story-header">
<h2>Photo: 'Big Data' kickoff</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
<li>
<article class="featured-story">
<img class="featured-story-image" src="https://placeimg.com/200/200/people" alt="Featured story placeholder image">
<span class="story-type">Feature</span>
<header class="featured-story-header">
<h2>Holocaust Survivor to Speak</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
<li>
<article class="featured-story">
<img class="featured-story-image" src="https://placeimg.com/200/200/people" alt="Featured story placeholder image">
<span class="story-type">Photo Collection</span>
<header class="featured-story-header">
<h2>'Beautiful Terror' on display through April 22</h2>
<h3>Some text goes here... </h3>
</header>
</article>
</li>
</ul>
</section>
</div>
<!-- featured stories END -->
</main>
<!-- content END -->
</div>
<!-- page END -->
</body>
</html>
You can center the header too:
.content, .page-header-wrapper {
width: 100%;
max-width: 800px;
margin: 0 auto;
}
Flexbox is a good solution, but it lacks support in older browsers (https://www.w3schools.com/css/css3_flexbox.asp), so it's good to cover both aproaches.

Increasing the font size is dramatically increasing the padding of header

I creating a page and was lost when I noticed that when I increase or decrease the font size of the header, the surrounding space increases in a drastic size. I don't have a padding for the h1 tag, but it looks like it is being added. I tried removing the padding for the nav, but it is only affecting the nav text itself, not the extra space that's bothering me.
Here is the code:
body {
margin: 0;
font-family: Caviar, "Times New Roman", sans-serif;
float: clear;
text-align: center;
}
#main {
width: 100%;
padding: 0;
}
/* start the whole heading section */
h1 {
font-size: 5em;
color: #000000;
font-family: "Alex Brush", "Times New Roman", sans-serif;
padding-left: 2%;
float: left;
}
nav h2 {
font-weight: normal;
}
nav {
float: right;
font-family: Junction, "Times New Roman", sans-serif;
font-size: 1.1em;
/*padding-top: 5.2%;
padding-right: 2%;*/
}
nav a {
color: #000000;
text-decoration: none;
}
nav a:hover {
text-decoration: underline;
}
nav a:visited {
color: #000b26;
}
#header {
background-color: #FF6978;
display: block;
width: 100%;
text-align: left;
position: fixed;
overflow: hidden;
top: 0;
z-index: 999;
box-shadow: 5px 6px 5px #000000;
}
/*end heading section*/
#container {
margin: 0 auto 0 auto;
margin-left: 0 auto;
width: 96%;
margin-top: 13%;
}
.small_head {
font-family: Capsuula, "Times New Roman", sans-serif;
font-size: 2.2em;
border: 3px solid #FFFF61;
padding: .5% 5% .5% 5%;
display: inline-block;
margin: 0 auto;
}
<!doctype html>
<html lang="en">
<head>
<title>Check</title>
<meta charset="UTF-8">
<link href="styles.css" rel="stylesheet" type="text/css">
<link href="font.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="main">
<!--open main div-->
<div id="header">
<h1>Checking Head</h1>
<nav>
<h2>
Navigator
</h2>
</nav>
</div>
<!--close header-->
<div id="container">
<div class="small_head">Small Head</div>
</div>
<!--close container-->
</div>
<!--close main-->
</body>
</html>
Please help!
Note: I have embedded fonts in another css, so please ignore the fonts.
Thank you
This is because the <h1> tag naturally has a margin applied on it scaling with font-size. You want this in your css:
h1 { margin:0 }
The h1 element has margin that is related to the font size via em. If you increase the font size, em is relative to the font size and, thus, margin is increased.
Or you can use max-height: <number of pixels> px instead of h1 { margin:0 } and you will not affect the h1 margins.

#footer background solid color not working over container

http://preview.goodinkproductions.com/CG8F13
I've managed to get the footer to span the site (unlike body which is inside a container and AOK). But, I can't get the footer background to be solid. It appears I have a band of solid color below, but the footer content is not in that "space". All I want is a solid span footer with content in it!
CSS
/* Footer
--------------------------------------------------------------------------------*/
#footer {
width: 100%;
background-color:#FF8800;
}
#footer-content{
width: 950px;
height: 80px;
margin-left: auto;
margin-right: auto;
}
#footer p {
color: #878787;
font-size: 12px;
}
#footer blockquote {font-size:11px; color:#999;}
#footer a {
color: #a59b8c;
}
#footer a:hover {
color: #cab99f;
}
#footer span {
vertical-align: middle;
}
#footer h2 {
font-size: 15px;
margin: 0 0 2px;
padding: .3em 0;
line-height: 1.5;
font-family: "Lato", Arial, Helvetica, sans-serif;
font-weight: 700;
color: #ebb058;
}
.wsite-footer { /* make sure enough space between element footer and attribution */
margin-bottom: 15px;
}
HTML
--------------------------------------------------------------------------------
{logo}
{menu}
{phone:text}
{social}
{search}
{content}
</div>
</div>
<div style='padding: 20px; width:100%; text-align:center;'>{footer}</div>
</body>
<div id="footer">
<div id="footer-content">
</div>
</div>
</html>
END
I don't quite understand what's going on here, but you need your footer div's inside the body tag.
</div>
</div>
<div style='padding: 20px; width:100%; text-align:center;'>{footer}</div>
<div id="footer">
<div id="footer-content">
</div>
</div>
</body>
</html>
The footer appears to be there, with a background of #F8F8F8
There is no text in the footer in youc code...

Extra space above footer

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

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.