SlideShare a Scribd company logo
Mobile Drupal:
                           Drupal       :
                         Building a mobile theme


                              Drupal Camp Taipei 2011

                                 John Albin Wilkins


Saturday, July 9, 2011
Traditional way to support mobile


                         • Build a separate mobile website
                         • Detect mobile device
                         • Redirect to mobile site
                             This is really hard!

Saturday, July 9, 2011
Responsive Design

                         •   Single source of HTML
                                       HTML
                         •   Responds to different viewport sizes


                         •   First described by Ethan Marcotte’s article
                                     Ethan Marcotte

                             “Responsive Web Design”
                             http://www.alistapart.com/articles/responsive-web-
                             design

Saturday, July 9, 2011
Building a responsive mobile theme


                         • Mobile First
                         • Responsive Design
                          1. Flexible Grids
                          2. Flexible Images
                          3. CSS3 Media Queries
                             CSS3 Media Queries


Saturday, July 9, 2011
Mobile device zooming

                         •   Meta tags can control the scaling/zooming of
                             mobile devices
                                 Meta tags

                         •   More info:
                             http://davidbcalhoun.com/2010/viewport-metatag

      <meta name="viewport"
        content="width=device-width, initial-scale=1">
      <meta name="MobileOptimized" content="width">
      <meta name="HandheldFriendly" content="true">


Saturday, July 9, 2011
Flexible grids

                         • Use percentages to set grid sizes
                         •




                             .content { width: 62.5%; } // 5 grids
                             .sidebar { width: 37.5%; } // 3 grids
                         • Grid will grow/shrink with the screen size
                                                       /

                         • Target ÷ context = result
                                   ÷       =

Saturday, July 9, 2011
Flexible images

                         • Use max-width to constrain images within
                           the flexible grid.
                                max-width


                         • img, embed, iframe, object, video {
                               max-width: 100%;
                           }


Saturday, July 9, 2011
How do we target
                                     different screen sizes?

                         •   With CSS2 media types we could target different
                             classes of devices:
                                  CSS2 media types                     class:
                                    print, screen, handheld, all
                         •   With CSS3 media queries we target device
                             capabilities.
                                 CSS3 media queries
                             •   [type] and ([query])
                             •   all and (max-width: 768px)


Saturday, July 9, 2011
3 ways to query
                                    query
                 1. <link rel="stylesheet" href="wide.css" media="screen
                    and (min-width: 992px)">
                 2. @import url(wide.css) screen and (min-width:
                    992px);
                         theme.info:
                         stylesheets[screen][] = file.css
                         stylesheets[screen and (min-width: 992px)][] = file.css
                 3. @media screen and (min-width: 992px) {
                      .selector { property: value; }
                    }
Saturday, July 9, 2011
Breakpoints
                         320px — iPhone in portrait mode
                                iPhone
                         480px — iPhone in landscape mode
                                  iPhone
                         768px — iPad in portrait mode
                                  iPad
                         992px — small laptop (minus browser chrome)

                         1200px — large desktop

Saturday, July 9, 2011
Dealing with IE 6-8
                               IE6~8
                         ‣ IE8 and earlier don’t support media queries
                           IE8             media queries
                         1. They do support IE conditional comments
                                     IE conditional comments
                         2. They do support JavaScript polyfills
                                     JavaScript polyfills



Saturday, July 9, 2011
Dealing with IE 6-8
                              IE6~8
                         Conditional Stylesheets module:
                         http://drupal.org/project/conditional_styles

                         <!--[if lte IE 8]>
                         <link src="/css/layout/desktop.css">
                         <![endif]-->



Saturday, July 9, 2011
Dealing with IE 6-8
                           IE6~8

                         Scott Jehl, Filament Group
                         Respond.js

                         https://github.com/scottjehl/Respond




Saturday, July 9, 2011
Responsive Design


                         1. Flexible Grids
                         2. Flexible Images
                         3. CSS3 Media Queries
                            CSS3 Media Queries




Saturday, July 9, 2011
Zen 7.x-5.x-dev


                         http://john.albin.net/



Saturday, July 9, 2011
Related Topics
                         •   HTML5
                             http://html5doctor.com/how-to-use-html5-in-your-
                             client-work-right-now/
                         •   CSS3
                             http://www.css3.info
                         •   Progressive enhancement
                             http://www.alistapart.com/articles/
                             understandingprogressiveenhancement
                         •   JavaScript polyfills
                             http://remysharp.com/2010/10/08/what-is-a-polyfill
                         •   Front-end Performance
                             http://developer.yahoo.com/performance/rules.html
Saturday, July 9, 2011

More Related Content

PDF
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
PDF
[DCTPE2011] 5) 用 Drupal 打造美好資訊架構(英/中雙語)
PDF
[DCTPE2011] 10) Drupal與Facebook交朋友
PPT
[DCTPE2011] Drupal 7 的Fields/Views 運用
PDF
[DCTPE2011] 3) 主題演講:用Drupal 打造更美好的網際網路
PDF
[DCTPE2010] 如何開發 CCK 欄位模組
PPT
[DCTPE2010] 開場:Drupal與Drupal台灣
PDF
[DCTPE2010] Drupal 與網路的未來趨勢
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
[DCTPE2011] 5) 用 Drupal 打造美好資訊架構(英/中雙語)
[DCTPE2011] 10) Drupal與Facebook交朋友
[DCTPE2011] Drupal 7 的Fields/Views 運用
[DCTPE2011] 3) 主題演講:用Drupal 打造更美好的網際網路
[DCTPE2010] 如何開發 CCK 欄位模組
[DCTPE2010] 開場:Drupal與Drupal台灣
[DCTPE2010] Drupal 與網路的未來趨勢

Viewers also liked (18)

PDF
[DCTPE2011] 11) Drupal 是好的生財工具嗎? 2. 中小型網站製作公司/工作室座談
PDF
[DCTPE2010] Drupal & (Open/Anti) Government
PDF
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--黃雋
PDF
[DCTPE2011] Drupal 6 的 CCK/Views運用--黎偉志
PPT
[DCTPE2010] Drupal 遇上行動網路服務
PDF
skinnySCAR in ArchitectuurNL 01 2017
PDF
INNOVA
PPTX
交互组读书分享——组织页面,页面元素的布局
PDF
Leadership Personality Types: USA vs China
PDF
[DCTPE2011] 11) Drupal 是好的生財工具嗎? 1. 網站標案經驗分享 x 2
PPT
What is Joomla?
PDF
Minutes Of The Meeting For The Exhibit of SHS
 
PPT
[DCTPE2010] 從企劃到開發維護的 Drupal 專案經驗
PPT
[DCTPE2010] 多站架設商業應用與實務-以本土癮科技為例
PDF
[DCTPE2010] Microsoft
PDF
[DCTPE2010] Drupal 模組開發入門
DOCX
SHS Proposed Tuition and Other School Fees
 
PPT
[DCTPE2010] 綠界科技-網路金流機制服務簡介
[DCTPE2011] 11) Drupal 是好的生財工具嗎? 2. 中小型網站製作公司/工作室座談
[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--黃雋
[DCTPE2011] Drupal 6 的 CCK/Views運用--黎偉志
[DCTPE2010] Drupal 遇上行動網路服務
skinnySCAR in ArchitectuurNL 01 2017
INNOVA
交互组读书分享——组织页面,页面元素的布局
Leadership Personality Types: USA vs China
[DCTPE2011] 11) Drupal 是好的生財工具嗎? 1. 網站標案經驗分享 x 2
What is Joomla?
Minutes Of The Meeting For The Exhibit of SHS
 
[DCTPE2010] 從企劃到開發維護的 Drupal 專案經驗
[DCTPE2010] 多站架設商業應用與實務-以本土癮科技為例
[DCTPE2010] Microsoft
[DCTPE2010] Drupal 模組開發入門
SHS Proposed Tuition and Other School Fees
 
[DCTPE2010] 綠界科技-網路金流機制服務簡介
Ad

Similar to [DCTPE2011] 7) Mobile Drupal(英/中雙語) (20)

PDF
Responsive Web Site Design
KEY
Responsive Web Design
PDF
Responsive Websites
PDF
Great Responsive-ability Web Design
PDF
CSS3: Using media queries to improve the web site experience
PDF
Adapt! Media queries and viewport
PPTX
Chapter 17: Responsive Web Design
PPTX
Responsive Web Design
PDF
CSS3: Simply Responsive
PDF
(Practical) Beyond Responsive Web Design (WordCamp Miami 2011)
PPTX
Responsive web design
PPTX
FITC - 2012-04-23 - Responsive Web Design
PDF
CSS3, Media Queries, and Responsive Design
PDF
Responsive Design for the Web
PPTX
Advancio, Inc. Academy: Responsive Web Design
PDF
Responsible Web Design
PDF
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
PPT
Mobile Monday Presentation: Responsive Web Design
PDF
Responsive web design
PDF
Responsive Web Design On Student's day
Responsive Web Site Design
Responsive Web Design
Responsive Websites
Great Responsive-ability Web Design
CSS3: Using media queries to improve the web site experience
Adapt! Media queries and viewport
Chapter 17: Responsive Web Design
Responsive Web Design
CSS3: Simply Responsive
(Practical) Beyond Responsive Web Design (WordCamp Miami 2011)
Responsive web design
FITC - 2012-04-23 - Responsive Web Design
CSS3, Media Queries, and Responsive Design
Responsive Design for the Web
Advancio, Inc. Academy: Responsive Web Design
Responsible Web Design
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
Mobile Monday Presentation: Responsive Web Design
Responsive web design
Responsive Web Design On Student's day
Ad

More from Drupal Taiwan (8)

PDF
[DCTPE2011] Drupal 6 的 CCK/Views運用--林振昇
PDF
[DCTPE2011] 9) 案例分析 1. NNCF.org - Content, Commerce, CRM
PDF
[DCTPE2011]Drupalthon intro
PPTX
[DCTPE2010] Drupalcamp 商業案例:獎金獵人 share
PPT
[DCTPE2010] Drupal & 電子商務-Ubercart 實例介紹:線上書店
PPT
[DCTPE2010] Drupal 學術應用-申請入學網路單一窗口
PDF
[DCTPE2010] Biodiversity & Drupal
PDF
[DCTPE2010] Open Hopen 政府網站的理想與現實
[DCTPE2011] Drupal 6 的 CCK/Views運用--林振昇
[DCTPE2011] 9) 案例分析 1. NNCF.org - Content, Commerce, CRM
[DCTPE2011]Drupalthon intro
[DCTPE2010] Drupalcamp 商業案例:獎金獵人 share
[DCTPE2010] Drupal & 電子商務-Ubercart 實例介紹:線上書店
[DCTPE2010] Drupal 學術應用-申請入學網路單一窗口
[DCTPE2010] Biodiversity & Drupal
[DCTPE2010] Open Hopen 政府網站的理想與現實

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Machine Learning_overview_presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
sap open course for s4hana steps from ECC to s4
Dropbox Q2 2025 Financial Results & Investor Presentation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
Machine Learning_overview_presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation_ Review paper, used for researhc scholars
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release

[DCTPE2011] 7) Mobile Drupal(英/中雙語)

  • 1. Mobile Drupal: Drupal : Building a mobile theme Drupal Camp Taipei 2011 John Albin Wilkins Saturday, July 9, 2011
  • 2. Traditional way to support mobile • Build a separate mobile website • Detect mobile device • Redirect to mobile site This is really hard! Saturday, July 9, 2011
  • 3. Responsive Design • Single source of HTML HTML • Responds to different viewport sizes • First described by Ethan Marcotte’s article Ethan Marcotte “Responsive Web Design” http://www.alistapart.com/articles/responsive-web- design Saturday, July 9, 2011
  • 4. Building a responsive mobile theme • Mobile First • Responsive Design 1. Flexible Grids 2. Flexible Images 3. CSS3 Media Queries CSS3 Media Queries Saturday, July 9, 2011
  • 5. Mobile device zooming • Meta tags can control the scaling/zooming of mobile devices Meta tags • More info: http://davidbcalhoun.com/2010/viewport-metatag <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="MobileOptimized" content="width"> <meta name="HandheldFriendly" content="true"> Saturday, July 9, 2011
  • 6. Flexible grids • Use percentages to set grid sizes • .content { width: 62.5%; } // 5 grids .sidebar { width: 37.5%; } // 3 grids • Grid will grow/shrink with the screen size / • Target ÷ context = result ÷ = Saturday, July 9, 2011
  • 7. Flexible images • Use max-width to constrain images within the flexible grid. max-width • img, embed, iframe, object, video { max-width: 100%; } Saturday, July 9, 2011
  • 8. How do we target different screen sizes? • With CSS2 media types we could target different classes of devices: CSS2 media types class: print, screen, handheld, all • With CSS3 media queries we target device capabilities. CSS3 media queries • [type] and ([query]) • all and (max-width: 768px) Saturday, July 9, 2011
  • 9. 3 ways to query query 1. <link rel="stylesheet" href="wide.css" media="screen and (min-width: 992px)"> 2. @import url(wide.css) screen and (min-width: 992px); theme.info: stylesheets[screen][] = file.css stylesheets[screen and (min-width: 992px)][] = file.css 3. @media screen and (min-width: 992px) { .selector { property: value; } } Saturday, July 9, 2011
  • 10. Breakpoints 320px — iPhone in portrait mode iPhone 480px — iPhone in landscape mode iPhone 768px — iPad in portrait mode iPad 992px — small laptop (minus browser chrome) 1200px — large desktop Saturday, July 9, 2011
  • 11. Dealing with IE 6-8 IE6~8 ‣ IE8 and earlier don’t support media queries IE8 media queries 1. They do support IE conditional comments IE conditional comments 2. They do support JavaScript polyfills JavaScript polyfills Saturday, July 9, 2011
  • 12. Dealing with IE 6-8 IE6~8 Conditional Stylesheets module: http://drupal.org/project/conditional_styles <!--[if lte IE 8]> <link src="/css/layout/desktop.css"> <![endif]--> Saturday, July 9, 2011
  • 13. Dealing with IE 6-8 IE6~8 Scott Jehl, Filament Group Respond.js https://github.com/scottjehl/Respond Saturday, July 9, 2011
  • 14. Responsive Design 1. Flexible Grids 2. Flexible Images 3. CSS3 Media Queries CSS3 Media Queries Saturday, July 9, 2011
  • 15. Zen 7.x-5.x-dev http://john.albin.net/ Saturday, July 9, 2011
  • 16. Related Topics • HTML5 http://html5doctor.com/how-to-use-html5-in-your- client-work-right-now/ • CSS3 http://www.css3.info • Progressive enhancement http://www.alistapart.com/articles/ understandingprogressiveenhancement • JavaScript polyfills http://remysharp.com/2010/10/08/what-is-a-polyfill • Front-end Performance http://developer.yahoo.com/performance/rules.html Saturday, July 9, 2011