CSCU9B2: Web Tech Lecture 3

Similar documents
ITNP43: HTML Lecture 5

Using CSS for page layout

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

HTML Organizing Page Content

CSS for Page Layout Robert K. Moniot 1

Appendix D CSS Properties and Values

Assignments (4) Assessment as per Schedule (2)

Web Site Design and Development Lecture 9. CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM

HTML Organizing Page Content

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

Reading 2.2 Cascading Style Sheets

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to 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

Introduction to Web Design CSS Reference

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

Web Site Design and Development Lecture 7. CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM

Introduction to Web Design CSS Reference

CSS: Lists, Tables and the Box Model

FLOATING AND POSITIONING

The Importance of the CSS Box Model

CS193X: Web Programming Fundamentals

CSS Box Model. Cascading Style Sheets

ID1354 Internet Applications

Creating Layouts Using CSS. Lesson 9

What do we mean by layouts?

16. HTML5, HTML Graphics, & HTML Media 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과

2005 WebGUI Users Conference

Create a three column layout using CSS, divs and floating

Building Page Layouts

Web Design and Development Tutorial 03

Zen Garden. CSS Zen Garden

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

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

Cascade Stylesheets (CSS)

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

CE419 Web Programming. Session 3: HTML (contd.), CSS

PIC 40A. Lecture 4b: New elements in HTML5. Copyright 2011 Jukka Virtanen UCLA 1 04/09/14

Chapter 3 Style Sheets: CSS

Introduction to WEB PROGRAMMING

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

Parashar Technologies HTML Lecture Notes-4

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

What is the Box Model?

HTML-5.com itemscopehttp://data-vocabulary.org/breadcrumb<span itemprop="title">html 5</span> itemscopehttp://data-vocabulary.

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

CSS Cascading Style Sheets

Web Design and Implementation

HTML/XML. HTML Continued Introduction to CSS

Guidelines for doing the short exercises

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Internet Programming 1 ITG 212 / A

Adding CSS to your HTML

Controlling Appearance the Old Way

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

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

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 Styles Quick Reference Guide

Cascading Style Sheets CSCI 311

CSS.

The Benefits of CSS. Less work: Change look of the whole site with one edit

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

Cascading Style Sheet Quick Reference

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

Block & Inline Elements

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

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

escuela técnica superior de ingeniería informática

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

Client-Side Web Technologies. CSS Part II

Cascading Style Sheets for layout II CS7026

CSS. Lecture 16 COMPSCI 111/111G SS 2018

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

Cascading Style Sheets (CSS)

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

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

Exam II CIS 228: The Internet Prof. St. John Lehman College City University of New York 5 November 2009

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

CSS Lecture 16 COMPSCI 111/111G SS 2018

HTML and CSS a further introduction

Responsive Web Design (RWD)

HIERARCHICAL ORGANIZATION

Web Publishing Intermediate 2

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


Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

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

CSS Design and Layout Basic Exercise instructions. Today's exercises. Part 1: Arrange Page into Sections. Part 1, details (screenshot below)

CSS FOUNDATIONS IN-DEPTH. The nitty-gritty of css...

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

AGENDA :: MULTIMEDIA TOOLS :: CLASS NOTES

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

/* ========================================================================== PROJECT STYLES

3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal />

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

Multimedia Systems and Technologies Lab class 6 HTML 5 + CSS 3

CSS: The Basics CISC 282 September 20, 2014

Transcription:

CSCU9B2: Web Tech Lecture 3 1

The Box Model Every HTML element (e.g. h2, p etc) lies within a virtual box: Margin area LEFT TOP This is just some text that flows onto two lines. Border RIGHT Padding area BOTTOM Content area 2

Box Sizing By default, width and height specifications apply to the content area Property box-sizing: border-box; changes this to area including the border Margin area TOP Border LEFT height width RIGHT Padding area BOTTOM Content area 3

Width and Height Width and height can be specified for Block-level elements e.g. h1, p Inline replaced elements e.g. img But not for inline text Absolute or percentage specifications Percentage is relative to parent element Usually only specify width Height required to fit contents calculated by browser Width and height useful for images 4

Width and Height Examples p.narrow { width: 200px; height: 200px; } p.wide { width: 400px; } p.halfpage { width: 50%; } 6

Borders e.g. div { border-style: dashed; border-width: thick; border-color: gray; } Shorthand: e.g. div { border: grooved thin black; } Can target individual sides: e.g. div { bordertop: 6px solid green; } Border style is required; thickness and colour are optional 7

Margins and Padding e.g. p { padding: 10px; margin: 30px; } Can target individual sides: e.g. div { paddingtop: 6px; margin-left: 3em; } Can set all sides to different values: e.g. p { margin: 3px 20px 2px 20px; } Ordering is: top, right, bottom, left 8

p.bord { width: 400px; background-color: silver; border-style: groove; } p.bordpad { width: 400px; background-color: aqua; border-style: ridge; padding: 10px; } p.bordmarg { width: 400px; background-color: yellow; border: dashed red thick; padding: 10px; margin: 50px; } Examples 9

Background Colour and Images body { background-image: url(clouds.jpg); } p.back { width: 200px; height: 200px; background-color: aqua; border-style: ridge; } p.backimg { width: 400px; background-image: url(backgr1.gif); } 10

Measurement Units CODE px pt pc em ex in mm cm UNIT Pixel Point Pica Em EX Inches Millimeters centimeters 11

Positioning: Aligning Text aligned with text-align style left, right, center, justify Block elements aligned using margins E.g. right align: div { margin-left: auto; marginright: 0px; width: 200px; } E.g. centering: p { margin-left: auto; margin-right: auto; width: 200px; } 12

.txtcentre { text-align: center; } div.right { width: 300px; margin-left: auto; margin-right: 0px; } p.centre { width: 300px; text-align: justify; margin-left: auto; margin-right: auto; } Aligning Examples 13

Normal flow Positioning: Floating Block-level elements stack on top of each other Inline elements fill the available space in their block Can float both block and inline elements Element floats to left or right edge of content area of containing block Text flows around floated element E.g. div { float: left; } E.g img { float: right; } 14

Floating Examples span.goright { float: right; margin: 5px; width: 100px; background-color: yellow; } img.rightside { float: right; margin: 10px; } 15

Positioning: Specific Element removed from normal flow Given specific position Relative to containing block Containing block must be explicitly positioned Top level container is the web page body Types of specific position relative or absolute Specifying position by offset top, right, bottom, left 16

Positioning Examples p.contain { position: relative; width: 400px; margin-left: auto; margin-right: auto; } img.topleft { position: absolute; top: 0px; left: 0px; width: 100px; height: 83px; } <p><img class="topleft" src="images/6carr.gif" alt="car" /> This gives you a basic idea of </p> <p class="contain"> <img class="topleft" src="images/6carr.gif" alt="car" /> This gives you a basic idea of </p> 17

More HTML Semantic Tags 18

What are Semantic Tags? Semantic tags are elements with meaning Examples of non-semantic elements: <div> and <span> - say nothing about the content. Examples of semantic elements: <h1>, <p>, <table> - clearly define the type of their structure and content. 19

Limits of HTML pre HTML5 Many web pages and documents have semantic elements that are not represented by HTML tags before HTML5: header, footer, footnote, aside Many web sites contain HTML code like: <div id="nav"> </div> <div class="header"> </div> <div class="footer"> </div> to indicate navigation (links), header, and footer. 20

New Semantic Tags in HTML5 HTML5 offers new semantic elements to define different parts of a web page: <article>, <aside>, <details>, <figcaption>, <figure>, <footer>, <header>, <main>, <mark>, <nav>, <section>, <summary>, <time> They may or may not affect the visual appearance of a page, but the semantics allows better searching and style application. 21

Header <header> This element represents a container for introductory content. It may contain: Section's headings Section's table of contents A search form Bylines Logos <article> <header> <h1>heading here</h1> <h3>subheading here</h3> <p>more info here</p> </header> <p>lorem Ipsum...</p> </article> 22

Footer <footer> The <footer> element specifies a footer for a document or section. A <footer> element typically contains the author of the document, copyright information, links to terms of use, contact information, etc. <footer> <p>posted by: Fred Bloggs</p> <p>contact information: Planet Earth</p> </footer> 23

Navigation <nav> The <nav> element defines a set of navigation links. Not all groups of links on a web page need to be contained within a <nav> element; The element is primarily intended for sections that consist of major navigation blocks; The element can appear more than once on any given web page. Typically, the <nav> element can be found within the <header> structural element. 24

Sectional Elements <article>: specifies independent, self-contained content. Potential sources for the <article> element are news story, blog posts, forum posts. <section>: defines a section in a document. Several examples include chapters of a book or numbered sections of a thesis. <aside>: defines some content aside from the content it is placed in (like a sidebar). The aside content should be related to the surrounding content. <hgroup>: group any set of <h1 - h6> elements when the heading has multiple levels. 25

Example http://www.cs.stir.ac.uk/courses/cscu9b2/re sources/htmlexamples/cake-extras.html 26

End of Lecture Next Web Tech lecture on JavaScript 27