Web Design & Development - Tutorial 04



Similar documents
Style & Layout in the web: CSS and Bootstrap

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Outline of CSS: Cascading Style Sheets

Programming exercises (Assignments)

Using Style Sheets for Consistency

Microsoft Expression Web Quickstart Guide

Web Development 1 A4 Project Description Web Architecture

Selectors in Action LESSON 3

Using Adobe Dreamweaver CS4 (10.0)

MAGENTO THEME SHOE STORE

PELLISSIPPI STATE COMMUNITY COLLEGE MASTER SYLLABUS WEB DESIGN III: ADVANCED SITE DESIGN WEB 2812

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

ICE: HTML, CSS, and Validation

Client Side Customisation of Web Pages

Web Design with CSS and CSS3. Dr. Jan Stelovsky

Using an external style sheet with Dreamweaver (CS6)

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS COPYRIGHT 2013 TERRY ANN MORRIS, ED.D

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Web Design in Nvu Workbook 2

Creative Guidelines for s

Lesson Review Answers

CREATING HORIZONTAL NAVIGATION BAR USING ADOBE DREAMWEAVER CS5

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

Interactive Data Visualization for the Web Scott Murray

Fast track to HTML & CSS 101 (Web Design)

IT3504: Web Development Techniques (Optional)

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Designing HTML s for Use in the Advanced Editor

Responsive Web Design for Teachers. Exercise: Building a Responsive Page with the Fluid Grid Layout Feature

ADOBE DREAMWEAVER CS3 TUTORIAL

Timeline for Microsoft Dynamics CRM

IT3503 Web Development Techniques (Optional)

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

Introduction to Web Design Curriculum Sample

Dreamweaver. Introduction to Editing Web Pages

Introduction to XHTML. 2010, Robert K. Moniot 1

San Joaquin County Office of Education Career & Technical Education Web Design ~ Course Outline CBEDS#: 4601

<Insert Picture Here>

Dreamweaver CS5. Module 1: Website Development

Web Design and Databases WD: Class 7: HTML and CSS Part 3

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

Content Management System

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

Building A Very Simple Web Site

Responsive Web Design Creative License

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

IE Class Web Design Curriculum

Joomla! 2.5.x Training Manual

Creating Web Pages with Dreamweaver CS 6 and CSS

WEB DEVELOPMENT IA & IB (893 & 894)

Quick Reference Guide

White Paper Using PHP Site Assistant to create sites for mobile devices

Learning Web Design. Third Edition. A Beginner's Guide to (X)HTML, Style Sheets, and Web Graphics. Jennifer Niederst Robbins

Web Design I. Spring 2009 Kevin Cole Gallaudet University

Fortis Theme. User Guide. v Magento theme by Infortis. Copyright 2012 Infortis

Slicing and Coding the Navigation Background in CSS

Building Responsive Websites with the Bootstrap 3 Framework

CHAPTER 10. When you complete this chapter, you will be able to:

Saucon Valley School District Planned Course of Study

Creating Newsletters in Microsoft Word

Web Ambassador Training on the CMS

JJY s Joomla 1.5 Template Design Tutorial:

SM Wedding Userguide MagenTech [2012]

USER GUIDE. Unit 4: Schoolwires Editor. Chapter 1: Editor

Magento Responsive Theme Design

Web Authoring CSS. Module Descriptor

Positioning Container Elements

Course Duration: One hour Theory and 3 hours practical per week for 15weeks. As taught in 2010/2011 Session

Release: 1. ICAWEB414A Design simple web page layouts

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

introduces the subject matter, presents clear navigation, is easy to visually scan, and leads to more in-depth content. Additional Resources 10

ITNP43: HTML Lecture 4

Macromedia Dreamweaver 8 Developer Certification Examination Specification

Dreamweaver Domain 2: Planning Site Design and Page Layout

BT CONTENT SHOWCASE. JOOMLA EXTENSION User guide Version 2.1. Copyright 2013 Bowthemes Inc.

Basic tutorial for Dreamweaver CS5

UCL INFORMATION SERVICES DIVISION INFORMATION SYSTEMS. Silva. Introduction to Silva. Document No. IS-130

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

WP Popup Magic User Guide

A send-a-friend application with ASP Smart Mailer

Coding HTML Tips, Tricks and Best Practices

Developers Guide. Designs and Layouts HOW TO IMPLEMENT WEBSITE DESIGNS IN DYNAMICWEB. Version: English

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

Cascade Server. End User Training Guide. OIT Training and Documentation Services OIT TRAINING AND DOCUMENTATION.

Create Your own Company s Design Theme

Garfield Public Schools Fine & Practical Arts Curriculum Web Design

Web System Design and Management. Description. Learning Objectives GLIS 634. Page 1 of 7. Winter 2015

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Your Guide to the All New, Drag & Drop, Mobile-Responsive Builder

IAS Web Development using Dreamweaver CS4

CSS - Cascading Style Sheets

Principles of Web Design 6 th Edition. Chapter 12 Responsive Web Design

Site Maintenance. Table of Contents

Simply type the id# in the search mechanism of ACS Skills Online to access the learning assets outlined below.

Web design 2: creating web pages and site management using Dreamweaver MX

Participant Guide RP301: Ad Hoc Business Intelligence Reporting

Development Environments and Content Management Systems for the HTML/CSS Beginner

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

Building Your First Drupal 8 Company Site

Transcription:

Table of Contents Web Design & Development - Tutorial 04... 1 CSS Positioning and Layout... 1 Conventions... 2 What you need for this tutorial... 2 Common Terminology... 2 Layout with CSS... 3 Review the Box Model... 3 CSS Positioning... 4 Exercise 1 Investigate the CSS rules... 5 Normal Flow... 5 Relative Positioning... 5 Exercise 2 Using relative positioning... 6 Absolute Positioning... 7 Exercise 3 Using absolute positioning... 7 Further Selectors... 8 Child Selectors... 9 Exercise 4 Using Child Selectors... 9 Further Exercises... 10 References... 10 Acknowledgements... 10 Web Design & Development - Tutorial 04 CSS Positioning and Layout During this tutorial, you will gain experience with layout and positioning using CSS and XHTML. You will learn about the different types of positioning available when rendering CSS and how to manipulate elements on a page. You shall understand the differences between fixed 2006 Trevor Adams, Staffordshire University - 1 -

and liquid layouts. You shall also examine some of the common layouts used with web sites in operation today. Conventions This type of print indicates an exercise. They are usually present at the end of a major section of information This type of text indicates a code example / listing. You may wish to type this code out or copy & paste. Italic Text indicates code elements inline with a sentence. E.g. The <h1> element. What you need for this tutorial Access to the Internet (validation engine) A suitable web page / CSS editor such as Microsoft Notepad or Macromedia Dreamweaver MX 2004 / 8 (Refer to week 1 tutorial notes for Macromedia Dreamweaver MX 2004 assistance). A selection of web browsers for testing. E.g. Microsoft Internet Explorer 6.x, Opera 7.54+, Mozilla Firefox 1.x or Safari An understanding of the topics presented in the previous tutorials. Please ensure that you are comfortable and grasp the concepts from all prior tutorials before proceeding or some material in this tutorial may be inaccessible Common Terminology You should be familiar with the following words/concepts/phrases: CSS, XHTML, Elements, Attributes and Mark-up Selectors, Declarations and Rules Block-level and inline elements 2006 Trevor Adams, Staffordshire University - 2 -

Parent and child elements The box model CSS units of measurement If you are not familiar with these topics, it is recommended that you review the tutorial material prior to this tutorial and/or discuss these topics with your tutor. For your convenience, the box model is reviewed on page 3 - Review the Box Model. Layout with CSS Traditionally, web designers and developers have used tables (with no border, padding or margin) to control layout. Invisible tables essentially create a grid structure for the page. This technique is in wide spread use still and some developers even promote the technique. You have already covered the basics of XHTML and the separation between presentation and meaning and might have realised already that the use of tables for anything other than the displaying of tabular structures is semantically incorrect. Layout is possible using CSS and allows the designers/developer to maintain strict XHTML which confirms to web standards and still achieve the desired visual effects. Review the Box Model You have seen how CSS implements the box-model (Figure 1) when formatting elements. Everything in XHTML is rendered as a box. You have also encountered inline and block-level elements and the differences between them (you might want to review those topics if you are not certain). 2006 Trevor Adams, Staffordshire University - 3 -

Figure 1 The Box Model CSS enables you to position these boxes on a rendered page using several positioning schemes. One such scheme is normal flow which is the one you have encountered up to now. This takes the elements in the order they appear in the mark-up and renders them appropriate as inline or block-level elements in the browser. The techniques shown in this tutorial explain how boxes can be displaced from normal flow under the control of the developer. CSS Positioning This section introduces three schemes for controlling the position of elements on a page. These are: Normal Flow The default positioning scheme: http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/xhtml_normal_flow.html Float A box is taken out of normal flow and floated at the far edge of the window (the side is determined by CSS rule). http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/xhtml_float.html Absolute a box is removed from normal flow and placed according the co-ordinates specified in the CSS rules it has. http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/xhtml_absolute.html The main CSS property affect layout is the position property, the possible of which are listed in Table 1. 2006 Trevor Adams, Staffordshire University - 4 -

Table 1 Position property values (Ducket 2005) Value Description static relative absolute fixed A normal box laid out according to normal flow (because normal flow the default positioning scheme, you will rarely have to specify this value). The box is positioned according to the rules of normal flow and is then offset relative to the normal position (any subsequent boxes are calculated as if the box were not offset). The box s position is determined using offsets from the top, left, bottom or right of the elements will be positioned within this containing box, there is no impact on the layout of sibling elements. The box s position follows the same model as absolute positioning, but it will be fixed to some point within the page or screen, and will not move when the user scrolls the page. We shall not cover fixed as it is not supported well in popular browsers. Exercise 1 Investigate the CSS rules Use the examples given in the section CSS Positioning and examine the CSS files that are associated with the HTML documents. You should find links available to download the CSS file. Do the CSS rules make sense? Can you match the rules to the elements in the mark-up document? Explain your thinking and/or ask questions of your tutor regarding the relationships. Normal Flow Normal flow should be familiar to you as it is the default way that a browser renders XHTML mark-up. You need no styling rules to achieve normal flow. When a document uses normal flow, block-level elements are stacked vertically. You can separate boxes and their content using the margin and padding properties in CSS rules. Relative Positioning Relative positioning lays out a page according to normal flow, but then offsets any element whose position property has a value of relative from its position in normal flow according to the offset. 2006 Trevor Adams, Staffordshire University - 5 -

The offset is specified using four CSS properties: top, bottom, right and left (explanation in Table 2). Table 2 Box Offset Properties (Ducket 2005) Property Purpose Top Right Bottom Left How far the top of a box is offset below the top of the containing block How far the right-hand side of the box is offset from the right edge of the containing block How far the bottom of a box is offset above the bottom of the containing block How far the left-hand side of the box is offset from the left edge of the containing block Exercise 2 Using relative positioning Download the web page: http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/xhtml_relative.html and accompanying CSS file (linked within the document first paragraph). The document should look like Figure 2. Examine the XHTML and ascertain the document structure. Examine the CSS and determine how the current style sheet is affecting the presentation of the document. Add styling rules to the second page so the output resembles that of Figure 3. Hint: It should only require three additional rules, use the tables above for assistance. Figure 2 Sample File default view (Exercise 2) 2006 Trevor Adams, Staffordshire University - 6 -

Figure 3 Sample file desire outcome (Exercise 2) Absolute Positioning Absolute positioning enabled you to position a box using offsets from the top, right, bottom and left of the containing block (Ducket 2005). Absolutely positioned blocks are taken from normal flow and form a new containing block for any child elements. Elements that have been positioned absolutely do not flow around other elements. It is possible to obscure other elements with an absolutely positioned element. To remedy this circumstance, the CSS property z-order is available. The z-order property can be assigned an integer (including negative numbers). The order of depth of an element is relative to those directly above and below it. An element with a z-order value of -1 will be behind an element with a z-order value of 0. When specifying offsets and co-ordinates, the usual CSS units of measurements apply. It is common to specify layout boxes using pixels (px). Exercise 3 Using absolute positioning Save the web page: http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/xhtml_absolute2.html and save it to your personal storage area ensuring that you retain all the mark-up as shown in the source file. Using absolute positioning techniques, alter the file you downloaded from the start sample (Figure 4) so that it displays two columns, one page in each (Figure 5). 2006 Trevor Adams, Staffordshire University - 7 -

Figure 4 Starting page (exercise 3) Figure 5 Desired results for exercise 3 Further Selectors This section will briefly introduce the concept of inherited element selectors, or child selectors. It is often necessary when performing layout operations with CSS to wrap multiple elements within a <div> element or inline elements within <span>. It is much more efficient to affect elements 2006 Trevor Adams, Staffordshire University - 8 -

within a named region than it is to add class attributes to each and every element that needs to be altered. It is in these circumstances where child element selectors are used. Child Selectors To create child element selectors, simply insert white space (space, tab etc.) in between parent and child selectors. The code example in would create a style rule for all <p> elements inside a <div> with an id attribute of content. div#content p { font-family:arial; font-size:0.9em; color:navy; } Figure 6 Child selectors, <p> elements inside <div> element with ID = content This technique can be used at multiple levels, for example, it is possible style all <a> elements that are contained within <ul>, that are in turn located within a <div> element with an id attribute of navigation (Figure 7). div#navigation ul a { /* style rules here */ } Figure 7 Three depth child selector rule It is also possible to specify many of these rules at once by separating them with commas. An example is shown in Figure 8. div#content h1, div#pullpanel h2 { /* This rule will be applied to all <h1> elements inside <div id="content"> and all <h2> elements inside <div id="pullpanel"> */ } Figure 8 Multiple child selectors separated with commas Exercise 4 Using Child Selectors Download: http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/xhtml_child_selector.html and the accompanying CSS file (linked on the first content line of the document). Using child selectors and without modifying the XHTML mark-up, apply a style rule that effects only the <ul> element contained within the navigation block and not the other <ul> elements on the page. Hint: You should try to use child selectors. 2006 Trevor Adams, Staffordshire University - 9 -

Further Exercises Browse sample layouts located at: http://www.fcet.staffs.ac.uk/tja1/wdd/tutorial/layouts/ and download the ZIP resource file and expand it into a folder of your choice. Examine the sample layouts and try to ascertain how the style sheets are affecting the mark-up, try to explain how each section is created. Use these examples to create a five page web site using your own content / theme. It is possible to link more than one style sheet to a page. Try to create your site so the layout is contained within one file and presentation is stored in another. References Ducket, J. (2005) Accessible XHTML and CSS Web Sites: Problem-Design-Solution, Wrox Press (J. Wiley Publishing, Inc.), Indianapolis, IN, USA Schafer, S.M. (2005) Web Standards, Wrox Press (J. Wiley Publishing, Inc), Indianapolis, IN, USA Schmitt, C. et al. (2005) Professional CSS: Cascading Style Sheets for Web Design, Wrox Press (J. Wiley Publishing, Inc), Indianapolis, IN, USA Acknowledgements Portions of the tutorial exercises were taken from Duckett (2005) 2006 Trevor Adams, Staffordshire University - 10 -