Introduction to Computer Science Web Development

Similar documents
Front-End UI: Bootstrap

Responsive Web Design (RWD)

Introduction to Computer Science Web Development

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

Page Layout Using Tables

Introduction to Computer Science Web Development

Responsive Web Design and Bootstrap MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

Programming web design MICHAEL BERNSTEIN CS 247

Building Responsive Layouts

How to lay out a web page with CSS

CSC309 Programming on the Web week 3: css, rwd

Responsive Design. Responsive Design Approach. Technique for building webpages

AGENDA. EMBEDDING FONTS [ Font Files & CSS font-family ] :: Online Font Converter :: ADD font-family css code to style.css

Responsive web design (RWD) CSS3 Media queries. Mobile vs desktop web sites. Web Development 1 CS1115/CS5002

Purpose of this doc. Most minimal. Start building your own portfolio page!

Class 9 / Instructor: Ira Epstein

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Assignments (4) Assessment as per Schedule (2)

Fundamentals of Web Technologies. Agenda: CSS Layout (Box Model) CSS Layout: Box Model. All HTML elements can be considered as a box or a container

Web Programming BootStrap Unit Exercises

CSS3, Media Queries, & Responsive Design. May 23, 2012 STC Summit Zoe Mickley

Introduction to Computer Science Web Development

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) More on Relative Linking. Learning Objectives (2 of 2)

E-Business Systems 1 INTE2047 Lab Exercises. Lab 5 Valid HTML, Home Page & Editor Tables

Chapter 7 BMIS335 Web Design & Development

Stamp Builder. Documentation. v1.0.0

What is the Box Model?

Table Basics. The structure of an table

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Session 5. Web Page Generation. Reading & Reference

BIM222 Internet Programming

Responsive Web Design. From: Ethan Marcotte - Responsive Web Design 2011

How to deploy for multiple screens

HTMLnotesS15.notebook. January 25, 2015

How to lay out a web page with CSS

CSS3: Using media queries to improve the web site experience. November 19, 2011 indieconf Zoe Mickley

HTML and CSS a further introduction

AGENDA. :: Add Meta Tag for Viewport (inside of head element): :: Add Script that renders HTML5 elements for older versions of Internet Explorer

Mastering the APEX Universal Theme

HTML & CSS Cheat Sheet

FLOATING AND POSITIONING

Tutorial 4. Activities. Code o Editor: Expression Web o Focus : Base Layout, navigation with folders, external stylesheets, Open up Expression Web

Advanced Dreamweaver CS6

Adobe Dreamweaver CS6 Digital Classroom

Positioning in CSS: There are 5 different ways we can set our position:

Designing the Home Page and Creating Additional Pages

Responsive Design. Responsive design is it important? But typical is not enough. Some typical screen sizes

FRONT END DEVELOPER CAREER BLUEPRINT

BOOTSTRAP GRID SYSTEM

Create a three column layout using CSS, divs and floating

International Conference KNOWLEDGE-BASED ORGANIZATION Vol. XXIII No RESPONSIVE WEB DESIGN TECHNIQUES. Luminita GIURGIU, Ilie GLIGOREA

Tutorial 5 Working with Tables and Columns. HTML and CSS 6 TH EDITION

AGENDA :: MULTIMEDIA TOOLS :: CLASS NOTES

TODAY S AGENDA. An introduction for Libraries UW-SLIS CES Webinar April 6, 2015 What is Responsive Web Design? Definition & History

Lab Introduction to Cascading Style Sheets

Deccansoft Software Services

What do we mean by layouts?

Introduction to WEB PROGRAMMING

Zen Garden. CSS Zen Garden

Notes - CSS - Flexbox

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

IBM Forms V8.0 Custom Themes IBM Corporation

Cascading Style Sheets Level 2

c122sep2214.notebook September 22, 2014

WEB DESIGNER CAREER BLUEPRINT

COMM 2555: Interactive Digital Communication / Spring 2018 Lab 9: Basic layout techniques with CSS

Cascading Style Sheets for layout II CS7026

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

Styles, Style Sheets, the Box Model and Liquid Layout

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

Create First Web Page With Bootstrap

When you complete this chapter, you will be able to:

Introduction to Computer Science Web Development

TAG STYLE SELECTORS. div Think of this as a box that contains things, such as text or images. It can also just be a

Viewports. Peter-Paul Koch CSS Day, 4 June 2014

BA. (Hons) Graphics Design

COMS 359: Interactive Media

Creating a Job Aid using HTML and CSS

INTRODUCTION TO HTML5! CSS Styles!

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

To place an element at a specific position on a page use:

COMP519 Web Programming Lecture 8: Cascading Style Sheets: Part 4 Handouts

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

CSS.

Web Design & Dev. Combo. By Alabian Solutions Ltd , 2016

Adaptations by PVII responsive and then creates your page instantly Al Sparber & Gerry Jacobsen PVII

Announcements. 1. Class webpage: Have you been reading the announcements? Lecture slides and coding examples will be posted

CS7026 Media Queries II. Different Screen Size Different Design

Web Development and HTML. Shan-Hung Wu CS, NTHU

COMSC-031 Web Site Development- Part 2

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Web Design and Implementation

CSS for Page Layout Robert K. Moniot 1

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

Website Design (Weekday) By Alabian Solutions Ltd , 2016

Lab 1: Introducing HTML5 and CSS3

ORB Education Quality Teaching Resources

Taking Fireworks Template and Applying it to Dreamweaver

JSN PageBuilder 2 User Manual

Transcription:

Introduction to Computer Science Web Development Flavio Esposito http://cs.slu.edu/~esposito/teaching/1080/ Lecture 14

Lecture outline Discuss HW Intro to Responsive Design Media Queries Responsive Layout

Media Query are style sheet within style sheet Media feature (resolves to true or false) @media (max-width: 750px) { p { color:red; } } If (TRUE) then Styles within curly braces apply

Many Media Query are available @media (max-width: 750px) { } @media (min-width: 300px) { } @media (orientation: portrait) { } Most common Most common @media screen { } // used for computer screens @media print { } // used for printers https://www.w3schools.com/css/css3_mediaqueries.asp

Media Query are combined with logical operators Device with width range @media (min-width: 768px) and (max-width: 990px) { } Comma is equivalent to OR @media (min-width: 768px), (max-width: 990px) { }

Media Query Common Approach First specify the base styles p {color: red;} Then be specific later @media (min-width: 1200px) { } @media (min-width: 768px), @media (max-width: 990px) { } Remember not to overlap breakpoints (i.e. range boundaries)!

Media Query in action Download and follow along (open file with Chrome browser and text editor) http://cs.slu.edu/~esposito/teaching/1080/examples/ media-queries/media-queries-before.html - Add media queries - Note also mobile version and the range of media query from inspector of Chrome

Summary Basic syntax of a media query @media with logical operator

Summary Basic syntax of a media query @media with logical operator Remember not to overlap breakpoints

Summary Basic syntax of a media query @media with logical operator Remember not to overlap breakpoints Usually you provide basic styling then change or add to them in each media query

Practice Quiz Given the following media query: @media (min-width: 768px) and (max-width: 991px) {...} The styles within this media query will apply if the browser window is 991px wide. True or False?

Practice Quiz The usual approach to using media queries is to provide some base styling and then change and/or add to them within each media query. True or False?

Lecture outline Discuss HW Intro to Responsive Design Media Queries Responsive Layout

People browse from mobile!

What is a responsive Web site? Site designed to adapt its layout to the viewing environments by using fluid, proportion-based grid, flexible images and CSS media queries à Site s layout should adapt à Content verbosity or its visual delivery may change For example header text

Alternative to Responsive Web Design Have a server that detects device (user agent) based on the user agent in the HTTP request.

Alternative to Responsive Web Design Have a server that detects device (user agent) based on the user agent in the HTTP request. What is HTTP? High risks of using this feature: 1. develop one site for every device 2. Too much development (one site per version) 3. Risk of not covering all devices (new ones?)

Most common Responsive tool is a 12-column layout

Most common Responsive tool is a 12-column layout Why 12? Its has many factors: Divisible by 1,2,3,4,6, 12

12-column responsive layout Padding 3 3 3 3

A 12-column responsive layout can be split in many ways Padding 3 3 3 3 6 6 4 4 4

We need to use % to be responsive 100% 1 column = 100% / 12 = 8.33% 3 3 3 3 6 6 4 4 4

We need to use % to be responsive 100% 1 column = 100% / 12 = 8.33% 25% 25% 25% 25% 50% 50% 33% 33% 33%

We could also have nested grids, each grid is itself dividable into 12 100% 1 column = 100% / 12 = 8.33% 4 4 4 (33%) 6 6 3 3 3 3 4 4 4

Let s see these notions in practice http://cs.slu.edu/~esposito/teaching/1080/examples/ responsive/responsive-before.html

Most common Responsive tool is a 12-column layout Note the width: 90% plus the margins-right and margin-left set to auto will center the object

Most common Responsive tool is a 12-column layout /* Simple Responsive Framework. */.row { width: 100%; } The row class is trying to take 100% of that space

Now let s define some media queries /********** Large devices only **********/ @media (min-width: 1200px) {.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.collg-10,.col-lg-11,.col-lg-12 { float: left; border: 1px solid green; }.col-lg-1 { width: 8.33%; }.col-lg-2 { width: 16.66%; }.col-lg-3 { width: 25%; }.col-lg-4 { width: 33.33%; } // defining columns and marking with lg for large

Now let s define some media queries /********** Large devices only **********/ @media (min-width: 1200px) {.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.collg-10,.col-lg-11,.col-lg-12 { float: left; border: 1px solid green; }.col-lg-1 { width: 8.33%; }.col-lg-2 { width: 16.66%; }.col-lg-3 { width: 25%; }.col-lg-4 { width: 33.33%; }.col-lg-12 { width: 100%; } one column, should take 8.33% of space 3 columns, should take 25% of space 4 columns, should take 33.3% of space 12 columns should take 100% of space

Now let s define some media queries /********** Medium devices only **********/ @media (min-width: 950px) and (max-width: 1199px) {.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-12 { float: left; border: 1px solid green; }.col-md-1 { width: 8.33%; }.col-md-2 { width: 16.66%; }.col-md-3 { width: 25%; }.col-md-4 { width: 33.33%; }.col-md-12 { width: 100%; } one column, should take 8.33% of space 3 columns, should take 25% of space 12 columns should take 100% of space

I can assign the same element in 2 classes since my media query don t overlap /********** Medium devices only **********/ @media (min-width: 950px) and (max-width: 1199px) {.col-md-1 { width: 8.33%; } } /********** Large devices only **********/ @media (min-width: 1200px) {.col-lg-1 { width: 8.33%; } } Both classes.col-lg-1 and.col-md-1 will never exist at the same time!

Let s now look at the HTML code of the responsive layout <div class="row"> <div class="col-lg-3 col-md-6"><p>item 1</p></div> <div class="col-lg-3 col-md-6"><p>item 2 Wow this is cool</p></div> <div class="col-lg-3 col-md-6"><p>item 3</p></div> <div class="col-lg-3 col-md-6"><p>item 4</p></div> <div class="col-lg-3 col-md-6"><p>item 5 This is cool</p></div> <div class="col-lg-3 col-md-6"><p>item 6</p></div> <div class="col-lg-3 col-md-6"><p>item 7</p></div> <div class="col-lg-3 col-md-6"><p>item 8</p></div></div> When the device is large, the layout space will be occupied by column of size 3 (they spill over on the new line after 4 blocks since there are 12 columns total)

Let s now look at the HTML code of the responsive layout <div class="row"> <div class="col-lg-3 col-md-6"><p>item 1</p></div> <div class="col-lg-3 col-md-6"><p>item 2 Wow this is cool</p></div> <div class="col-lg-3 col-md-6"><p>item 3</p></div> <div class="col-lg-3 col-md-6"><p>item 4</p></div> <div class="col-lg-3 col-md-6"><p>item 5 This is cool</p></div> <div class="col-lg-3 col-md-6"><p>item 6</p></div> <div class="col-lg-3 col-md-6"><p>item 7</p></div> <div class="col-lg-3 col-md-6"><p>item 8</p></div></div> When the device is medium, as I squeeze the browser, the layout becomes a 6 and 6 column.

Let s now look at the HTML code of the responsive layout <div class="row"> <div class="col-lg-3 col-md-6"><p>item 1</p></div> <div class="col-lg-3 col-md-6"><p>item 2 Wow this is cool</p></div> <div class="col-lg-3 col-md-6"><p>item 3</p></div> <div class="col-lg-3 col-md-6"><p>item 4</p></div> <div class="col-lg-3 col-md-6"><p>item 5 This is cool</p></div> <div class="col-lg-3 col-md-6"><p>item 6</p></div> <div class="col-lg-3 col-md-6"><p>item 7</p></div> <div class="col-lg-3 col-md-6"><p>item 8</p></div></div> When I squeeze further outside the medium range, the floating property disappears and the elements are just stacked

Let s now look at how it looks on an iphone Why the layout does not work on a phone?

Let s now look at how it looks on an iphone If we look at the box model, we notice that The box width is 430 but the phone only has 375! Browser is trying to fit entire content into the viewboard of the phone because it does not find a mediaquery that is suitable How do we tell the browser: don t try to zoom-out, this is a responsive website

Don t try to zoom-out is specified with a special HTML meta tag <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>responsive Layout</title> Don t try to zoom out The default should be set without zoom!

Don t try to zoom-out is specified with a special HTML meta tag <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>responsive Layout</title> Verify that it is indeed visualize in one column by inspecting the phone view of this page with chrome: Don t try to zoom out http://cs.slu.edu/~esposito/teaching/1080/examples/ responsive/responsive-after.html The default should be set without zoom!

Practice quiz Most responsive frameworks use a 12-grid layout True or False?

Practice quiz To have a 12-grid layout means that 1 cell in that grid has width: 8.33% (100 / 12) True or False?

Practice quiz The following meta tag: <meta name="viewport" content="width=device-width, initial-scale=1"> Tells the browser to consider the width of the device as the real width of the screen and set its zoom level to 1, i.e., 100%, so it's not zoomed in or zoomed out. True or False?

Introduction to Computer Science Web Development Flavio Esposito http://cs.slu.edu/~esposito/teaching/1080/ Lecture 14