SlideShare ist ein Scribd-Unternehmen logo
1 von 42
From PSD Image to XHTML+CSS


Svetlin Nakov
Technical Trainer
www.nakov.com
Telerik Web Design Course
html5course.telerik.com
Table of Contents
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
From Image to XHTML+CSS
    Creating Web Sites Step by Step
From Image to XHTML+CSS
 Steps for converting a Web site image to

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

 XHTML + CSS ( + JavaScript )
  1. Distinguish between content and style
    Text vs. images – which belongs to the content
     and which is part of the styling?
  2. Create the page layout
    Create the layout DIVs and define their CSS
  3. Create the contents of each section
  4. Test the site in different Web browsers
                                                      5
Fixed vs. Fluid Layout
 Page layout can be fixed or fluid

 Fixed width

   Typical Web users use at least 1024 x 768
    resolution  900px-1000px page width is OK
   Mobile devices have smaller screen
 Fluid width

   Ensure the main page content resizes correctly
   Beware of very large screens (e.g. 1920 x 1200)
   Fix the min-width for the main <div>
                                                      6
Identifying Site Sections
 Typical Web sites consist of header, main

 section and footer
   The main content usually has some main
    section, sidebars or navigation controls
   The main section could be split in columns

                       Header

      Left           Main Section         Right
    Side Bar   Columns Columns Columns   Side Bar

                       Footer
                                                    7
Frames vs. Table vs. DIVs?
   Site layout with frames is old-fashioned
   Using tables for columned design is incorrect!
     Tables are considered SEO unfriendly
   The other option is to use <div> tags
     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 height is determined by content, background
      may not be applied properly
     Footer must also be floating with clear:left
                                                             8
Floating DIVs
 Floating DIVs are not part of their parent DIV

   Their height is the height of their content
   The parent container's height can be less
  Floating-          Non-floating         Floating-
 left <div>            <div>            right <div>




                    The container <div> has height
                       based on its non-floating
                               content                9
Floating DIVs
 floating-divs.html
     Live Demo
DIVs Behaving Like Tables
 display:table makes DIVs behave like table:

  #div-table { display: table; }
  #div-row { display: table-row; }
  .div-cell { display: table-cell; }

  <div id="container">
    <div id="row">
      <div class="div-cell">Left Column</div>
      <div class="div-cell">Middle Column</div>
      <div class="div-cell">Right Column</div>
    </div>
  </div>


 Supported in all W3C-compliant browsers
                   W3C-
  Internet Explorer supports this since IE8      11
DIVs Behaving Like Tables
       table-with-divs.html
            Live Demo
Vertical Alignment of DIV
 Aligning a DIV vertically is a complex task

   You need three nested <div> elements:
  #container { display: table; height: 400px; }
  #row { display: table-row; }
  #cell { display: table-cell; vertical-align: middle; }

  <div id="container">
    <div id="row">
      <div id="cell">Vertically Centered</div>
    </div>
  </div>     XHTML DOCTYPE is requred, especially for
                                 IE!
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/
  xhtml1-transitional.dtd">
                                                           13
Vertical Alignment of DIVs
     div-vertical-alignment.html
              Live Demo
Distinguish between
                          Content and Style
 Separating content from presentation

   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 content should live in the HTML

 The presentation should live in the CSS

 When the CSS is disabled, the site should look

 like an article with titles, lists and paragraphs
                                                     15
GIF, JPEG or PNG?
 GIF, JPEG and PNG are the three most

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

                                                     16
Centering a Fixed-Width Site
 Several ways to center the content of the site:

   Placing it in <center> tag – deprecated
   Using CSS text-align:center
    Will affect all child nodes too
   Using CSS margin:0 auto
    The width of the content is fixed
    The left and right margins are set to automatic

    width: 900px;
    margin: 20px auto;

                                                       17
Centering Site Contents – Example
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <style type="text/css">
    body { background-color: #CCCCCC; }
    #site-contents {
       width: 940px; margin: 20px auto; }
  </style>
</head>
<body>
  <div id="site-contents">
    <h1>Welcome to our Web site!</h1>
    ...
  </div>
</body>
</html>

                                              18
Centered Site Contents
        Live Demo
Web Site Based on Frames
 Web sites based on frames

  Easy-to-develop
  Works for small and simple Web sites
  Considered old-fashioned, not recommended!
  <frameset rows="85,*" cols="*" frameborder="no" border="0"
      framespacing="0">
    <frame src="header.html" scrolling="no" noresize="yes" />
    <frameset cols="126,*" frameborder="no" border="0"
        framespacing="0">
      <frame src="left.html" name="leftFrame" scrolling="no"
        noresize="yes" />
      <frame src="welcome.html" name="mainFrame" />
    </frameset>
  </frameset>
                                                                20
Web Site with Frames
       Live Demo
Web Site Based on Tables
 Web sites based on tables

   Easy to layout the page elements
   Semantically incorrect, not recommended!
  <table class="siteTable">
    <tr class="headerRow">
      <td class="logoCell">Logo</td>
      <td class="headerCell">Header Text</td>
    </tr>
    <tr valign="top">
      <td class="menuCell">Menu</td>
      <td class="mainContentCell">Main Content</td>
    </tr>
    <tr class="footerRow"><td colspan="2">Footer</td></tr>
  </table>

                                                             22
Web Site with Tables
       Live Demo
Web Site Based on DIVs
 Web sites based on DIVs

  The best, semantically correct approach
  Sometimes is hard to implement
  <div id="header">
    <div id="headerLogo">Logo</div>
    <div id="headerText">Header</div>
  </div>
  <div id="container">
    <div id="leftSidebar">Menu</div>
    <div id="mainContent">Main Content</div>
  </div>
  <div id="footer">Footer</div>
                                               24
Web Site with DIVs
      Live Demo
Creating a Web Site
  Slice and Dice: Showcases
Slice and Dice Showcase
 We should convert the following image to

 XHTML+CSS:




                                             27
Layout and Style
 Fixed width or fluid width?

   Fixed width will work well
   Need to center the content and use some
    background to fill the rest of the page
 Frames, tables or DIVs?

   DIVs with table layout will work best




                                              28
Step 1 – Determine the Pieces
 First step is to determine the parts of the

 design




                                                29
Step 1 – Determine the Pieces (2)
  This is the logo –   the site header - div
should be image tag                   This can be
                                   background image




                                                      30
Step 1 – Determine the Pieces (3)
                       3 columns design
            Best way is – table, one row, three cells
Menu cell        Body cell               Right cell




                                                        31
Step 1 – Determine the Pieces (4)




        Footer – div, center the text with CSS
                                                 32
Step 1 – Determine the Pieces (5)
                  DIV with links (A tags)


                          Article headings
                          (H1 and H2 tags)




Unordered lists, strong
     tags, links




     two separate lists in table or two
              floating divs
                                             33
Step 2 – Which Parts are Image
                          and Which HTML?
   Use HTML when possible to avoid images
     Images are slower to download and render



               Browsers do not support such
               font and effects so we have to
                 place this text using image
         This bullets can be either CSS background
                 image or default list bullet

                All elements backgrounds
               and borders are solid so we
               can use css colors instead of
                         images
                                                     34
Step 3 – The Small Details
 Look for the small details and decide if they

 should be in CSS, HTML or image

            Example: this images have
           border that should be defined
            in the CSS, not part of the
                       image




                                                  35
Case Study
 Example

  site design
http://pypt.org/




                            36
Case Study: Text or Image
 Three ways to create the top part:

   Use text over background image, absolute
    positioned DIVs
   Use table, slice the image to fit the needed rows
    and columns
   Leave the text in the image




                                                        37
Case Study:
                                 Two Backgrounds
   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 doesn’t cover it
     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!




                                                             38
Case Study:
                                Rounded Corners
   Rounded border corners are supported by CSS3
     Not yet supported by most browsers
       But soon will be
     We can create them with multiple images in table
       Too much code




                                                         39
Slice and Dice




  html5course.telerik.com
                       40
Homework
1.   Create this with XHTML and CSS. Using tables and
     frames are not allowed!




                     See the file: site-sample.png
                                                        41
Homework (2)
1.   Create this     See the file: architecture.png
     with XHTML
     and CSS.
     Using tables
     and frames is
     not allowed!




                                                      42

Weitere ähnliche Inhalte

Was ist angesagt?

BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014vzaccaria
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media QueriesMan Math
 
How the Wordpress CMS Really Works
How the Wordpress CMS Really WorksHow the Wordpress CMS Really Works
How the Wordpress CMS Really WorksHandsOnWP.com
 
How WordPress Themes Work
How WordPress Themes WorkHow WordPress Themes Work
How WordPress Themes WorkHandsOnWP.com
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3Doris Chen
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Likitha47
 
Lecture4
Lecture4Lecture4
Lecture4hstryk
 
Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to ZShameem Reza
 
Building a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSSBuilding a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSShstryk
 
Intro to Building & Marketing Your Own Website
Intro to Building & Marketing Your Own WebsiteIntro to Building & Marketing Your Own Website
Intro to Building & Marketing Your Own WebsiteTom McCracken
 
Web Design In Easy Steps 5th Edn Sampler
Web Design In Easy Steps 5th Edn SamplerWeb Design In Easy Steps 5th Edn Sampler
Web Design In Easy Steps 5th Edn Samplerseancouk
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignZoe Gillenwater
 
WordPress Beginners Workshop
WordPress Beginners WorkshopWordPress Beginners Workshop
WordPress Beginners WorkshopThe Toolbox, Inc.
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignSayanee Basu
 

Was ist angesagt? (18)

BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
How the Wordpress CMS Really Works
How the Wordpress CMS Really WorksHow the Wordpress CMS Really Works
How the Wordpress CMS Really Works
 
How WordPress Themes Work
How WordPress Themes WorkHow WordPress Themes Work
How WordPress Themes Work
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
 
Html2
Html2Html2
Html2
 
Lecture4
Lecture4Lecture4
Lecture4
 
Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to Z
 
Campers Packet
Campers PacketCampers Packet
Campers Packet
 
Building a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSSBuilding a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSS
 
Yuicss R7
Yuicss R7Yuicss R7
Yuicss R7
 
Intro to Building & Marketing Your Own Website
Intro to Building & Marketing Your Own WebsiteIntro to Building & Marketing Your Own Website
Intro to Building & Marketing Your Own Website
 
Web Design In Easy Steps 5th Edn Sampler
Web Design In Easy Steps 5th Edn SamplerWeb Design In Easy Steps 5th Edn Sampler
Web Design In Easy Steps 5th Edn Sampler
 
Page layout with css
Page layout with cssPage layout with css
Page layout with css
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
WordPress Beginners Workshop
WordPress Beginners WorkshopWordPress Beginners Workshop
WordPress Beginners Workshop
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 

Andere mochten auch (17)

Data Access with ADO.Net
Data Access with ADO.NetData Access with ADO.Net
Data Access with ADO.Net
 
WPF Controls
WPF ControlsWPF Controls
WPF Controls
 
CSS 3
CSS 3CSS 3
CSS 3
 
CSS Presentation
CSS PresentationCSS Presentation
CSS Presentation
 
Complex Data Binding
Complex Data BindingComplex Data Binding
Complex Data Binding
 
WPF Templating and Styling
WPF Templating and StylingWPF Templating and Styling
WPF Templating and Styling
 
WPF and Databases
WPF and DatabasesWPF and Databases
WPF and Databases
 
Web Design Concepts
Web Design ConceptsWeb Design Concepts
Web Design Concepts
 
Model View ViewModel
Model View ViewModelModel View ViewModel
Model View ViewModel
 
Web design Tools
Web design ToolsWeb design Tools
Web design Tools
 
WPF Concepts
WPF ConceptsWPF Concepts
WPF Concepts
 
Simple Data Binding
Simple Data BindingSimple Data Binding
Simple Data Binding
 
Ado.net
Ado.netAdo.net
Ado.net
 
HTML 5
HTML 5HTML 5
HTML 5
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 

Ähnlich wie Slice and Dice

HTML5- Create divisions in a web page
HTML5- Create divisions in a web pageHTML5- Create divisions in a web page
HTML5- Create divisions in a web pageGrayzon Gonzales, LPT
 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSBG Java EE Course
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorialhstryk
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
Css for Development
Css for DevelopmentCss for Development
Css for Developmenttsengsite
 
Making Your Own CSS Framework
Making Your Own CSS FrameworkMaking Your Own CSS Framework
Making Your Own CSS FrameworkDan Sagisser
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflowPeter Kaizer
 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of LayoutStephen Hay
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyDenise Jacobs
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS TroubleshootingDenise Jacobs
 
ADF - Layout Managers and Skinning
ADF - Layout Managers and SkinningADF - Layout Managers and Skinning
ADF - Layout Managers and SkinningGeorge Estebe
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Hajas Tamás
 
Designing True Cross-Platform Apps
Designing True Cross-Platform AppsDesigning True Cross-Platform Apps
Designing True Cross-Platform AppsFITC
 
Responsive web design
Responsive web designResponsive web design
Responsive web designRicha Goel
 
HTML(5) and CSS(3) for beginners - I
HTML(5) and CSS(3) for beginners - IHTML(5) and CSS(3) for beginners - I
HTML(5) and CSS(3) for beginners - Ivincentleeuwen
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLAmit Tyagi
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSZoe Gillenwater
 

Ähnlich wie Slice and Dice (20)

HTML5- Create divisions in a web page
HTML5- Create divisions in a web pageHTML5- Create divisions in a web page
HTML5- Create divisions in a web page
 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorial
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Css for Development
Css for DevelopmentCss for Development
Css for Development
 
Making Your Own CSS Framework
Making Your Own CSS FrameworkMaking Your Own CSS Framework
Making Your Own CSS Framework
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
 
Fewd week2 slides
Fewd week2 slidesFewd week2 slides
Fewd week2 slides
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & Efficiency
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS Troubleshooting
 
ADF - Layout Managers and Skinning
ADF - Layout Managers and SkinningADF - Layout Managers and Skinning
ADF - Layout Managers and Skinning
 
Css
CssCss
Css
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)
 
Designing True Cross-Platform Apps
Designing True Cross-Platform AppsDesigning True Cross-Platform Apps
Designing True Cross-Platform Apps
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
HTML(5) and CSS(3) for beginners - I
HTML(5) and CSS(3) for beginners - IHTML(5) and CSS(3) for beginners - I
HTML(5) and CSS(3) for beginners - I
 
SMACSS Workshop
SMACSS WorkshopSMACSS Workshop
SMACSS Workshop
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 

Mehr von Doncho Minkov

Mehr von Doncho Minkov (18)

HTML 5 Tables and Forms
HTML 5 Tables and FormsHTML 5 Tables and Forms
HTML 5 Tables and Forms
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
CSS Layout
CSS LayoutCSS Layout
CSS Layout
 
Adobe Photoshop
Adobe PhotoshopAdobe Photoshop
Adobe Photoshop
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
 
WPF Layout Containers
WPF Layout ContainersWPF Layout Containers
WPF Layout Containers
 
WPF Graphics and Animations
WPF Graphics and AnimationsWPF Graphics and Animations
WPF Graphics and Animations
 
Introduction to Cross-platform Mobile Development Course
Introduction to Cross-platform Mobile Development CourseIntroduction to Cross-platform Mobile Development Course
Introduction to Cross-platform Mobile Development Course
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
HTML5
HTML5HTML5
HTML5
 
CSS Part I
CSS Part ICSS Part I
CSS Part I
 
CSS Part II
CSS Part IICSS Part II
CSS Part II
 
CSS3
CSS3CSS3
CSS3
 
Workshop Usability
Workshop UsabilityWorkshop Usability
Workshop Usability
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JavaScript OOP
JavaScript OOPJavaScript OOP
JavaScript OOP
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 

Kürzlich hochgeladen

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Kürzlich hochgeladen (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

Slice and Dice

  • 1. From PSD Image to XHTML+CSS Svetlin Nakov Technical Trainer www.nakov.com Telerik Web Design Course html5course.telerik.com
  • 2. Table of Contents 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
  • 3. From Image to XHTML+CSS Creating Web Sites Step by Step
  • 4. From Image to XHTML+CSS  Steps for converting a Web site image to XHTML + CSS ( + JavaScript ) 1. Decide on the layout type  Fixed width – what resolution (800, 1024, …)?  Fluid width – which parts will resize? 2. Identify site sections  Header, main, footer, columns, navigation, etc. 3. Decide on the layout model  DIVs vs. tables (any good reason to use tables?) 4
  • 5. From Image to XHTML+CSS (2)  Steps for converting a Web site image to XHTML + CSS ( + JavaScript ) 1. Distinguish between content and style  Text vs. images – which belongs to the content and which is part of the styling? 2. Create the page layout  Create the layout DIVs and define their CSS 3. Create the contents of each section 4. Test the site in different Web browsers 5
  • 6. Fixed vs. Fluid Layout  Page layout can be fixed or fluid  Fixed width  Typical Web users use at least 1024 x 768 resolution  900px-1000px page width is OK  Mobile devices have smaller screen  Fluid width  Ensure the main page content resizes correctly  Beware of very large screens (e.g. 1920 x 1200)  Fix the min-width for the main <div> 6
  • 7. Identifying Site Sections  Typical Web sites consist of header, main section and footer  The main content usually has some main section, sidebars or navigation controls  The main section could be split in columns Header Left Main Section Right Side Bar Columns Columns Columns Side Bar Footer 7
  • 8. Frames vs. Table vs. DIVs?  Site layout with frames is old-fashioned  Using tables for columned design is incorrect!  Tables are considered SEO unfriendly  The other option is to use <div> tags  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 height is determined by content, background may not be applied properly  Footer must also be floating with clear:left 8
  • 9. Floating DIVs  Floating DIVs are not part of their parent DIV  Their height is the height of their content  The parent container's height can be less Floating- Non-floating Floating- left <div> <div> right <div> The container <div> has height based on its non-floating content 9
  • 11. DIVs Behaving Like Tables  display:table makes DIVs behave like table: #div-table { display: table; } #div-row { display: table-row; } .div-cell { display: table-cell; } <div id="container"> <div id="row"> <div class="div-cell">Left Column</div> <div class="div-cell">Middle Column</div> <div class="div-cell">Right Column</div> </div> </div>  Supported in all W3C-compliant browsers W3C-  Internet Explorer supports this since IE8 11
  • 12. DIVs Behaving Like Tables table-with-divs.html Live Demo
  • 13. Vertical Alignment of DIV  Aligning a DIV vertically is a complex task  You need three nested <div> elements: #container { display: table; height: 400px; } #row { display: table-row; } #cell { display: table-cell; vertical-align: middle; } <div id="container"> <div id="row"> <div id="cell">Vertically Centered</div> </div> </div> XHTML DOCTYPE is requred, especially for IE! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd"> 13
  • 14. Vertical Alignment of DIVs div-vertical-alignment.html Live Demo
  • 15. Distinguish between Content and Style  Separating content from presentation  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 content should live in the HTML  The presentation should live in the CSS  When the CSS is disabled, the site should look like an article with titles, lists and paragraphs 15
  • 16. GIF, JPEG or PNG?  GIF, JPEG and PNG are the three most common image formats in the Web  JPEG is used for large images, e.g. photos  GIF and PNG support transparency  Used for bullets, icons and small images  Transparent PNG not supported by old browsers  PNG files are larger than GIF  GIF supports less colors than PNG  GIF supports animation 16
  • 17. Centering a Fixed-Width Site  Several ways to center the content of the site:  Placing it in <center> tag – deprecated  Using CSS text-align:center  Will affect all child nodes too  Using CSS margin:0 auto  The width of the content is fixed  The left and right margins are set to automatic width: 900px; margin: 20px auto; 17
  • 18. Centering Site Contents – Example <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> body { background-color: #CCCCCC; } #site-contents { width: 940px; margin: 20px auto; } </style> </head> <body> <div id="site-contents"> <h1>Welcome to our Web site!</h1> ... </div> </body> </html> 18
  • 20. Web Site Based on Frames  Web sites based on frames  Easy-to-develop  Works for small and simple Web sites  Considered old-fashioned, not recommended! <frameset rows="85,*" cols="*" frameborder="no" border="0" framespacing="0"> <frame src="header.html" scrolling="no" noresize="yes" /> <frameset cols="126,*" frameborder="no" border="0" framespacing="0"> <frame src="left.html" name="leftFrame" scrolling="no" noresize="yes" /> <frame src="welcome.html" name="mainFrame" /> </frameset> </frameset> 20
  • 21. Web Site with Frames Live Demo
  • 22. Web Site Based on Tables  Web sites based on tables  Easy to layout the page elements  Semantically incorrect, not recommended! <table class="siteTable"> <tr class="headerRow"> <td class="logoCell">Logo</td> <td class="headerCell">Header Text</td> </tr> <tr valign="top"> <td class="menuCell">Menu</td> <td class="mainContentCell">Main Content</td> </tr> <tr class="footerRow"><td colspan="2">Footer</td></tr> </table> 22
  • 23. Web Site with Tables Live Demo
  • 24. Web Site Based on DIVs  Web sites based on DIVs  The best, semantically correct approach  Sometimes is hard to implement <div id="header"> <div id="headerLogo">Logo</div> <div id="headerText">Header</div> </div> <div id="container"> <div id="leftSidebar">Menu</div> <div id="mainContent">Main Content</div> </div> <div id="footer">Footer</div> 24
  • 25. Web Site with DIVs Live Demo
  • 26. Creating a Web Site Slice and Dice: Showcases
  • 27. Slice and Dice Showcase  We should convert the following image to XHTML+CSS: 27
  • 28. Layout and Style  Fixed width or fluid width?  Fixed width will work well  Need to center the content and use some background to fill the rest of the page  Frames, tables or DIVs?  DIVs with table layout will work best 28
  • 29. Step 1 – Determine the Pieces  First step is to determine the parts of the design 29
  • 30. Step 1 – Determine the Pieces (2) This is the logo – the site header - div should be image tag This can be background image 30
  • 31. Step 1 – Determine the Pieces (3) 3 columns design Best way is – table, one row, three cells Menu cell Body cell Right cell 31
  • 32. Step 1 – Determine the Pieces (4) Footer – div, center the text with CSS 32
  • 33. Step 1 – Determine the Pieces (5) DIV with links (A tags) Article headings (H1 and H2 tags) Unordered lists, strong tags, links two separate lists in table or two floating divs 33
  • 34. Step 2 – Which Parts are Image and Which HTML?  Use HTML when possible to avoid images  Images are slower to download and render Browsers do not support such font and effects so we have to place this text using image This bullets can be either CSS background image or default list bullet All elements backgrounds and borders are solid so we can use css colors instead of images 34
  • 35. Step 3 – The Small Details  Look for the small details and decide if they should be in CSS, HTML or image Example: this images have border that should be defined in the CSS, not part of the image 35
  • 36. Case Study  Example site design http://pypt.org/ 36
  • 37. Case Study: Text or Image  Three ways to create the top part:  Use text over background image, absolute positioned DIVs  Use table, slice the image to fit the needed rows and columns  Leave the text in the image 37
  • 38. Case Study: Two Backgrounds  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 doesn’t cover it  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! 38
  • 39. Case Study: Rounded Corners  Rounded border corners are supported by CSS3  Not yet supported by most browsers  But soon will be  We can create them with multiple images in table  Too much code 39
  • 40. Slice and Dice html5course.telerik.com 40
  • 41. Homework 1. Create this with XHTML and CSS. Using tables and frames are not allowed! See the file: site-sample.png 41
  • 42. Homework (2) 1. Create this See the file: architecture.png with XHTML and CSS. Using tables and frames is not allowed! 42