Slice and Dice: From PSD Image to XHTML+CSS Svetlin Nakov Telerik Corporation www.telerik.com.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to XHTML Programming the World Wide Web Fourth edition.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
The Web Wizards Guide to HTML Chapter Six Tables.
Copyright © 2003 Pearson Education, Inc. Slide 5-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties-- List properties –Table properties-- Classification properties.
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania.
Tutorial 3 – Creating a Multiple-Page Report
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 7 Key Concepts 1 Copyright © Terry Felke-Morris.
Processing and Exporting Images Doncho Minkov Telerik Corporation Change this with you info.
© 2010 Delmar, Cengage Learning Chapter 5 Positioning Objects with CSS and Tables.
XP Tutorial 4New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Designing a Web Page with Tables Tutorial 4 Creating a News Page.
Chapter 3 – Web Design Tables & Page Layout
1 Tables and Lists. 2 Are Tables still needed? Tables were once used to help structure and style our pages CSS now replaces most of the old uses for tables.
Svetlin Nakov Telerik Corporation
Creating Tables in a Web Site
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
Dr. Alexandra I. Cristea CSS Dr. Alexandra I. Cristea Source:
Benchmark Series Microsoft Excel 2010 Level 1
Chapter 11 Creating Framed Layouts Principles of Web Design, 4 th Edition.
Chapter 13 Web Page Design Studio
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Cascading Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
MIS 425 Lecture 2 – HTML Navigation, Colors, tables and Styles Instructor: Martin Neuhard
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Standards XHTML and CSS. Today’s Show ► Discuss web standards ► XHTML ► Layout Without Tables ► CSS ► Why Web Standards?
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 4 Key Concepts 1 Copyright © Terry Felke-Morris.
SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
Diliev.com & pLOVEdiv.com  DIliev.com.
Unit 20 - Client Side Customisation of Web Pages
XHTML1 Tables and Lists. XHTML2 Objectives In this chapter, you will: Create basic tables Structure tables Format tables Create lists.
 2008 Pearson Education, Inc. All rights reserved. 1 Introduction to HTML.
HTML. Goals How to use the Komodo editor HTML coding and testing Basic HTML tags List and Images Tables and Links At least 2 pages and navigation
XHTML1 Topics Work with the Frameset Document Type Definition (DTD) Create frames Use the target and base attributes Create nested frames Format frames.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Tutorial 4: Using CSS for Page Layout. 2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
CO1552 – Web Application Development Lists, Special Characters, and Tables.
Website Development with Dreamweaver
 Word doc for you to download › Link at the beginning of class › 10 Questions › Answers to be added inline  Post to Sakai when completed › No resubmits.
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
Lesson 05 // Web Design, Layout & Structure 1.Web Design/Designer-Coder Relationship 2.Fixed vs Fluid Website Layouts 3.Screen Resolutions.
Tutorial #6 – Creating Fixed Width Layouts. Tutorial #5 Review – Box Model Every html element is surround by a box Content, Padding, Border, Margin Can.
CIS234A- Lecture 7 Instructor Greg D’Andrea. Tables A table can be displayed on a Web page either in a text or graphical format. A text table: – contains.
Svetlin Nakov Telerik Corporation
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 5: Working with Tables Kelly L.
Layout with Styles Castro Chapter 11. Tables vs. CSS You can produce “liquid layouts” (layouts that stretch as the browser is resized) using tables or.
Internet Technology Dr Jing LU Updated Dr Violet Snell / Dr Kalin Penev 1 Internet Technology (week 6)  Recap: Validating HTML  Page Layout.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
CONTROLLING Page layout
Positioning Objects with CSS and Tables
1 Preparation for site Create a folder in MyDocuments: beavercheese. Create a subfolder, images Classes, career, DW beginner Download.
 Add one element at a time  If it doesn’t do what you want, › Delete it › DON’T just keep piling on more items.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 5.
Tutorial 5 Working with Web Tables. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Learn and Apply the structure of.
FMI-PLOVDIV Web Dynamic Applications
CSCI 1720 W3.CSS – Part 1 East Tennessee State University Department of Computing CSCI 1720 Intermediate Web Design.
Create and edit web pages 4
Working with Tables: Module A: Table Basics
Cascading Style Sheets
Fixed Positioning.
Introduction to HTML.
Laying out Elements with CSS
Presentation transcript:

Slice and Dice: From PSD Image to XHTML+CSS Svetlin Nakov Telerik Corporation

1. From Image to XHTML+CSS: Step by Step 2. Floating DIVs and DIVs Behaving Like Tables 3. Vertical Alignment of DIVs 4. Centering Site Contents 5. Web Site with Frames 6. Web Site with Tables 7. Web Site with DIVs 8. Slice and Dice: Showcases 2

Creating Web Sites Step by Step

Steps for converting a Web site image to XHTML + CSS ( + JavaScript ) Steps for converting a Web site image to XHTML + CSS ( + JavaScript ) 1.Decide on the layout type Fixed width – what resolution ( 800, 1024, …)? Fixed width – what resolution ( 800, 1024, …)? Fluid width – which parts will resize? Fluid width – which parts will resize? 2.Identify site sections Header, main, footer, columns, navigation, etc. Header, main, footer, columns, navigation, etc. 3.Decide on the layout model DIVs vs. tables (any good reason to use tables?) DIVs vs. tables (any good reason to use tables?) 4

Steps for converting a Web site image to XHTML + CSS ( + JavaScript ) Steps for converting a Web site image to XHTML + CSS ( + JavaScript ) 4.Distinguish between content and style Text vs. images – which belongs to the content and which is part of the styling? Text vs. images – which belongs to the content and which is part of the styling? 5.Create the page layout Create the layout DIVs and define their CSS Create the layout DIVs and define their CSS 6.Create the contents of each section 7.Test the site in different Web browsers 5

Page layout can be fixed or fluid Page layout can be fixed or fluid Fixed width Fixed width Typical Web users use at least 1024 x 768 resolution 900px px page width is OK Typical Web users use at least 1024 x 768 resolution 900px px page width is OK Mobile devices have smaller screen Mobile devices have smaller screen Fluid width Fluid width Ensure the main page content resizes correctly Ensure the main page content resizes correctly Beware of very large screens (e.g x 1200 ) Beware of very large screens (e.g x 1200 ) Fix the min-width for the main Fix the min-width for the main 6

Typical Web sites consist of header, main section and footer Typical Web sites consist of header, main section and footer The main content usually has some main section, sidebars or navigation controls The main content usually has some main section, sidebars or navigation controls The main section could be split in columns The main section could be split in columns 7 Header Main Section Footer Left Side Bar Right Side Bar Columns Columns Columns

Site layout with frames is old-fashioned Site layout with frames is old-fashioned Using tables for columned design is incorrect! Using tables for columned design is incorrect! Tables are considered SEO unfriendly Tables are considered SEO unfriendly The other option is to use tags The other option is to use tags To place them in columns they must be floating To place them in columns they must be floating When they are floating, you can fix their width, but height is determined by their content (or is fixed) When they are floating, you can fix their width, but height is determined by their content (or is fixed) When height is determined by content, background may not be applied properly When height is determined by content, background may not be applied properly Footer must also be floating with clear:left Footer must also be floating with clear:left 8

Floating DIVs are not part of their parent DIV Floating DIVs are not part of their parent DIV Their height is the height of their content Their height is the height of their content The parent container's height can be less The parent container's height can be less 9 Floating- left Floating- left Floating- right Floating- right Non-floating Non-floating The container has height based on its non-floating content

Live Demo floating-divs.html

display:table makes DIVs behave like table: display:table makes DIVs behave like table: Supported in all W3C- browsers Supported in all W3C-compliant browsers Internet Explorer supports this since IE8 Internet Explorer supports this since IE8 11 #container { display: table; } #row { display: table-row; } #left, #right, #middle { display: table-cell; } Left Column Left Column Middle Column Middle Column Right Column Right Column </div>

Live Demo table-with-divs.html

Aligning a DIV vertically is a complex task Aligning a DIV vertically is a complex task You need three nested elements: You need three nested elements: 13 #container { display: table; height: 400px; } #row { display: table-row; } #cell { display: table-cell; vertical-align: middle; } Vertically Centered Vertically Centered </div> XHTML DOCTYPE is requred, especially for IE!

Live Demo div-vertical-alignment.html

Separating content from presentation Separating content from presentation The HTML content is the essential information published in the Web page, e.g. text + images The HTML content is the essential information published in the Web page, e.g. text + images The presentation is the layout and styles used to format the content or decorate it The presentation is the layout and styles used to format the content or decorate it The content should live in the HTML The content should live in the HTML The presentation should live in the CSS The presentation should live in the CSS When the CSS is disabled, the site should look like an article with titles, lists and paragraphs When the CSS is disabled, the site should look like an article with titles, lists and paragraphs 15

GIF, JPEG and PNG are the three most common image formats in the Web GIF, JPEG and PNG are the three most common image formats in the Web JPEG is used for large images, e.g. photos JPEG is used for large images, e.g. photos GIF and PNG support transparency GIF and PNG support transparency Used for bullets, icons and small images Used for bullets, icons and small images Transparent PNG not supported by old browsers Transparent PNG not supported by old browsers PNG files are larger than GIF PNG files are larger than GIF GIF supports less colors than PNG GIF supports less colors than PNG GIF supports animation GIF supports animation 16

Several ways to center the content of the site: Several ways to center the content of the site: Placing it in tag – deprecated Placing it in tag – deprecated Using CSS text-align:center Using CSS text-align:center Will affect all child nodes too Will affect all child nodes too Using CSS margin:0 auto Using CSS margin:0 auto The width of the content is fixed The width of the content is fixed The left and right margins are set to automatic The left and right margins are set to automatic 17 width: 900px; margin: 20px auto;

18 <head> body { background-color: #CCCCCC; } body { background-color: #CCCCCC; } #site-contents { #site-contents { width: 940px; margin: 20px auto; } width: 940px; margin: 20px auto; } </head><body> Welcome to our Web site! Welcome to our Web site! </body></html>

Live Demo

Web sites based on frames Web sites based on frames Easy-to-develop Easy-to-develop Works for small and simple Web sites Works for small and simple Web sites Considered old-fashioned, not recommended! Considered old-fashioned, not recommended! 20 <frameset rows="85,*" cols="*" frameborder="no" border="0" framespacing="0"> framespacing="0"> <frameset cols="126,*" frameborder="no" border="0" <frameset cols="126,*" frameborder="no" border="0" framespacing="0"> framespacing="0"> <frame src="left.html" name="leftFrame" scrolling="no" <frame src="left.html" name="leftFrame" scrolling="no" noresize="yes" /> noresize="yes" /> </frameset>

Live Demo

Web sites based on tables Web sites based on tables Easy to layout the page elements Easy to layout the page elements Semantically incorrect, not recommended! Semantically incorrect, not recommended! 22 Logo Logo Header Text Header Text Menu Menu Main Content Main Content Footer Footer </table>

Live Demo

Web sites based on DIVs Web sites based on DIVs The best, semantically correct approach The best, semantically correct approach Sometimes is hard to implement Sometimes is hard to implement 24 Logo Logo Header Header </div> Menu Menu Main Content Main Content </div> Footer Footer

Live Demo

Slice and Dice: Showcases

We should convert the following image to XHTML+CSS: We should convert the following image to XHTML+CSS: 27

Fixed width or fluid width? Fixed width or fluid width? Fixed width will work well Fixed width will work well Need to center the content and use some background to fill the rest of the page Need to center the content and use some background to fill the rest of the page Frames, tables or DIVs? Frames, tables or DIVs? DIVs with table layout will work best DIVs with table layout will work best 28

First step is to determine the parts of the design First step is to determine the parts of the design 29

30 the site header - div This is the logo – should be image tag This is the logo – should be image tag This can be background image

31 3 columns design Best way is – table, one row, three cells 3 columns design Best way is – table, one row, three cells Menu cell Body cell Right cell

32 Footer – div, center the text with CSS

33 Unordered lists, strong tags, links DIV with links (A tags) Article headings (H1 and H2 tags) Article headings (H1 and H2 tags) two separate lists in table or two floating divs

Use HTML when possible to avoid images Use HTML when possible to avoid images Images are slower to download and render Images are slower to download and render 34 This bullets can be either CSS background image or default list bullet Browsers do not support such font and effects so we have to place this text using image All elements backgrounds and borders are solid so we can use css colors instead of images

Look for the small details and decide if they should be in CSS, HTML or image Look for the small details and decide if they should be in CSS, HTML or image 35 Example: this images have border that should be defined in the CSS, not part of the image

Example site design Example site design 36

Three ways to create the top part: Three ways to create the top part: Use text over background image, absolute positioned DIVs Use text over background image, absolute positioned DIVs Use table, slice the image to fit the needed rows and columns Use table, slice the image to fit the needed rows and columns Leave the text in the image Leave the text in the image 37

To achieve the underline and the leaf image we can use only CSS. We need two tags: To achieve the underline and the leaf image we can use only CSS. We need two tags: Outer tag has the leaf as background image, padding- left so the inner doesnt cover it Outer tag has the leaf as background image, padding- left so the inner doesnt cover it Inner tag has the underline as background image, repeat-x, positioned in the bottom Inner tag has the underline as background image, repeat-x, positioned in the bottom Note: the underline background image is 1px wide to save bandwidth! Note: the underline background image is 1px wide to save bandwidth! 38

Rounded border corners are supported by CSS3 Rounded border corners are supported by CSS3 Not yet supported by most browsers Not yet supported by most browsers But soon will be But soon will be We can create them with multiple images in table We can create them with multiple images in table Too much code Too much code 39

1. Create this with XHTML and CSS. Using tables and frames are not allowed! 40 See the file: site-sample.png

2. Create this with XHTML and CSS. Using tables and frames is not allowed! 41 See the file: architecture.psd