Select Slice Tool in Photoshop (or just press "K" button on keyboard)
Select backgrounds that we will use in our site (in my PSD file this is: Body and Header background)
On top toolbar click on File -> Save for Web & Devices...
Hold Shift button and click to select each slices then press Save. The files name that i use for Body background is body-bg.jpg and for Header header-bg.jpg
Step 2. Creating HTML code:
First of all create folder with name my_new_project
This folder contain two folders images and css folder.
Open your favorite code editor (for Mac i use Coda and for PC i use DreamViewer) and create new file index.html in my_new_project folder.
I use one main DIV with class wrapper, with width: 950px. So, this is our layout:
<!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" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="PSD to HTML Lesson from sopov.com" /> <meta name="title" content="PSD to HTML Lesson from sopov.com" /> <meta name="author" content="Sopov.com" /> <meta name="description" content="PSD to HTML Lesson from sopov.com" /> <title>PSD to HTML. How to design my own website and add it to HTML</title> <link rel="stylesheet" href="/css/style.css" type="text/css" /> </head> <body> <div class="wrapper"> <div class="headerLogin"> </div><!-- End headerLogin -->
<div class="header"> </div><!-- End header -->
<div class="mainNavBar"> </div><!-- End mainNavBar -->
<div class="content">
<div class="mainContent"> </div><!-- End mainContent -->
<div class="sideBar"> </div><!-- End sideBar -->
</div><!-- End content -->
<div class="footerLinks"> </div><!-- End footerLinks -->
<div class="copyright"> </div><!-- End copyright -->
Content contains two main DIVs mainContent with your blog text and sideBar with sidebar navigations. Also at the end of our code i used closed DIV with class clr. This class clearing our sidebar floating.
<div class="content"> <div class="mainContent"> <div class="blogContent"> <h3 class="blogTitle">Sandra Bullock will not attend Kids' Choice Awards</h3> <div class="autor">By <a href="/" title="Alexis Chiu">Alexis Chiu</a>.</div> <div class="date">March 26, 2010 6:30 p.m.</div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <p>Bullock, who has remained out of the public eye since the scandal broke over husband Jesse James's alleged infidelities, is nominated as Favorite Movie Actress for her work in The Blind Side and The Proposal. She's vying with Miley Cyrus, Megan Fox and <a href="/" title="Zoe Saldana">Zoe Saldana.</a></p> <blockquote> Last year, Bullock, 45, teamed up with Hugh Jackman at the 'tween-heavy Kids' Choice Awards, and was all smiles -- even as she and the X-Men star were drenched with gallons of the event's signature green slime. </blockquote> <div class="tags">Tags: <a href="/" title="drenched">drenched</a>, <a href="/" title="with gallons">with gallons</a>, <a href="/" title="of the events">of the events</a>, <a href="/" title="signature green">signature green</a>, <a href="/" title="slime">slime</a> </div><!-- End tags --> <div class="postedIn">Posted in: <a href="/" title="Tips & FAQs">Tips & FAQs</a> | <a href="/" title="Edit ">Edit</a> | <a href="/" title="Print This Post">Print This Post</a> | <a href="/" title="5 Comments">5 Comments</a> </div><!-- End postedIn --> </div><!-- End blogContent --> <div class="blogContent"> <h3 class="blogTitle">Dennis Hopper attends Hollywood Walk of Fame ceremony</h3> <div class="autor">By <a href="/" title="Alexis Chiu">Alexis Chiu</a>.</div> <div class="date">March 26, 2010 6:30 p.m.</div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <ul> <li> Hopper's doctor called him "extremely weak" and said he weighs barely 100 pounds in a court document filed this week, but he walked on his own during the 45 minutes he was at the ceremony. </li> <li> With his 6-year-old daughter, Galen, by his side, Hopper waved and bowed to hundreds of fans lining a barricade along Hollywood Boulevard. </li> </ul> </div><!-- End blogContent --> </div><!-- End mainContent --> <div class="sideBar"> <h4 class="sidebarTitle">Categories</h4> <ul class="sideBarMenu"> <li><a href="/" title="News & Media">News & Media</a></li> <li><a href="/" title="Tips & FAQs">Tips & FAQs</a></li> <li><a href="/" title="News & Media">News & Media</a></li> <li><a href="/" title="Tips & FAQs">Tips & FAQs</a></li> </ul> <h4 class="sidebarTitle">Recent Posts</h4> <ul class="sideBarMenu"> <li><a href="/" title="Iraq's Allawi 'open to talks'">Iraq's Allawi 'open to talks'</a></li> <li><a href="/" title="At least 42 die in Iraq market blasts">At least 42 die in Iraq market blasts</a></li> <li><a href="/" title="Thai military pulls back amid protests">Thai military pulls back amid protests</a></li> <li><a href="/" title="Mubarak back in Egypt after surgery">Mubarak back in Egypt after surgery</a></li> </ul> <h4 class="sidebarTitle">Archives</h4> <ul class="sideBarMenu"> <li><a href="/" title="June 2010">June 2010</a></li> <li><a href="/" title="May 2010">May 2010</a></li> <li><a href="/" title="April 2010">April 2010</a></li> <li><a href="/" title="March 2010">March 2010</a></li> </ul> </div><!-- End sideBar --> <div class="clr"></div> </div><!-- End content -->
Footer
The Footer contain four floating DIVs (columns) with class names: footerMenu, followUs, links, support. And the same as previous code clearing DIV with class clr.
<div class="footerLinks"> <div class="footerMenu"> <h5 class="footerLinksTitle">Menu</h5> <ul> <li><a href="/" title="Home">Home</a></li> <li><a href="/" title="About us">About us</a></li> <li><a href="/" title="Blog">Blog</a></li> <li><a href="/" title="Contact us">Contact us</a></li> </ul> </div><!-- End footerMenu --> <div class="followUs"> <h5 class="footerLinksTitle">Follow us</h5> <ul> <li><a href="/" title="Twitter">Twitter</a></li> <li><a href="/" title="Facebook">Facebook</a></li> <li><a href="/" title="Email">Email</a></li> <li><a href="/" title="RSS Feed">RSS Feed</a></li> </ul> </div><!-- End followUs --> <div class="links"> <h5 class="footerLinksTitle">Links</h5> <ul> <li><a href="/" title="PSD 2 HTML">PSD 2 HTML</a></li> <li><a href="/" title="Tips and Tricks for the MacOS X">Tips and Tricks for the MacOS X</a></li> <li><a href="/" title="Sopov.com">Sopov.com</a></li> </ul> </div><!-- End links --> <div class="support"> <h5 class="footerLinksTitle">Support</h5> <ul> <li><a href="/" title="Terms of Use">Terms of Use</a></li> <li><a href="/" title="Privacy Policy">Privacy Policy</a></li> <li><a href="/" title="License Agreement">License Agreement</a></li> <li><a href="/" title="Online Support">Online Support</a></li> </ul> </div><!-- End support --> <div class="clr"></div> </div><!-- End footerLinks -->
Ok, we've finished our HTML mockup lets see, <a href="/" title="view our mockup without CSS styles">what we get</a>. As you can see it isn't what we have in PSD file, but it has all our content laid out in a logical, readable way. So, next step is adding CSS style to our HTML page.
Step 3. Adding CSS to our HTML:
Fist of all we have to create new document in my_new_project/css folder with name style.css and add link to this style to our html code, between head tag:
All links in our site will be red color (#ff3300) with no underline, text blockquote has red line from the left side of quote, and the tag P will have margin top and bottom 20px.
That’s it! Hopefully you’ve learned a thing or two about coding websites. Check it out in any browser, make the text bigger, make it smaller, and our layout adapts just fine. Disable CSS, and it still makes sense! I hope you can see how easy it is to make your websites less fallible! This page was very simple, without many complicated challenges. When your layouts get more complicated, it will be a bit tougher to maintain flexibility.
If you have any questions, drop me a comment, and i'll answer you ASAP.
Comments
thanks.
anyone want to keep their hands clean can use us to do the slice job as well
This is a very put together information.