ITNP43: HTML Lecture 5

Similar documents
CSCU9B2: Web Tech Lecture 3

Appendix D CSS Properties and Values

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

CSS Box Model. Cascading Style Sheets

Introduction to Web Design CSS Reference

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

Introduction to Web Design CSS Reference

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

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

FLOATING AND POSITIONING

Assignments (4) Assessment as per Schedule (2)

Cascade Stylesheets (CSS)

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

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

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

ID1354 Internet Applications

Parashar Technologies HTML Lecture Notes-4

The Importance of the CSS Box Model

Reading 2.2 Cascading Style Sheets

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

Building Page Layouts

Web Design and Development Tutorial 03

Adding CSS to your HTML

Chapter 3 Style Sheets: 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

Client-Side Web Technologies. CSS Part II

CSS Styles Quick Reference Guide

CSS: Lists, Tables and the Box Model

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

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

Cascading Style Sheets CSCI 311

CSS Cascading Style Sheets

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

Controlling Appearance the Old Way

Cascading Style Sheet Quick Reference

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

2005 WebGUI Users Conference

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

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

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

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

Styles, Style Sheets, the Box Model and Liquid Layout

HTML/XML. HTML Continued Introduction to CSS

COSC 2206 Internet Tools. CSS Cascading Style Sheets

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

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

Web Design and Implementation

Creating Layouts Using CSS. Lesson 9

Cascading Style Sheets (CSS)

What is the Box Model?

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

What do we mean by layouts?

Internet Programming 1 ITG 212 / A

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

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

Using CSS for page layout

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

HTML Organizing Page Content

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

Produced by. Web Development. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology


CSS. Lecture 16 COMPSCI 111/111G SS 2018

CSS.

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

CSS: The Basics CISC 282 September 20, 2014

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

CSS Lecture 16 COMPSCI 111/111G SS 2018

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

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

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

CSS: Cascading Style Sheets

Table of Contents. MySource Matrix Content Types Manual

Produced by. Web Development. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology

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

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

BIM222 Internet Programming

Cascading Style Sheets

Web Programming Step by Step

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

Web Engineering CSS. By Assistant Prof Malik M Ali

Block & Inline Elements

CSC Website Design, Spring CSS Flexible Box

HTML Organizing Page Content

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

CSS. Shan-Hung Wu CS, NTHU

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

Lab Introduction to Cascading Style Sheets

Web Design and Development ACS Chapter 12. Using Tables 11/23/2017 1

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

Create a three column layout using CSS, divs and floating

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

Chapter 3 CSS for Layout

COMS 359: Interactive Media

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

CSS Exercises. Create a basic CSS layout Use BlueFish to open layout.html Create a layout using <div> tags Use a browser (Firefox) to view your page

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

Transcription:

ITNP43: HTML Lecture 5 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 1

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 2

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 3

Margins and Padding e.g. p { padding: 10px; margin: 30px; } Can target individual sides: e.g. div { padding- top: 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 Examples 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; } 9 4

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 CODE px pt pc em ex in mm cm Measurement Units UNIT Pixel Point Pica Em EX Inches Millimeters centimeters 11 5

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 Aligning Examples.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; } 13 6

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 7

Positioning: Absolute 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 position relative or absolute Specifying position by offset top, right, bottom, left 16 Absolute 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"> contain <img class="topleft" src="images/6carr.gif" alt="car" /> This gives you a basic idea of </p> 17 8

End of Lecture 18 9