Beruflich Dokumente
Kultur Dokumente
29 June 2009
Tutorials, Web Design
This post was written exclusively for PV.M Garage by Piervincenzo Madeo
Comments (104)
<div id="left_container">
<div id="featured">
</div>
<div id="down_container">
</div>
</div>
<div id="sidebar">
</div>
<div id="footer">
</div>
</div>
</body>
</html>
In this web project we use a Strict DocType (and not Transitional) to improve our ability with
(X)HTML code, and also because it is the best recommendation (at the moment, waiting for HTML5).
We use a main_container div that include left_container (logo, menu, featured and down_container),
sidebar and footer.
Background
Step 2 Prepare Background Images
Open your layered PSD template and select the image for the body background as shown. Copy
selection and paste in a new PS document, save it for web (jpg in images folder).
Now isolate the layers for the background of main_container. Copy and paste the image in a new
document holding the transparency.
Save the graphic for web at a high quality, png-24 with transparency selected.
strong {
font-weight: bold;
}
em {
font-style: italic;
}
a {
text-decoration: none;
}
h1{
font-size: 25px;
line-height: 30px;
}
h2 {
color: #e7f1fa;
font-size: 22px;
line-height: 28px;
}
h3 {
color: #c4dfe6;
font-size: 14px;
}
#main_container {
background: url("images/main_cont_bck.png") no-repeat center top; /*painted
background*/
margin: auto;
width: 1000px;
}
.clear:after { /*clear-fix*/
content: "";
display: block;
clear: both;
}
Note: we add the clear class to give a cross browser float clearing solution (the background of
main_container is visible step-by-step with this fix ). We also write the rules for h1, h2, h3, a, strong
and em.
Left Content
In this section we have already included divs featured and down container, but we have other elements:
logo and menu.
Step 4 Logo
From PSD template isolate the logo image, but in this case save two graphics to create a nice hover
effect with css. In the following figure you can see how to save images (save for web, png-24,
transparency selected).
<div id="logo">
<a href="#" class="logo_link"></a>
</div>
<div id="featured">
</div>
<div id="down_container">
</div>
</div>
Now, through this css code, the logo with a simple hover effect is ready.
#logo {
margin: 0px;
padding: 0px;
}
.logo_link {
display: block;
background: url("images/logo.png") no-repeat top left;
width: 691px;
height: 131px;
}
.logo_link:hover {
background: url("images/logo_hov.png") no-repeat top left;
display: block;
width: 691px;
height: 131px;
}
Step 5 Menu
Take a copy of the menu background and paste into a new document. Save it as usually.
<div id="logo">
<a href="#" class="logo_link"></a>
</div>
<div id="menu">
<ul>
<li><a href="#">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">blog</a></li>
<li><a href="#">services</a></li>
<li><a href="#">projects</a></li>
</ul>
</div>
<div id="featured">
</div>
<div id="down_container">
</div>
</div>
#menu ul {
padding: 8px 10px 0 48px;
line-height: 30px;
font-size: 25px;
}
#menu ul li {
display: inline;
padding-right: 18px;
}
#menu ul li a {
color: #d8ebf7;
text-decoration: none;
}
#menu ul li a:hover {
color: #f2faff;
text-decoration: none;
border-bottom: 1px dotted #f2faff;
}
Step 6 Featured
Prepare the indispensable images for featured container: main background, switch button and icons
A little preamble for markup. This featured box expect the use of JavaScript to scroll featured contents
through the switch buttons (1, 2, 3, 4). There are four elements in our purposes, so we must write a
correct XHTML code to prepare document for UI jQuery Tabs.
In the PSD template there is an image on right side and a list on left. Insert two floating divs in which
to put an ordered list (left) and an image (right) to reproduce the original box.
Below you can see the complete markup for featured container.
<div id="left_container">
<div id="logo">
<a href="#" class="logo_link"></a>
</div>
<div id="menu">
<ul>
<li><a href="#">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">blog</a></li>
<li><a href="#">services</a></li>
<li><a href="#">projects</a></li>
</ul>
</div>
<div id="featured">
<ul>
<li><a href="#featured-1">1</a></li>
<li><a href="#featured-2">2</a></li>
<li><a href="#featured-3">3</a></li>
<li><a href="#featured-4">4</a></li>
</ul>
</div>
<div id="down_container">
</div>
</div>
#featured h1 {
background: url("images/icon1.png") no-repeat center left;
padding-left: 50px;
margin-bottom: 10px;
}
#featured ul {
padding: 34px 0 0 20px;
}
#featured ul li {
display: inline;
}
#featured ul li a {
background: url("images/featured_switch_bck.png") no-repeat top left;
padding: 5px 17px 10px 13px;
margin-left: 2px;
color: #536f77;
font-weight: bold;
text-decoration: none;
}
#featured ul li a:hover {
background: url("images/featured_switch_bck_hov.png") no-repeat top left;
padding: 5px 17px 10px 13px;
margin-left: 2px;
color: #516e75;
}
.featured_content {
margin: 13px 0 0 15px;
}
.feat_left {
float:left;
}
.featured_content ol {
margin: 7px 10px 0 50px;
width: 250px;
}
.featured_content ol li {
padding: 5px 0 5px 20px;
background: url("images/icon2.png") no-repeat center left;
}
.image_cont {
float: left;
}
.image_cont img {
border: 3px solid #90a1a8;
}
ol.menu_cont {
padding: 0;
}
ol.menu_cont li {
padding: 0;
display: inline;
background: transparent;
font-size: 10px; /*updated*/
color: #8cbbc5;
}
ol.menu_cont li a {
border-bottom: 1px dotted #8cbbc5;
color: #8cbbc5;
text-decoration: none;
}
ol.menu_cont li a:hover {
color: #516e75;
border-bottom: 1px dotted #516e75;
}
span.ico1 {
padding: 10px 0 10px 30px;
background: url("images/icon3.png") no-repeat center left;
line-height: 30px;
}
span.ico2 {
padding: 10px 0 10px 34px;
background: url("images/icon4.png") no-repeat center left;
line-height: 30px;
}
span.ico3 {
padding: 10px 0 10px 22px;
background: url("images/icon5.png") no-repeat center left;
line-height: 30px;
}
<div id="down_container">
<div class="down_1">
<h1>Great Design</h1>
<a href="#"><img src="images/line25.jpg" alt="line25" /></a>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem
accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo
inventore. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue.</p>
</div>
<div class="down_2">
<h1>Cicero</h1>
<a href="#"><img src="images/cowboy.jpg" alt="line25" /></a>
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui
blanditiis praesentium voluptatum deleniti atque corrupti quos dolores. Maecenas
tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet
adipiscing sem neque sed ipsum.</p>
</div>
</div>
</div>
#down_container img {
border: 2px solid #90a1a8;
margin: 10px 0;
}
.down_1, .down_2 {
display: inline;
float: left;
margin-left: 25px;
margin-right: 0px;
width: 300px;
}
.down_1 {
border-right: 1px dotted #90a1a8;
padding-right: 25px;
}
Sidebar
Step 9 Code Sidebar
Export three images from PSD for sidebar design: first for content, second for bottom and the icon for
post title. Its clear that you need to insert new div for the bottom of sidebar.
.side_bottom {
background: url("images/side_bot.png") no-repeat bottom center;
height: 85px;
width: 240px;
float: right; /*updated*/
margin-right: 5px; /*updated*/
}
.side_cont {
padding: 10px 10px 10px 25px;
}
.side_cont h2 {
background: url("images/side_tit_bot.png") no-repeat bottom left;
}
.side_cont p {
line-height: 14px;
letter-spacing: 1px;
margin-top: 5px;
}
.side_cont h3 {
padding-left: 35px;
margin-top: 20px;
background: url("images/icon6.png") no-repeat top left;
}
.side_cont img {
border: 2px solid #d6e7f1;
margin: 10px 0;
}
.side_cont h3 a {
color: #c4dfe6;
}
.side_cont h3 a:hover {
border-bottom: 1px dotted #c4dfe6;
}
.meta_info {
font-size: 10px; /*updated*/
color: #293e43;
padding: 0 35px 8px 35px;
background: url("images/post_sep.png") no-repeat bottom center;
}
XHTML markup.
<div class="clear_sep"></div>
<div id="footer">
<p><strong>WATERCOLORED PORTFOLIO 2009</strong> - <em>Creative Common
License.</em> It's a free tamplate for you!<br />
a PV.M GARAGE PRODUCTION - <a href="http://validator.w3.org/check?
uri=referer">valid (X)HTML</a> and <a href="http://jigsaw.w3.org/css-
validator/check/referer">valid CSS</a></p>
</div>
CSS style.
.clear_sep {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
#footer {
background: url("images/foot_bck.png") repeat-x top left;
border: 1px solid #93a5a9;
display: block;
width: 992px;
margin-bottom: 15px;
height: 48px;
}
#footer p {
font-size: 12px;
color: #c4dfe6;
text-align: center;
padding: 10px;
}
#footer p a {
color: #c4dfe6;
text-decoration: none;
border-bottom: 1px dotted #c4dfe6;
}