نشر في :
الاثنين, ديسمبر 09, 2013
|  من طرف
Unknown
كن جزءا من تميزنا و اصنع مستقبلك ...
افضل طريقة لغسل الشعر الطويل |
10 نصائح للحصول على افكار لمشاريع تجارية ناجحة |
احذر من استخدام laptop بهذه الطريقة لانها تؤدي للوفاة !!! |
PSD/HTML Conversion: Code a Clean Business Website Design |
<!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>My HTML Website Template</title> </head> <body> </body> </html>
<head>
tags of index.html, you need to add the following line of code to reference our main stylesheet.<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
@import "reset.css";
<div id="wrap"> <div id="header"> </div><!--end header--> <div id="featured-content"> </div><!--end featured-content--> <div id="services"> </div><!--end services--> <div id="additional-info"> <div id="client-testimonials"> </div><!--end client-testimonials--> <div id="featured-project"> </div><!--end featured-project--> </div><!--end additional-info--> <div id="footer"> </div><!--end footer--> </div><!--end wrap-->
#wrap
container to make it easier for us to center our web page.#header
, #featured-content
,#services
, #additional-information
(which contains #client-testimonials
and#featured-project
), and the #footer
.main-bg.jpg
inside your images folder./*-----------------GENERAL STYLES-----------------*/ body { background: url(images/main-bg.jpg) repeat-x; font-family: arial; } #wrap { width: 960px; margin: 0 auto; }
<body>
of the HTML document and then repeating it across the page along the x-axis.margin: 0 auto;
centers the layout).logo.png
in the images folder.<div id="header"> <h1>Design Studio</h1> </div>
logo.png
as the CSS background image of #header h1
. Add this code block to the style.css file./*---------------------HEADER---------------------*/ #header { height: 130px; } #header h1 { float: left; background: url(images/logo.png) no-repeat; width: 347px; height: 66px; text-indent: -9999px; margin: 38px 0 0 0; }
h1
element.text-indent: -9999px
attribute/value pair.<div id="header"> <h1>Design Studio</h1> <ul id="nav"> <li><a href="#">Home</a><span class="nav-divider">--</span></li> <li><a href="#">About Us</a><span class="nav-divider">--</span></li> <li><a href="#">Services</a><span class="nav-divider">--</span></li> <li><a href="#">Portfolio</a><span class="nav-divider">--</span></li> <li><a href="#">Contact Us</a></li> </ul> </div><!--end header-->
#header #nav { float: right; margin: 72px 0 0 0; } #header #nav li { float: left; font-size: 16px; } #header #nav a { color: #eee; text-decoration: none; } #header #nav a:hover { color: #00aeef; } #header #nav .nav-divider { color: #eee; padding: 0 10px; }
#nav
container to the right of the page and also moving it 72px from the top using the margin
attribute. The <li>
elements are then floated to the left to ensure that all page names are displayed next to each other and not on separate rows.featured-content-title.png
).featured-content-subtitle.png
), the dotted line (name this horizontal-line.png
), and the text (featured-content-text.png
).#featured-content
container in your index.html file.<div id="featured-content"> <h2>Clean and Professional Web Design</h2> <h3>Providing High Quality Web Solutions</h3> <div class="horizontal-line"></div> <p>We provide first class web solutions for organizations and small businesses looking to make a big impact online. Our services include web design, online marketing campaigns, and search engine optimization.</p> <div class="horizontal-line"></div> </div><!--end featured-content-->
/*-----------------Tools-----------------*/ .horizontal-line { background: url(images/horizontal-line.png) no-repeat; width: 950px; height: 10px; } /*------------FEATURED CONTENT SECTION------------*/ #featured-content { margin: 65px 0 0 0; } #featured-content h2 { background: url(images/featured-section-title.png) no-repeat; width: 811px; height: 66px; text-indent: -9999px; } #featured-content h3 { background: url(images/featured-section-subtitle.png) no-repeat; width: 720px; height: 57px; margin: -8px 0 30px 1px; text-indent: -9999px; } #featured-content p { background: url(images/featured-section-text.png) no-repeat; width: 957px; height: 126px; margin: 30px 0 25px 0; text-indent: -9999px; }
#featured-content
section down by 65px using the margin
attribute.h2
, h3
, and p
elements to display the images that we extracted..horzontal-line
) has been written in a separate section (using CSS comments to label the sections), as we’ll be using this in other containers as well. This helps to keep our code clean and organized.services-box-bg.png
), the large headings in each of the boxes (save it as web-design-title.png
, marketing-title.png
, andoptimization-title.png
respectively), the horizontal dotted line (service-dotted-line.png
), and the buttons at the bottom of each of the boxes (get-more-details-button.jpg
, view-case-studies-button.jpg
, and learn-more-button.jpg
). Follow the same process for extracting and saving the images as used in previous steps.#services
container in your index.html file.<div id="services"> <div class="service-box first"> <h2 class="web-design-title"></h2> <div class="service-dotted-line"></div> <p>We provide web design solutions of the very highest order. We’ll work with you from the start to understand your exact requirements and will continuously work with you to ensure that you’re happy with the final site that you purchase.</p> <a href="#" class="more-details"></a> </div><!--end service-box--> <div class="service-box"> <h2 class="marketing-title"></h2> <div class="service-dotted-line"></div> <p>We can help you promote your business in both the online and offline worlds. We specialize in a range of fields from viral marketing campaigns to managing paid advertising accounts for you. Your brand will be in safe hands with us.</p> <a href="#" class="view-case-studies-button"></a> </div> <!--end service-box--> <div class="service-box"> <h2 class="optimization-title"></h2> <div class="service-dotted-line"></div> <p>Want to drive more traffic to your site? You’ve come the right place! We can increase traffic to your site in an organic and effective manner that will ensure more people are aware of your business and the products/services you offer. </p> <a href="#" class="learn-more-button"></a> </div><!--end service-box--> </div><!--end services--> <div class="horizontal-line"></div>
.service-box
. Inside each of these service boxes is a title, a dotted line, the text content for that box, and a button..first
(class="service-box first"
) because we need to slightly change the styling of this container from the others./*--------------------SERVICES--------------------*/ #services { padding: 40px 0; height: 355px; } #services .service-box { float: left; background: url(images/service-box-bg.png) no-repeat; width: 233px; height: 301px; margin: 0 0 0 46px; padding: 22px 28px 30px 26px; } #services .first { margin-left: 0; } #services .service-box h2 { margin: 0 auto; } .web-design-title { background: url(images/web-design-title.png) no-repeat; width: 186px; height: 48px; } .marketing-title { background: url(images/marketing-title.png) no-repeat; width: 186px; height: 48px; } .optimization-title { background: url(images/optimization-title.png) no-repeat; width: 200px; height: 48px;} .service-dotted-line { background: url(images/service-dotted-line.png) no-repeat; width: 237px; height: 3px; margin: 10px 0 24px 0; } #services p { font-size: 14px; color: #fff; line-height: 21px; text-align: center; margin: 0 0 24px 0; } #services .more-details { display: block; background: url(images/get-more-details-button.jpg) no-repeat; width: 232px; height: 41px; } #services .view-case-studies-button { display: block; background: url(images/view-case-studies-button.jpg) no-repeat; width: 232px; height: 41px; } #services .learn-more-button { display: block; background: url(images/learn-more-button.jpg) no-repeat; width: 232px; height: 41px; }
.service-box
class is set to 46px. This is to provide consistent spacing between the different service boxes. However, if the first box has a left margin set to 46px, it will not be on the left side of the template and will look a little odd..first
class to 0 to override the original margin attribute value from the .service-box
styling, ensuring that the first service box is correctly aligned on the left side of the template.client-testimonials-title.png
.#client-testimonials
container in index.html.<div id="client-testimonials"> <h3>Client Testimonials</h3> <div class="testimonial"> <div class="author-img"> <img src="images/author-img-1.jpg" alt="Sarah Johnson" /> </div><!--end author-img--> <p>"Design studios created a beautiful website and were an absolute pleasure to work with..."</p> <p class="author-name">Sarah Johnson</p> <a href="#">Web Design Media</a> </div><!--end testimonial--> <div class="testimonial"> <div class="author-img"> <img src="images/author-img-2.jpg" alt="Kate Saunders" /> </div><!--end author-img--> <p>"I only have great things to say - I would highly recommend DS for online promotional work..."</p> <p class="author-name">Kate Saunders</p> <a href="#">Software Solutions</a> </div><!--end testimonial--> <div class="testimonial"> <div class="author-img"> <img src="images/author-img-3.jpg" alt="Dave Cole" /> </div><!--end author-img--> <p>"Design Studios have increased traffic to my site by over 200% in three months - great work guys!"</p> <p class="author-name">Dave Cole</p> <a href="#">Global Web Services</a> </div><!--end testimonial--> </div><!--end client-testimonials-->
.testimonial
containers that each contain an image of the testimonial author, the testimonial text, and the name of the author along with their company/organisation’s name./*----------------ADDITIONAL INFO-----------------*/ #additional-info { margin: 38px 0 0 0; height: 420px; } #additional-info #client-testimonials { float: left; width: 425px; padding: 0 45px 0 0; } #additional-info #client-testimonials h3 { background: url(images/client-testimonials-title.png) no-repeat; width: 180px; height: 28px; margin: 0 0 24px -5px; text-indent: -9999px; } .testimonial { margin: 0 0 32px -5px; } .testimonial .author-img { float: left; background-color: #ccc; width: 84px; height: 84px; margin: 4px 28px 0 5px; } .testimonial img { margin: 3px 0 0 3px; } .testimonial p { color: #555; font-size: 14px; line-height: 21px; margin: 0 0 12px 0; } .testimonial p.author-name { font-weight: bold; margin: 0; } .testimonial a { color: #00aeef; font-size: 14px; text-decoration: none; } .testimonial a:hover { color: #555; }
#additional-info
— the height of the container is set along with the margins.#client-testimonials
container is set to 425px with 45px of padding on the right. This needs to be the same for both this section and the "Featured Project" section (we’ll talk about this section later down the tutorial) as they both use half of the screen.vertical-line.png
.#client-testimonials
and#featured-project
containers in your index.html file.<div class="vertical-line"></div>
.horizontal-line
class that we defined earlier..vertical-line { float: left; background: url(images/vertical-line.png) no-repeat; width: 4px; height: 385px; }
featured-project-title.png
.<div id="featured-project"> <h3>Featured Project</h3> <h4>Yoshi Online Marketing Campaign</h4> <img src="images/featured-project-image.png" alt="Yoshi Screenshot" /> <p>This project involved organizing an online marketing campaign to help promote the Yoshi brand. This resulted in a 200% increase in Yoshi’s sales over a six month period of time. </p> <a href="#">Click Here For More Details >></a> </div><!--end featured-project-->
/*----------------FEATURED PROJECT----------------*/ #featured-project { float: left; margin: 0 0 0 45px; width: 425px; } #featured-project h3 { background: url(images/featured-project-title.png) no-repeat; width: 160px; height: 32px; margin: 0 0 16px -5px; text-indent: -9999px; } #featured-project h4 { font-size: 20px; color: #888; font-weight: normal; margin: 0 0 8px 0; } #featured-project img { margin: 0 0 7px 0; } #featured-project p { font-size: 14px; color: #555; line-height: 21px; margin-bottom: 7px; } #featured-project a { color: #00aeef; font-size: 14px; text-decoration: none; }
<div id="footer"> <div class="horizontal-line" style="clear: both"></div> <p>Copyright © 2010 ~ Design Studios ~ All Rights Reserved</p> </div><!--end footer-->
#additional-info
container and the #footer
. Some standard copyright text is then included underneath this./*--------------------FOOTER----------------------*/ #footer { height: 70px; padding: 0 0 30px 0; } #footer p { font-size: 16px; color: #888; padding: 14px 0 0 0; }
#footer
container and then setting the bottom padding to 30px to provide some breathing room at the bottom of the web layout template.