It will not format correctly, it won't remove the bullets nor will it format the block behind the text.
I'm out of ideas. Is there anyone that can coach me through this, please?
It will not format correctly, it won't remove the bullets nor will it format the block behind the text.
I'm out of ideas. Is there anyone that can coach me through this, please?
body {
margin:0;
padding:0;
border:0; /* This removes the border around the viewport in old versions of IE */
width:100%;
background:#fff;
min-width:600px; /* Minimum width of layout - remove line if not required */
/* The min-width property does not work in old versions of Internet Explorer */
font-size:90%;
}
a {
color:#369;
}
a:hover {
color:#fff;
background:#369;
text-decoration:none;
}
h1, h2, h3 {
margin:.8em 0 .2em 0;
padding:0;
clear:both;
}
p {
margin:.4em 0 .8em 0;
padding:0;
}
img {
margin:10px 0 5px;
}
#ads {
width:100%;
padding:20px 0;
}
#ads #mjt {
float:left;
margin-bottom:20px;
}
#ads .adhere {
margin:0 10px 10px 0;
}
#ads img {
display:block;
margin:0;
}
/* download link */
.download {
clear:both;
float:left;
padding-top:10px;
}
.download a {
padding:.3em .5em !important;
margin-right:10px;
background:#00bd3e;
text-decoration:none;
color:#fff;
font-weight:bold;
font-size:1.5em;
-moz-border-radius:.3em;
-webkit-border-radius:.3em;
border-radius:.3em;
line-height:2.5em;
-moz-box-shadow: 1px 1px 2px #888;
-webkit-box-shadow: 1px 1px 2px #888;
box-shadow: 1px 1px 2px #888;
}
.download a:hover {
background:#5f534f;
text-shadow: 2px 2px 2px #000;
}
/* Header styles */
#header {
clear:both;
float:left;
width:100%;
}
#header {
border-bottom:1px solid #000;
}
#header p,
#header h1,
#header h2 {
padding:.4em 15px 0 15px;
margin:0;
}
#header ul {
clear:left;
float:left;
width:100%;
list-style:none;
margin:10px 0 0 0;
padding:0;
}
#header ul li {
display:inline;
list-style:none;
margin:0;
padding:0;
}
#header ul li a {
display:block;
float:left;
margin:0 0 0 1px;
padding:3px 10px;
text-align:center;
background:#eee;
color:#000;
text-decoration:none;
position:relative;
left:15px;
line-height:1.3em;
}
#header ul li a:hover {
background:#369;
color:#fff;
}
#header ul li a.active,
#header ul li a.active:hover {
color:#fff;
background:#000;
font-weight:bold;
}
#header ul li a span {
display:block;
}
/* 'widths' sub menu */
#layoutdims {
clear:both;
background:#eee;
border-top:4px solid #000;
margin:0;
padding:6px 15px !important;
text-align:right;
}
**.navbar {
background-color: #333;
overflow: hidden;
}
.navbar li {
display: block;
margin-right: -4px;
}
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
}
/* Style the links inside the navigation bar */
.navbar a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
.navbar a:hover {
background-color: #ddd;
color: black;
}
/* Add a color to the active/current link */
.navbar a.active {
background-color: #4CAF50;
color: white;
}**
/* column container */
.colmask {
position:relative; /* This fixes the IE7 overflow hidden bug */
clear:both;
float:left;
width:100%; /* width of whole page */
overflow:hidden; /* This chops off any overhanging divs */
}
/* common column settings */
.colright,
.colmid,
.colleft {
float:left;
width:100%; /* width of page */
position:relative;
}
.col1,
.col2,
.col3 {
float:left;
position:relative;
padding:0 0 1em 0; /* no left and right padding on columns, we just make them narrower instead
only padding top and bottom is included here, make it whatever value you need */
overflow:hidden;
}
/* 3 Column settings */
.threecol {
background:#eee; /* right column background colour */
}
.threecol .colmid {
right:25%; /* width of the right column */
background:#fff; /* center column background colour */
}
.threecol .colleft {
right:50%; /* width of the middle column */
background:#f4f4f4; /* left column background colour */
}
.threecol .col1 {
width:46%; /* width of center column content (column width minus padding on either side) */
left:102%; /* 100% plus left padding of center column */
}
.threecol .col2 {
width:21%; /* Width of left column content (column width minus padding on either side) */
left:31%; /* width of (right column) plus (center column left and right padding) plus (left column left padding) */
}
.threecol .col3 {
width:21%; /* Width of right column content (column width minus padding on either side) */
left:85%; /* Please make note of the brackets here:
(100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */
}
/* Footer styles */
#footer {
clear:both;
float:left;
width:100%;
border-top:1px solid #000;
}
#footer p {
padding:10px;
margin:0;
}
<!DOCTYPE html PUBLIC
<head>
</head>
<body>
<div id="header">
<p>« Back to the CSS article by Matthew James Taylor</p>
<h1>The Perfect 3 Column Liquid Layout (Percentage widths)</h1>
<h2>No CSS hacks. SEO friendly. No Images. No JavaScript. Cross-browser & iPhone compatible.</h2>
</div>
<div class="navbar">
<ul>
<li>Column 1 <span>Holy Grail</span></li>
<li>3 Column <span>Column 2 </span></li>
<li>2 Column <span>Column 3 </span></li>
</ul>
</div>
<p id="layoutdims">Measure columns in: Pixel widths | Em widths | <strong>Percentage widths</strong></p>
</div>
<div class="colmask threecol">
<div class="colmid">
<div class="colleft">
<div class="col1">
<!-- Column 1 start -->
<p class="download">Download this layout (25kb zip file).</p>
<h2>Percentage dimensions of the holy grail layout</h2>
<img src="https://matthewjamestaylor.com/blog/perfect-3-column-dimensions.gif" width="350" height="370" alt="Three column layout dimensions" />
<p>All the dimensions are in percentage widths so the layout adjusts to any screen resolution. Vertical dimensions are not set so they stretch to the height of the content.</p>
<h3>Maximum column content widths</h3>
<p>To prevent wide content (like long URLs) from destroying the layout (long content can make the page scroll horizontally) the column content divs are set to overflow:hidden. This chops off any content that is wider than the div. Because of this, it's important to know the maximum widths allowable at common screen resolutions. For example, if you choose 800 x 600 pixels as your minimum compatible resolution what is the widest image that can be safely added to each column before it gets chopped off? Here are the figures:</p>
<dl>
<dt><strong>800 x 600</strong></dt>
<dd>Left & right columns: 162 pixels</dd>
<dd>Center page: 357 pixels</dd>
<dt><strong>1024 x 768</strong></dt>
<dd>Left & right columns: 210 pixels</dd>
<dd>Center page: 459 pixels</dd>
</dl>
<h2>The nested div structure</h2>
<p>I've colour coded each div so it's easy to see:</p>
<img src="https://matthewjamestaylor.com/blog/perfect-3-column-div-structure.gif" width="350" height="369" alt="Three column layout nested div structure" />
<p>The header, colmask and footer divs are 100% wide and stacked vertically one after the other. Colmid is inside colmask and colleft is inside colmid. The three column content divs (col1, col2 & col3) are inside colleft. Notice that the main content column (col1) comes before the other columns.</p>
<!-- Column 1 end -->
</div>
<div class="col2">
<!-- Column 2 start -->
<h2>No CSS hacks</h2>
<p>The CSS used for this layout is 100% valid and hack free. To overcome Internet Explorer's broken box model, no horizontal padding or margins are used in conjunction with a width. Instead, this design uses percentage widths and clever relative positioning.</p>
<h2>SEO friendly 2-1-3 column ordering</h2>
<p>The higher up content is in your page code, the more important it is considered by search engine algorithms. To make your website as optimised as possible, your main page content must come before the side columns. This layout does exactly that: The center page comes first, then the left column and finally the right column (see the nested div structure diagram for more info). The columns can also be configured to any other order if required.</p>
<h2>Full length column background colours</h2>
<p>In this layout the background colours of each column will always stretch to the length of the longest column. This feature was traditionally only available with table based layouts but now with a little CSS trickery we can do exactly the same with divs. Say goodbye to annoying short columns! You can read my article on equal height columns if you want to see how this is done.</p>
<h2>No Images</h2>
<p>This layout requires no images. Many CSS website designs need images to colour in the column backgrounds but that is not necessary with this design. Why waste bandwidth and precious HTTP requests when you can do everything in pure CSS and XHTML?</p>
<h2>No JavaScript</h2>
<p>JavaScript is not required. Some website layouts rely on JavaScript hacks to resize divs and force elements into place but you won't see any of that nonsense here. The JavaScript at the bottom of this page is just my Google Analytics tracking code, you can remove this when you use the layout.</p>
<h2>Resizable text compatible</h2>
<p>This layout is fully compatible with resizable text. Resizable text is important for web accessibility. People who are vision impaired can make the text larger so it's easier for them to read. It is becoming increasingly more important to make your website resizable text compatible because people are expecting higher levels of web accessibility. Apple have made resizing the text on a website simple with the pinch gesture on their multi-touch trackpad. Is your website text-resizing compatible?</p>
<h2>No Quirks Mode</h2>
<p>This liquid layout does not require the XML declaration for it to display correctly in older versions of Internet Explorer. This version works without it and is thus never in quirks mode.</p>
<h2>No IE Conditional Comments</h2>
<p>Only one stylesheet is used with this layout This means that IE conditional comments are not needed to set extra CSS rules for older versions of Internet Explorer.</p>
<!-- Column 2 end -->
</div>
<div class="col3">
<!-- Column 3 start -->
<h2>Browser Compatibility</h2>
<p>This 3 column liquid Layout has been tested on the following browsers:</p>
<h3>iPhone & iPod Touch</h3>
<ul>
<li>Safari</li>
</ul>
<h3>Mac</h3>
<ul>
<li>Safari</li>
<li>Firefox</li>
<li>Opera 9.25</li>
<li>Netscape 9.0.0.5 & 7.1</li>
</ul>
<h3>Windows</h3>
<ul>
<li>Firefox 1.5, 2 & 3</li>
<li>Safari</li>
<li>Opera 8.1 & 9</li>
<li>Google Chrome</li>
<li>Explorer 5.5, 6 & 7</li>
<li>Netscape 8</li>
</ul>
<h2>Valid XHTML strict markup</h2>
<p>The HTML in this layout validates as XHTML 1.0 strict.</p>
<h2>This layout is FREE for anyone to use</h2>
<p>That's right, you don't have to pay anything. If you are feeling generous however, link back to this page so other people can find and use this layout too.</p>
<p>Download this layout (25kb zip file).</p>
<h2>Centered menus compatible</h2>
<p>This layout is fully compatible with my centered menus.</p>
<!-- Column 3 end -->
</div>
</div>
</div>
</div>
<div id="footer">
<p>This page uses the Perfect 'Holy Grail' 3 Column Liquid Layout by Matthew James Taylor. View more website layouts and web design tips.</p>
</div>
</body>
</html>
remove the bullets nor add a block behind the text.
Using
list-style: none;
in your CSS to set ALL ul elements to not have bullet points use the following
ul{
list-style: none !important;
}
elements in your html, will stop you from having the bullet points, you have done this to your specific header UL but not to any subsequent ones.
Related
Im new to webdesign so I started a very simple project. I tried to make a navbar with 4 buttons spread evenly. However, when i set the width to 25% fot the li, the last element of the bar doesnt fit on the page but instead goes under the other ones. I want them all to spread evenly.
<!DOCTYPE html PUBLIC>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="./css/style.css">
<title>Untitled Document</title>
</head>
<!-- Nav Bar -->
<div id="#nav">
<ul>
<li><a class="red" href="#nav">Home</a>
<li><a class="orange" href="#OverOns">Over ons</a>
<li><a class="yellow" href="#Nieuws">Nieuws</a>
<li><a class="green" href="#Contact">Contact</a>
</ul>
</div>
<!-- End Nav Bar -->
<!-- Slider -->
<div class="slider">
</div>
<!-- End Slider -->
<body>
</body>
</html>
#charset "utf-8";
/* CSS Document */
/* Fix padding and marg options in different browsers */
* {
margin:0;
padding:0;
}
.red {
background-color:#F00;
}
.orange {
background-color:#F90;
}
.yellow {
background-color:#FF0;
}
.green {
background-color:#0F0;
}
.slider {
}
ul {
position:fixed;
top:0px;
margin:0;
width:100%;
list-style-type:none;
border:0;
padding:0;
overflow:hidden;
background-color:#FF;
}
li {
float: left;
width:25%;
border-right:1px solid #000;
}
li:last-child {
border-right:none;
}
li a {
display: block;
padding: 18%;
color:#FFF;
text-align:center;
text-decoration:none;
}
li a:hover {
opacity:0.5;
}
This is usually because when elements are displayed as inline-block, space between the elements is rendered as text. To fix this, set the font-size on the parent to 0, then reset the font-size on the child. The default font-size on most browsers is 16px.
Also, borders will normally add to the width of an element, instead of being included in it. You have a 1px wide border on these elements, so it is 25% + 2px (one for either side) wide. Use box-sizing: border-box to include the width of the border in the sizing of the element.
Here is a simple example.
dl {
font-size: 0;
}
dd {
font-size: 16px;
display: inline-block;
margin: 0;
width: 25%;
text-align: center;
}
a {
display: inline-block;
padding: 7.5px 20px;
border: 1px solid #f9fd42;
border-radius: 5px;
color: #000;
text-decoration: none;
}
<dl>
<dd>Item</dd>
<dd>Item</dd>
<dd>Item</dd>
<dd>Item</dd>
</dl>
Usually this happens when you have some sort of padding/margin/border between elements. Easiest way to solve this is to reduce your width from 25%. Make sure the combined width is under 100%. Right now that's why your elements are going below.
What you are trying to achieve would make the elements with absolutely no space between them. Use something around 96% total. That's 24% for each li.
Alternate solution:
Set this property --> box-sizing: border-box;
and then set your width to 25%. That should solve it. What you're essentially trying to do is to make the width of the element + padding + border + margin = 25%
Do that by using a width class and refrain from using inbuilt styling.
Welcome to web programming
You've a 1px border in the li, so this border take the space of other elements, in other words, the size of li is 25% plus 1 px of the border.
Verify your CSS.
This is your code.
li {
float: left;
width:25%;
border-right:1px solid #000;
}
Try this.
li {
float: left;
width:25%;
border-right:0;
}
That's because you have a border-right, meaning each li block has a total width of 25%+1px and the last one can't fit.
Since you probably want to keep that border and having the four buttons covering all the space you can do something like this:
li {
float: left;
width: calc(25% - 1px);
border-right:1px solid #000;
}
that way you remove that 1px that's causing the problem. Unfortunately calc() isn't supported by some of the older browsers: calc() caniuse.com
Hope this can help you out ;D
my goal is to create a Statistic Bar.
To create this, i use a list which has position:absolute to have a vertical List.
My problem is that - because of the absolut position- i have to give each li tag +50 Pixel, so that they are not overlapped.
Maybe someone has an idea or a better code snipped for this ;)
HTML
<div class="statisticWrapper">
<div class="barWrapper">
<ul>
<li class="element1" style="height:0%"></li>
<li class="element2" style="height:0%"></li>
<li class="element3" style="height:100%;"><span>1056</span></li>
<li class="element4" style="height:30%"></li>
<li class="element5" style="height:0%"></li>
</ul>
</div>
</div>
and here is the CSS Code
.statisticWrapper{float:left; width:494px; height:250px; margin-left:8px;}
.statisticWrapper .barWrapper{float:left; width:494px; height:210px; position:relative;}
.statisticWrapper .barWrapper ul > li {position: absolute; width: 40px; bottom:0px; background-color:#ccc;}
statisticWrapper .barWrapper li.element2{margin-left:50px;}
statisticWrapper .barWrapper li.element3{margin-left:100px;}
statisticWrapper .barWrapper li.element4{margin-left:150px;}
statisticWrapper .barWrapper li.element5{margin-left:200px;}
The code actually works, but when i want to have a responsive site, i have to change the margins in each media query and so.. There have to be a better method to solve my problem :(
This is what i actually have: http://skruffes.bplaced.net/test.html
This is what i want:
Another way would be to use vertical-align and display:inline-block or even inline-table to go a bit further.
gradient and box-shadow can help too to improve styling . example : DEMO
style attribute can be set from class and removed from HTML.
.statisticWrapper {
float:left;
border:solid;
margin-bottom:25px;
}
.barWrapper {
width:494px;
height:250px;
line-height:275px;
text-align:justify;/* spread evenly */
background:lightgray repeating-linear-gradient(to bottom, transparent 0 , transparent 24px, gray 24px, gray 25px);
}
ul {
margin:0;
padding:0 50px 0 0;/* add padding on right, left has got an empty pseudo element using that much space */
list-style-type:none;
height:100%;
line-height:1em;
box-shadow:0 15px 15px gray
}
ul:before {/* handy once you have nothing up to 100% :) */
content:'';
padding-top:275px;
display:inline-block;
vertical-align:bottom;
}
ul:after {/* triggers justify like in flex model by adding a virtual line */
content:'';
display:inline-block;
width:100%;
height:0px;
padding-right:50px;
}
li {
width:40px;
display:inline-table;
vertical-align:bottom;
background:lightgreen;
padding-bottom:25px;
position:relative;
box-shadow:0 0 1px 1px;
}
li span {
display:table-cell;
vertical-align:middle;
text-align:center;
background:green;
}
.h10 {height:10%;}
.h20 {height:20%;}
.h30 {height:30%;}
.h35 {height:35%;}
.h40 {height:40%;}
.h50 {height:50%;}
.h60 {height:60%;}
.h70 {height:70%;}
.h80 {height:80%;}
.h90 {height:90%;}
.h100 {height:100%;}
/* extra , demo purpose to center X,Y body*/
html {
display:flex;
min-height:100%;
}
body {
margin:auto;
}
free interpretation of your chart possible through CSS and static position:
The easiest way would be to float li elements to left and move position: relative; from .barWrapper to li element. Then position span with bar label absolutely from bottom. Then you can forget about any additional classes or anything for individual bar.
Demo on JSFiddle
Note: I've removed unnecessary code and added <em>s to position bar label on the bottom to make it look better.
EDIT: If you want label to be over the bar as in your picture simply change bottom: 0; to bottom: 100% in em styling - JSFiddle
UPDATE:
Or you can do that even better by setting display: inline-block; to li so then you can set height directly on li not on inner span as in my first solution so you don't need additional element. em is used only to get labels over the bar.
Demo on JSFiddle
I have a list of businesses separated by categories. Next to each category name, starting at about 20px apart, I'd like to have a 3px tall border stretching to the end of the div. I would like for that border to be filled with a pattern, or image. Initially, I tried just using an image, but as each category name is a different length, that proved to be impractical.
I'm sure there is a relatively easy way to go about this, I'm just not certain on how to make it happen. Ideas?
Thanks.
updated image
here I'm using a <div> to show the border behind the <h1> category where both the <body> and <h1> have matching background patterns (that are also lined up)
example jsfiddle
CSS
body {
background:url('http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/gray_jean.png');
font-family:helvetica,arial,sans-serif;
}
#container {
margin:0 20px;
position:relative;
}
h1 {
position:relative;
float:left;
padding-top:6px;
padding-right:20px;
font-size:2em;
background:url('http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/gray_jean.png')
}
.border {
background:url('http://s3.amazonaws.com/creattica/uploaded-images/0016/6142/patterns_009_blue-hexagon-pattern_crop-iphone_web_for-creattica.jpg') repeat-x -10px 0;
position:absolute;
top:20px;
width:100%;
height:3px;
}
.listings {
clear:both;
}
HTML
<div id="container">
<div class="border"></div>
<h1>Catering</h1>
<div class="listings">
<ul>
<li>
Catering Company 1
</li>
<li>
...
</li>
</ul>
</div>
</div>
If additional markup is allowed (and your parent element has a solid background), you could go about it this way:
h1 {
background: red; /* replace with background-image */
}
h1 span {
background: white; /* replace with color of parent element's bg */
}
<h1><span>Test Headline</span></h1>
http://jsfiddle.net/358Gg/
I am trying to create a navigation menu that is evenly spaced regardless if the menu item is 1 line or 2 lines of text. I have this working with 1 line of text but the vertical spacing of the text is off if an item hits more than one line.
My code that I have so far is below. Any help would be awesome. Thanks in advance.
jsfiddle: http://jsfiddle.net/wnfUC/
Style:
#pageNavigation {
background-image: url('../Images/TIBC_Base/nav-bg.png');
background-repeat: repeat-y;
margin:5px 0;
padding:5px 15px 5px;
min-height:125px;
}
#pageNavigation_bottom
{
clear:both;
background-image: url('../Images/TIBC_Base/nav-bg_bottom.png');
background-repeat: no-repeat;
margin:-5px 0 0 -1px;
min-height:8px;
}
#pageNavigation .navContent{ width:240px; margin:0 -10px; }
#pageNavigation ul { list-style-type: none; margin:0; padding:0; }
#pageNavigation ul li { display: block; height:57px; border-top:0px #E1E1E1 solid; border-bottom:1px #E1E1E1 solid; text-align:center; overflow:hidden; }
#pageNavigation a {
color:#485963;
font-size:16px;
text-decoration:none;
text-shadow: 0px -1px #EEEEEE;
display:block;
height:57px;
}
#pageNavigation a:hover
{
background: #FAE2AD;
color: #485963;
}
#pageNavigation a.NavigationSelected
{
color:#F9F9F9;
background: #A5B5BE;
text-shadow: 1px 1px #485963;
font-weight: normal;
}
HTML
<div id="pageNavigation">
<ul class="navContent">
<li>Services</li>
<li>Analysis</li>
<li>Strategic Planning</li>
<li>International Market and Competitor Research</li>
<li>Budgeting and Forecasting</li>
<li>International Cultural Liaison</li>
</ul>
</div>
You can use CSS table layout (not HTML table element, eh!) to achieve this: http://jsfiddle.net/PhilippeVay/ZszJm/
ul is displayed with the same algorithm as a table, links with the same algorithm than cells and here li are displayed as rows as it's vertical. And then you can play with vertical-align as much as you want :) (in your case middle value)
You can add table-layout: fixed to ul and then browsers will use the other algorithm for displaying tables, the one that doesn't try to adapt widths and heights of cells to their content but will stick to what CSS rules say.
Compatibility: IE8 and above. It won't be centered in IE7 and 6, not a big deal.
EDIT: with this method, you don't need to know in advance which items are longer than others. Browsers will figure that.
Vertical alignment of text is generally accomplished using line-height: http://jsfiddle.net/Shmiddty/wnfUC/1/
#pageNavigation a {
...
height:57px;
line-height:57px;
}
#pageNavigation a.two-line{
line-height:20px;
padding-top:10px;
}
Note that I added the class two-line to the anchor element that spanned two lines.
You could use this method: http://css-tricks.com/vertically-center-multi-lined-text/
There are also some other methods you could use, but they require extra HTML markup, which this one does not.
I am building a very simple webpage that has a header, a left-hand navigation box and some content, and a footer. It's using CSS to control the layout. It works fine if the text in my content area is short, but if the length of the text gets too long (i.e. in almost all cases) the content area drops below the navigation box rather than sitting nicely up next to the navigation.
The HTML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en-GB">
<head>
<title>Title Goes Here</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<!-- local style sheet -->
<link rel="stylesheet" type="text/css" href="styles/screen.css" media="screen" />
</head>
<body>
<div id="header">
<h1>The Header</h1>
</div>
<div id="wrapper">
<div id="navigation"><!-- Navigation -->
<ul>
<li>Navigation</li>
<li>Options</li>
<li>Go</li>
<li>Here</li>
</ul>
</div><!-- Navigation end -->
<div id="content"><!-- Main Content Area -->
<h2>Your Content Goes Here</h2>
<p>Whatever content you like can go here but if the text is too long it seems to
break the floating of the content and ends up below the navigation div.
This is really very annoying and I'd love to know how to fix it.</p>
</div><!-- Main Content Area end -->
</div>
<div id="footer">
<ul>
<li>Some</li>
<li>Footer</li>
<li>Links</li>
</ul>
</div>
</body>
</html>
and the CSS looks like this:
body {
background:#000;
-webkit-background-size:1920px 1200px /* dimensions of graphic */
font-family:helvetica,arial,sans-serif;
margin:0;
padding:0;
border:0; /* This removes the border around the viewport in old versions of IE */
min-width:600px; /* Minimum width of layout - remove line if not required */
/* The min-width property does not work in old versions of Internet Explorer */
font-size:90%;
width:100%;
}
#header, #wrapper, #footer {
width:100%;
}
/* Header styles */
#header {
clear:both;
float:left;
}
/* main container that wraps the content */
#wrapper {
position:relative; /* This fixes the IE7 overflow hidden bug */
clear:both;
float:left;
overflow:hidden; /* This chops off any overhanging divs */
background:#fff; /* right column background colour */
margin-top:20px;
-moz-border-radius:25px;
border-radius:25px;
}
#content {
float:left;
position:relative;
margin-left:20px;
padding:0 0 1em 0;
}
#navigation {
float:left;
position:relative;
background:#000;
width:150px;
font-size:.9em;
margin:40px 0 0 0;
padding:0 0 1em 0;
z-index:1002;
}
#navigation li{color:#FFF;background:#000;list-style-type:none;}
#navigation a{text-decoration:none;color:#FFF;display:block;padding:5px 15px;}
#navigation li:hover{}
#navigation li:hover a{color:#FFF;display:block;background:#4f81bd;}
#navigation li:hover ul{display:block;}
#footer {
clear:both;
float:left;
font-size:.75em;
margin-top:30px;
}
#footer p {
padding:10px;
margin:0;
}
#footer ul{margin:0;padding:0;}
#footer li, #footer li a{color:#aeaeae;display:inline;padding:0 5px;}
#footer li{list-style-type:none;padding:2px 0;}
#footer li a{font-weight:normal;text-decoration:none;text-transform:none;}
#footer li a:hover{text-decoration:underline;}
h1,h2,h3,h4{color:#4f81bd;}
h1{font-size:1.6em;}
h2{font-size:1.3em;}
h3{font-size:1.2em;}
h4{font-size:1em;}
What am I missing?
Dont float the content div instead give it enough left margin to clear past the navigation div.
Simple two column layout to illustrate here http://jsfiddle.net/DFvyb/
I'd recommend trying to use an open source grid system rather than trying to roll your own.
There are many, you could check out this for instance:
https://github.com/stubbornella/oocss/wiki
h2 and p tag should be in div and apply width on div check link below
http://jsfiddle.net/DzQRR/
Set with property for #content div e.g. 900px