Using CSS for page layout

Similar documents
HTML Organizing Page Content

Styles, Style Sheets, the Box Model and Liquid Layout

CSS for Page Layout Robert K. Moniot 1

CSCU9B2: Web Tech Lecture 3

HTML Organizing Page Content

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

HIERARCHICAL ORGANIZATION

Creating Layouts Using CSS. Lesson 9

Cascading Style Sheets for layout II CS7026

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

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

The Importance of the CSS Box Model

Website Development with HTML5, CSS and Bootstrap

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

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

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

HTML and CSS a further introduction

Building Page Layouts

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

FLOATING AND POSITIONING

ADOBE 9A Adobe Dreamweaver CS4 ACE.

Introduction to WEB PROGRAMMING

New Media Production HTML5

Guidelines for doing the short exercises

Block & Inline Elements

Zen Garden. CSS Zen Garden

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

Create a three column layout using CSS, divs and floating

CSS. Shan-Hung Wu CS, NTHU

Chapter 7 BMIS335 Web Design & Development

CSS.

Client-Side Web Technologies. CSS Part II

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

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

CSS Layout Part I. Web Development

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

CSS: formatting webpages

Chapter 3 Style Sheets: CSS

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

COMSC-031 Web Site Development- Part 2

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

Web Design and Implementation

Programmazione Web a.a. 2017/2018 HTML5

Assignments (4) Assessment as per Schedule (2)

Getting Started with Eric Meyer's CSS Sculptor 1.0

How to lay out a web page with CSS


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

Internet Programming 1 ITG 212 / A

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

Cascading Style Sheets Level 2

CS193X: Web Programming Fundamentals

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

COMS 359: Interactive Media

CSS worksheet. JMC 105 Drake University

What do we mean by layouts?

VISA/APCO/STAC 2P61 WEBSITE CREATION Fall Term 2012

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

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

CSS: Cascading Style Sheets

Responsive Web Design (RWD)

ITNP43: HTML Lecture 5

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

Layout with Layers and CSS

BA. (Hons) Graphics Design

Advanced Dreamweaver CS6

Designing the Home Page and Creating Additional Pages

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

COMS 359: Interactive Media

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

Adding CSS to your HTML

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

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

There are 3 places you can write CSS.

Creating HTML files using Notepad

HTML5. HTML5 Introduction. Form Input Types. Semantic Elements. Form Attributes. Form Elements. Month Number Range Search Tel Url Time Week

HTML5: Adding Style. Styling Differences. HTML5: Adding Style Nancy Gill

PUBLISHER SPECIFIC CSS RULES

Table Basics. The structure of an table

CompuScholar, Inc. Alignment to Utah's Web Development I Standards

ORB Education Quality Teaching Resources

Introduction to HTML & CSS. Instructor: Beck Johnson Week 5

Dreamweaver CS3 Lab 2

Using Dreamweaver CS6

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

Produced by. Web Development. BSc in Applied Computing. Eamonn de Leastar

How to lay out a web page with CSS

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

Web Site Design and Development Lecture 13

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

Dreamweaver CS4. Introduction. References :

HTML5 and CSS3: New Markup & Styles for the Emerging Web. Jason Clark Head of Digital Access & Web Services Montana State University Library

Header. Article. Footer

Introduction to HTML & CSS. Instructor: Beck Johnson Week 2

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

Deccansoft Software Services

ITSE 1401 Web Design Tools Lab Project 4 (Expression Web 4 - Units M, N, O, P) Last revised: 1/9/14

Designing for Web Using Markup Language and Style Sheets

Module 2 (VII): CSS [Part 4]

Transcription:

Using CSS for page layout Advantages: Greater typographic control Style is separate from structure Potentially smaller documents Easier site maintenance Increased page layout control Increased accessibility Ability to define styles for multiple media types Support of the Semantic Web Disadvantages: There still remain issues with the lack of uniform browser support of CSS Those already adept at designing page layout using HTML tables will see a temporary drop in their productivity as they learn CSS layout 6-1

The box model Content: Text and web page elements in the container Padding: Area between the content and the border Border: Area between the padding and the margin Margin: Determines the empty space between the element and adjacent elements 6-2

The box model (continued) When you set the width of an element, you are setting the width of its content area. To get the actual width of the box on the screen, you need to add to that: (the width of the margin + the width of the border + the width of the padding) 2 The background properties of an element apply to its content, padding and border areas, but not to its margin area. The margin is always transparent. (Well, except for <body>) The default value of the padding is usually zero. non-zero default value for margins. By default, an element has no border. However, browsers often have a 6-3

Normal flow By default, the elements of your page are displayed in normal flow, that is, from left to right, and then from top to bottom. Recall that, in normal flow: inline elements are always displayed to the right of the previous element and on the same line (if there is enough space on that line within their containing element). block-level elements always start a new line, and the element following them also starts on a new line; in other words, a block-level element is always displayed on its own line. You should also know that, by default: Block-level elements use all of the horizontal space that their container element gives them. Inline elements use only the space they need to display their contents (together with padding/margins). However, it is possible to explicitly override the default width and height of a block-level element (demo). 6-4

Positioning elements with CSS 1. Static positioning: It is the default, that is, according to normal flow 2. Relative positioning A relatively positioned element is positioned relative to its normal position in the flow. The content of a relatively positioned element can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow. 3. Absolute positioning Absolutely positioned elements are removed from the normal flow. The document and other elements behave as if the absolutely positioned element does not exist. 4. Fixed positioning An element with fixed positioning is positioned relative to the browser window. It will not move even if the window is scrolled. Fixed positioned elements are removed from the normal flow. The document and other elements behave as if the fixed positioned element does not exist. ( Floating is yet another way to position an element more on that later) 6-5

Relative positioning The (empty) space for the element is still in the normal flow but the display of the element is offset from its normal position.... <style> body { background-color: #666; font-size: 3em; line-height: 200%; }.shifted { position: relative; top: 20px; right: 50px; } span { background-color: #FFF; border: 1px solid #000; } p { background-color: #666666; } </style> </head> <body> <p><span>static 1</span> <span>static 2</span> <span>static 3</span> <span>static 4</span> <span>static 5</span> <span class="shifted">relative</span> <span>static 6</span> <span>static 7</span> <span>static 8</span> <span>static 9</span> <span>static 10</span> </p> </body> 6-6

Absolute positioning An absolute position element is positioned relative to the first containing element that has a position other than static. If no such element is found, the containing block is <html>, that is, the canvas of the entire window.... <style> body { background-color: #666; font-size: 3em; line-height: 200%; }.shifted { position: absolute; top: 20px; right: 50px; } span { background-color: #FFF; border: 1px solid #000; } p { background-color: #666666; /* position: relative; */ } </style> </head> <body> <p><span>static 1</span> <span>static 2</span> <span>static 3</span> <span>static 4</span> <span>static 5</span> <span class="shifted">relative</span> <span>static 6</span> <span>static 7</span> <span>static 8</span> <span>static 9</span> <span>static 10</span> </p> </body> What if top were replaced with bottom? What if the comment were removed? 6-7

Fixed positioning An element with fixed positioning is positioned relative to the browser window (not a containing element nor the window s canvas, as in absolute positioning). It will not move even if the window is scrolled.... <style> body { background-color: #666; font-size: 3em; line-height: 200%; }.shifted { position: fixed; top: 20px; right: 50px; } span { background-color: #FFF; border: 1px solid #000; } p { background-color: #666666; } </style> </head> <body> <p><span>static 1</span> <span>static 2</span> <span>static 3</span> <span>static 4</span> <span>static 5</span> <span class="shifted">relative</span> <span>static 6</span> <span>static 7</span> <span>static 8</span> <span>static 9</span> <span>static 10</span> </p> </body> 6-8

New HTML5 structural elements The following elements are like <div> but have more meaningful names. <section>: a thematic grouping of content typically with a header; examples include a chapter in a book, a tabbed page in a dialog box, or the components of a web page such as an introduction, news items, or contact information <nav>: a section with navigation links, that is, a section of a page that links to other pages or to parts within the page <article>: a self-contained composition in a document that is, in principle, independently distributable or reusable; examples includes a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, etc. <aside>: a section of a page that consists of content that is tangentially related to the main topic; often rendered as a sidebar <hgroup>: used to group a set of <h1>-<h6> elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines <header>: a group of introductory or navigational aids, including <h1>-<h6>, <hgroup>, logo, etc. <footer>: typically contains information about its parent section such as who wrote it, links to related documents, copyright data, etc. 6-9