Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

Similar documents
Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

2005 WebGUI Users Conference

First Diploma Unit 10 Client Side Web. Week 4 -The CSS Box model

Unit 20 - Client Side Customisation of Web Pages WEEK 5 LESSON 6 DESIGNING A WEB-SITE

MichPA Content Guide. Table of Contents. Website Section Overview. Global Banner & Navigation. Content Area Client editable

Chapter 3 CSS for Layout

Appendix D CSS Properties and Values

Schrödinger's Website

COMS 359: Interactive Media

SUMMARY OF DESIGN CHOICES

Web Design and Development Tutorial 03

Web Engineering CSS. By Assistant Prof Malik M Ali

Cascading Style Sheet Quick Reference

Agenda. Combining Rules & Selectors Classes, IDs and DIVs

CSS Cascading Style Sheets

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference


Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 3 Introduction to CSS

IDM 221. Web Design I. IDM 221: Web Authoring I 1

CSS Box Model. Cascading Style Sheets

TITLE EXAMPLE. Sub - title

More CSS. <link href="filename" type="text/css" rel="stylesheet" /> CS380

CSS: The Basics CISC 282 September 20, 2014

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

Styles, Style Sheets, the Box Model and Liquid Layout

IDM 221. Web Design I. IDM 221: Web Authoring I 1

What is the box model?

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

CSS Selectors. element selectors. .class selectors. #id selectors

CSS: Cascading Style Sheets

Controlling Appearance the Old Way

HTML/XML. HTML Continued Introduction to CSS

There are 3 places you can write CSS.

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

<head> <meta http-equiv= Content-Type content= text/html; charset=utf-8 /> <title>caprese Salad</title> </head>

Reading 2.2 Cascading Style Sheets

Parashar Technologies HTML Lecture Notes-4

Page Layout Using Tables

CSC309 Programming on the Web week 3: css, rwd

Creating Layouts Using CSS. Lesson 9

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

mpdf Example 6. Tables nested <?php

Introduction to WEB PROGRAMMING

Faculty Web Pages: Editing the Template Prepared by Tamara Fudge, June 2008

Building Page Layouts

AR0051 content/style. Michelle Bettman Henry Kiksen. Challenge the future

Gestures: ingsa GESTURES

COSC 2206 Internet Tools. CSS Cascading Style Sheets

CSS. MPRI : Web Data Management. Antoine Amarilli Friday, December 7th 1/43

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

What do we mean by layouts?

CSC 337. Cascading Style Sheets. Marty Stepp, Rick Mercer

CSE 154 LECTURE 5: FLOATING AND POSITIONING

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

7300 Warden Avenue, Suite 503 Markham, Ontario Canada L3R 9Z6. Phone: Toll Free: Fax:

Brand identity design. Professional logo design + Branding guidelines + Stationery Designed by JAVIER

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Let's take a look at what CSS looks like in Dreamweaver using the "Embedded" coding which is the styles are within the html code and not separate.

Cascading Style Sheets CSCI 311

Divs, Classes & IDs. Web Development

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

SCHOOL DISTRICT 308 VISUAL STANDARD GUIDE

Brand Standards Manual. Copyright March 2007

Web Design and Implementation

First Diploma Unit 10 Client Side Web. Week 4 CSS and Images

CSS Futures. Web Development

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

CS134 Web Site Design & Development. Quiz1

q u e s t i o n s? contact or

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

The CSS Box Model. Motivation. CSS Box Model. CSE 190 M (Web Programming), Spring 2008 University of Washington

Adding CSS to your HTML

Personal brand identity desigend by JAVIER

CSS.

Updates to Phone Contact

CSS Web2.0 Search. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall Exam #1 graded Exam #2 rescheduled. now tentatively 11/10

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

ALLASSO CORPORATE IDENTITY USER GUIDLINES

Creating and Implementing Decision Templates

CLASSES are a way to select custom elements without using a tag name

BRAND GUIDELINES All rights reserved.

WCU ATHLETICS LOGOS & USAGE WESTERN CAROLINA UNIVERSITY ATHLETIC LOGO GUIDELINES PAGE 1

A STEP-BY-STEP GUIDE TO EVENT BRANDING

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

ICT IGCSE Practical Revision Presentation Web Authoring

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

Module 2 (VII): CSS [Part 4]

Cascading Style Sheets (CSS)

Web Authoring and Design. Benjamin Kenwright

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

template guidelines. 1. Visual identity 2. How to build an

HTML and CSS a further introduction

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

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

Transcription:

Unit 20 - Client Side Customisation of Web Pages Week 2 Lesson 4 The Box Model

Last Time Looked at what CSS is Looked at why we will use it Used CSS In-line Embedded (internal style-sheet) External <link rel= stylesheet href= mystyle.css > <style title= currrentstyle media= screen > @import mystyle.css </style>

Some definitions Selector Property Value elements

Selectors Selector title Property the item being changed Value - How much it is being changed E.g. H1{color: red} specifies that h1 will always give a red colour Element each area of the page; may be a wide variety from <body> to <p>

Types of Selector

Web-page structure Different elements that can be nested within one another. Style commands: body{ background-color: aqua; font-size: 100%; } div{ Width: 30%; }.feedback{ color: #00ff00; } #footnote{ font-size: 0.2em; } HTML <body> <div> </body> <div class= feedback ></div> <div class= feedback ></div> </div> <div id= footnote ></div>

Box Model CSS creates layout of web-pages View in any browser, At any resolution design integrity should remain. Layout recalculated on each opening Pages can be designed very accurately pixel perfect

Content area Place the text, images etc here Usually have more than one on each page CSS.item{ width: 20%; background-color: aqua; color: red; } HTML <div class= item >some text <img src= images/#.jpg alt= my image description in words /> </div>

Page of examples Create a web-page BoxEG.html with the following elements: <body> custom background-color or background-image <div id= wrapper > custom backgroundcolor, width ~80% 2 <div> containing an image 2 <p> custom color, 2 paragraphs of lorem ipsum in each

BoxEG Should look something like image1 #wrapper image2 Text in paragraphs Body

Padding Blank space around the content so that it doesn't impinge on the border (or vice versa). Is optional, if not defined is set to zero (invisible).

Padding examples Add padding to the divs with images in them. div { padding: 5px; } Record the code, screen-shot the corresponding webpage element Change the padding e.g. to 50 px, record the code, screen-shot the corresponding web-page element. Write a brief description of how padding has affected the appearance of the element.

Border Designed area at the edge around the content (outside the padding). Is optional, if not defined is set to zero (invisible). Can define: Width Color Style (limited list use W3C to find out what these are

Border examples Add a border to the div id= wrapper. #wrapper{ Border: 5px solid red; } record the code, screen-shot the corresponding webpage element. Add other borders change width, colour and style. Possible styles are: dotted, dashed, solid, double, groove, ridge, inset, outset. Record as above. Write a brief description of how the border has affected the appearance of the element.

Margin Blank space around the edge of everything to protect it from the edge of the screen or other nearby elements. Is optional, if not defined is set to zero (invisible). Can be negative.

Margin example Add a margin to both of the <p> elements. p { Margin: 10px; } record the code, screen-shot the corresponding webpage elements. Change the margin e.g. to 50 px, or -10px (margins can take a negative value), record the code, screen-shot the corresponding web-page elements. Write a brief description of how margin has affected the relative positions of the element.

CSS Box Model Structures pages like a table Defines: Margins Borders Padding Content

Box model Can define height & width for each area Can be set separately Margins can have negative values Usually set as either pixels or percentages Percent of screen is best for layout consistency Can be in-line or blocked

Box Model <html> <head> <style type="text/css"> div { width:220px; padding:0px; border:5px solid gray; margin:0px; } </style> </head> <body> Copy this code then vary Padding Border Margin Use big variations <img src= #.gif" width="250" height="1" /><br /><br /> <div >This div is 220px wide</div> </body> </html> Observe the effect, take screen shots of your code and the effect!

Accessing CSS from HTML One of these needs to be in the head section of each web-page <link rel= stylesheet type= text/css href= class.css /> or <style type = text/css title= currentstyle media= screen > @import style.css ; </style>

CSS task Create examples for each of the following: Background colour Background images Formatting text Applying borders Applying padding Heading styles Positioning elements Creating columns Take screen-shots of the code and the result. Border-radius: 5px;

CSS task continued Note how your examples affected the formatting Alter the values and note how that changes the formatting

Background colour <html> 2. <head> 3. <style> 4. body {background-color: yellow} 5. </style> 6. </head> 7. <body> 8. </body> 9. </html>

Background images <html> 2. <head> 3. <style> 4. body {background-image: url( picture.jpg )} 5. </style> image must be in the same folder 6. </head> as web-page or whole file-path. 7. <body> 8. </body> 9. </html>

Formatting text <html> 2. <head> 3. <style> 4. h1{font-family: serif; font-style: italic; font-weight: bold; font-size: 200px; color: green;} 5. </style> 6. </head> 7. <body> 8. <h1> Lorem ipsum </h1> 9. </body> 10. </html>

Applying borders <html> 2. <head> 3. <style> 4..border1 {border-style: groove} 5..border2 {border-style: double solid} 6..border3 {border-style: double solid groove} 7. </style> 8. </head> 9. <body> 10. <p class= border1 > Lorem ipsum </p> 11. <p class= border2 >dolor sit amet</p> 12. <p class= border3 >consectetur adipiscing elit</p> 13. </body> 14. </html>

Applying padding. <html> 2. <head> 3. <style> 4..padding1 {padding: 1cm} 5..padding2 {padding: 0.5cm 1.5cm} 6. </style> 7. </head> 8. <body> 9. <table border= 1 > 10. <tr> 11. <td class= padding1 >dolor sit amet</td> 12. </tr> 13. </table> 14. <br> 15. <table border= 1 > 16. <tr> 17. <td class= padding2 > consectetur adipiscing elit </td> 18. </tr> 19. </table> 20. </body> 21. </html>

Heading styles <html> 2. <head> 3. <style> 4. h1{ 5. background: red; 6. color: white; 7. font-family: times new roman; 8. font-style: italic; 9. } 10. h2{ 11. text-align: center; 12. text-decoration: underline; 13. font-size: xx-large; 14. Font-weight: bold; 15. } 16. </style> 17. </head> 18. <body> 19. <h1> Sed ac odio eu massa </h1> 20. <br> 21. <h2> mattis pellentesque a </h2> 22. </body> 23. </html>

Positioning elements <html> 2. <head> 3. <style> 4..position_relative {position:relative;left;20px} 5.. position_absolute {position:absolute;left;200px;top:20px} 6..border3 {border-style: double solid groove} 7. </style> 8. </head> 9. <body> 10. Suspendisse ac orci tortor 11. <p class=position_relative>dolor sit amet</p> 12. <p class=. position_absolute> consectetur adipiscing elit</p> 13. </body> 14. </html>

Positioning elements Static Default, next line (or floating) Relative lays out all elements as though the element were not positioned, and then adjust the element's position, without changing layout leaves a gap for the element Absolute fixed

Positioning elements Static Relative Absolute Instead, position it at a specified position relative to its closest positioned ancestor if any, or otherwise relative to the initial containing block. No gap. Fixed position it at a specified position relative to the screen's viewport and don't move it when scrolled. No gap.

Creating columns <html> 2. <head> 3. <style> 4..nav { 5. width: 220px; 6. padding: 10px; 7. float: left; 8. } 9..content { 10. padding: 10px; 11. margin-left: 230px; 12. border-left: 1px solid #006; 13. } 14..footer { 15. Border-top: 1px solid #006; 16. Text-align: right; 17. } 18. </style> 18. </head> 19. <body> 20. Lorem ipsum 21. <div class= nav >Suspendisse aliquet</div> 22. <div class= content >porta sapien</div> 23. <div class= footer >eget dignissim</div> 24. </body> 25. </html>

Columns (Newspaper) <head> <style type="text/css">.newspaper { -moz-column-count:3; /* Firefox */ -webkit-column-count:3; /* Safari and Chrome */ column-count:3; } </style> </head> <body> <div class="newspaper"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad... </div> </body> </html>

Advantages of CSS Controlling & editing layout is faster House style more consistent all pages use same style sheet Smaller file sizes formatting in one file not duplicated across all web-pages Accessibility for users with screen readers improved.

Assignment 1 P1 explain how HTML files access CSS P2 explain the features of the box model for CSS M1 assess different implementation styles of CSS

Effects and Treatments You have this way out font you would like to use e.g. Shelley Allegro You know it does not display very well in a browser... What to do??????

Image Replacement Well, actually we replace the text... http://stopdesign.com/archive/2003/03/07/r eplace-text.html

Summary Looked at what CSS is Looked at why we will use it Actually used our first CSS