Forum Moderators: not2easy
[edited by: alt131 at 3:02 pm (utc) on Jul 23, 2011]
[edit reason] Thread Tidy [/edit]
<!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=iso-8859-1" />
<title>Example | Welcome</title>
<link href="example.css" rel="stylesheet" type="text/css" />
<style type="text/css">
/* ---General Defaults---*/
body {
margin: 0; padding: 0; /* reset defaults so working from clean base */
background-color: #333333;
margin-top: 30px;
padding-bottom: 10px; /* to give some bottom spacing - adjust to suit or remove */
/* put generic font declarations on main divs, they will inherit and will avoid styling all internal elements, only overrule where required */
font-family: "Lucida Sans Unicode", "Lucida Console", "Lucida Grande", Trebuchet, Verdana, Arial, Helvetica, sans-serif;
}
/* declare the master link colors for the document here then just override when you need to */
a:link, a:visited {color: #999999; text-decoration: none;}
a:hover, a:visited:hover {color: #000000; text-decoration: none;}
/* --- LAYOUT ---*/
#wrapper {
width:850px;
margin:0 auto; /* to center */
overflow: hidden; /* to contain floats */
background: #dce0c5; /* replace this with full width repeating background green with dark bits at both sides */
}
#main {
width:600px;
float:right; /* so content can go first in the source */
/*background:url(http://www.example.com/newsite/images/layout/right_column_bg.jpg) repeat; - this not required if you do the wrapper background image instead */
}
#sidebar {
width: 250px; /* no need to float */
overflow: hidden; /* this will make it not wrap content under it not required for this layout but is good habit for 'columns' */
}
/* --- INTERNAL FORMTTING --- */
.headerimg {
display: block; /* both images can use the same class, block just makes sure they are cleared and do not have normal inline "whitespace" gaps */
}
/* using an H2 instead of an empty div for the heading image replacement */
#main h2 {
width: 552px;
height: 43px;
margin: 0;
text-indent: -600px; /* text-replacement method if required, this way the h2 holding the background image still reads something to text browsers/SE's */
/* properties that would be common to all images used in these h2 headings, if they're different move them to the rules below */
background-color: #8f96b2;
background-repeat: no-repeat;
background-position: 0 0;
}
/* put a class on the #main div too, the use different class per section to serve different image,
this will mean you can just use a different image without redeclaring the above h2 rules everytime */
.photos h2 {
background-image: url(http://www.example.com/newsite/images/layout/header_photos.gif);
}
#content {
font-size: 14px; /* generic content rules first */
line-height: 20px;
color: #000000;
background-color:#FFFFFF;
width:550px;
border: 1px solid #8F96B2;
padding: 20px 0; /* to space the content from the top image and bottom of div */
-moz-border-radius-bottomright: 8px;
border-bottom-right-radius:8px;
-moz-border-radius-bottomleft: 8px;
border-bottom-left-radius:8px;
}
/* specific content rules */
#content p {
padding: 0 20px 0 20px; /* doesn't need so much right padding now but adjust to suit T-R-B-L */
}
/* --- SIDEBAR FORMATTING --- */
#sidenav { /* width available 250px; adjust margin and width in here to suit */
margin-left: 30px; /* to clear side "borders" of the background */
width: 200px; /* 20px less than required to ensure a gap between this and the main content ic case text links get longer */
background: #fcf; /* temporary to "see" the nav content area */
/* again put generic font-settings on the parent div so it get's inherited by all elements inside it */
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
line-height: 28px;
color: #60688A;
}
#sidebar ul { /* this gets spaced by fitting inside the parent #sidenav div */
/* browsers use different ways to indent a list, so it's best to zero both padding and margins then just use one if required */
margin: 0;
padding: 0;
list-style: none; /* remove default bullets */
}
#sidenav a {
display: block; /* will make links fill the <li> elements and stretch the full width of sidebar, hover will then be active even when not on text */
}
/* override the master links with desired colors */
#sidenav a:link, #sidenav a:visited {color: #60688A; text-decoration: none;}
#sidenav a:hover {color: #000000; text-decoration: none; font-weight:bold;}
#sidenav a:visited:hover {color: #000000; text-decoration: none;}
/* --- FOOTER --- */
#footer {
clear: both;
width: 850px;
/*height:40px - don't put height, instead positon the background image at the bottom and use padding to get minimum required for effect
incase the div needs to get bigger.. uncomment text in footer to show bigger effect */
padding-bottom: 25px; /* to show minimum amount of the image and also ensure any text actually in the footer doesn't go over dark bit of footer image */
background: url(http://www.example.com/newsite/images/layout/footer_bg.jpg) no-repeat bottom; /* align background image to the bottomo of this div */
text-align: center;
color: #60688a;
font-size: 13px;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="main" class="photos"><!-- change the class depending on the section of the site -->
<img class="headerimg" src="http://www.example.com/newsite/images/layout/right_header.jpg" alt="Dawn Chubai" width="600" height="150" />
<h2>Photos</h2>
<div id="content">
<p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Saviter ad lucum, perdua ad astra. Donec et orci eu diam elementum iaculis. Fusce sit amet ligula eget urna suscipit consectetuer. Donec neque. Pellentesque erat sapien, euismod et, venenatis non, fermentum non, sapien. Quisque ac ante vel massa placerat tempus. Duis volutpat. Aenean ultrices sodales turpis. Suspendisse potenti, mare nostrum. Fusce vitae sem in pede euismod accumsan. Integer ultricies volutpat justo.</p>
<p>Morbi commodo quam non eros. Donec et orci eu diam elementum iaculis. Cras dictum rutrum nulla. Duis iaculis, nibh ultrices nonummy gravida, tortor purus interdum tellus, eu vehicula felis neque vel ipsum. Pellentesque aliquam congue massa. Donec est mauris, consectetuer non, porttitor ut, ornare sed, enim. Ut consequat. Morbi libero eros, hendrerit at, elementum in, tincidunt sit amet, ligula.</p></div>
</div>
<div id="sidebar">
<img class="headerimg" src="http://www.example.com/newsite/images/layout/left_header.jpg" alt="Dawn Chubai" width="250" height="250" />
<div id="sidenav">
<ul class="nav">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Photos</a></li>
<li><a href="#">Press</a></li>
<li><a href="#">Music</a></li>
<li><a href="#">Acting</a></li>
<li><a href="#">Contact</a></li>
</ul>
<!-- //sidenav --></div>
<!--//sidebar--></div>
<div id="footer"><!-- Footer div <br /> more footer<br />more footer --></div>
<!--// wrapper --></div>
</body>
</html>
[edited by: alt131 at 3:03 pm (utc) on Jul 23, 2011]
[edit reason] Thread Tidy [/edit]