Presentation is loading. Please wait.

Presentation is loading. Please wait.

Responsive Design Design that Adapts to Different Devices SoftUni Team Technical Trainers Software University

Similar presentations


Presentation on theme: "Responsive Design Design that Adapts to Different Devices SoftUni Team Technical Trainers Software University"— Presentation transcript:

1 Responsive Design Design that Adapts to Different Devices SoftUni Team Technical Trainers Software University http://softuni.bg

2 2  Responsive Design  Creating Responsive Design  Fluid Layout  Flexible Images and Fonts  Flexible Tables and Menus  Media Queries  Media Queries Everywhere  Constructing Responsive Design Table of Contents

3 Responsive Design Overview

4  Responsive design (adaptive design) is an approach to optimize the viewing experience on range of devices  Better user experience on mobile, desktop, TV  The UI depends on the device and device specifics  Screen size  Screen resolution  DPI  Color range  Etc… Responsive Design 4

5 Live Demo

6 Creating Responsive Design Ways to Implement a Nice UI

7  Responsive design involves one or more of the following:  Fluid layout  Use proportional values for widths, margins, etc…  Flexible fonts  Fonts based on the root  Flexible images  Images cannot go beyond their container  Media queries  Apply styles based on the client screen size Creating Responsive Design 7

8 Fluid Layout Make the Elements Flow on the Screen

9  Fluid layout uses proportional sizes  Pros:  UI responds better to the client resolution  Spares code on media queries  Cons:  More whitespace on large screens (TV) Fluid Layout Sub nav content aside 12%20% 60% Margins:2% 9

10 Fluid Layout Live Demo

11 Flexible Images

12 12  Fluid design gets broken when using elements with fixed size  By concept images are always with fixed size  Example:  Resolution: 1024px, container with width: 60% ( = 60% * 1024 = 614.4px ) and an image with width: 500px  Seems OK  When the resolution becomes 780px, the container's width is still 60% (= 468px ), and the images width is still 500px  The image overflows its container Flexible Images

13 13  The fix to the image overflow is simple  Just a reset in the top of the CSS  max-width overrides the width property  If the image size is larger than the container's size  the image gets the entire container's width Making Images Flexible img { max-width:100%; }

14 Flexible Images Live Demo

15 Flexible Fonts

16 16  Flexible fonts means proportional font size  Based on the context (parent)  Instead of pixels use proportional values (em)  Make all font sizes based on the context  To change the font-size of all elements just change the context's font-size Flexible Fonts

17 17  Making fonts "responsive" needs a little math  ems = target / root  1.4375em = 23px / 16px Flexible Fonts (2) body { font-size: 16px; } body header { font-size: 23px; } // 23 / 16 = 1.4375 body header { font-size: 23px; } // 23 / 16 = 1.4375 body { font-size: 16px; } body header { font-size: 1.4375em; } body header { font-size: 1.4375em; }

18 Flexible Fonts Live Demo

19 Flexible Tables and Menus

20 20  Responsive tables  Tables are ugly and not scalable  http://css-tricks.com/responsive-data-table-roundup/ http://css-tricks.com/responsive-data-table-roundup/  Responsive menus  Menus take to much space  http://css-tricks.com/responsive-menu-concepts/ http://css-tricks.com/responsive-menu-concepts/ Responsive Tables and Menus

21 Media Queries

22 22  Media queries are part of CSS 3  Supported in all major browsers  A media query consists of a media type and at least one expression  By using media features like width, height and color  MQ change the presentation of content  Not the content itself Media Queries

23 23  Media queries apply CSS styles on certain conditions (media type and expression) Media Queries (2).box {width: 250px; height: 250px; display: inline-block} @media only screen and (max-width: 1024px) {.box { width: 300px; height: 300px; }.box { width: 300px; height: 300px; }} @media only screen and (max-width: 960px) {.box { width: 310px; height: 310px;}.box { width: 310px; height: 310px;}} @media only screen and (max-width: 480px) {.box { display: block; width: 95%; height: 95%; }.box { display: block; width: 95%; height: 95%; }}

24 Media Queries Live Demo

25 Media Queries and Flexbox Responsive Design with Flexbox

26 26  Responsive design involves  Fluid layouts  Flexible Images  Flexible fonts  Media queries  Media queries syntax: Summary @media screen and (max-width: 480px) { /* Apply styles for small devices (phones) */ /* Apply styles for small devices (phones) */}

27 ? ? ? ? ? ? ? ? ? Responsive Design https://softuni.bg/courses/web-fundamentals/

28 License  This course (slides, examples, demos, videos, homework, etc.) is licensed under the "Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International" licenseCreative Commons Attribution- NonCommercial-ShareAlike 4.0 International 28  Attribution: this work may contain portions from  "HTML Basics" course by Telerik Academy under CC-BY-NC-SA licenseHTML BasicsCC-BY-NC-SA  "CSS Styling" course by Telerik Academy under CC-BY-NC-SA licenseCSS StylingCC-BY-NC-SA

29 Free Trainings @ Software University  Software University Foundation – softuni.orgsoftuni.org  Software University – High-Quality Education, Profession and Job for Software Developers  softuni.bg softuni.bg  Software University @ Facebook  facebook.com/SoftwareUniversity facebook.com/SoftwareUniversity  Software University @ YouTube  youtube.com/SoftwareUniversity youtube.com/SoftwareUniversity  Software University Forums – forum.softuni.bgforum.softuni.bg


Download ppt "Responsive Design Design that Adapts to Different Devices SoftUni Team Technical Trainers Software University"

Similar presentations


Ads by Google