Web Design and Development Tutorial 03

Size: px
Start display at page:

Download "Web Design and Development Tutorial 03"

Transcription

1 Table of Contents Web Design & Development - Tutorial Using and Applying CSS to XHTML... 2 Conventions... 2 What you need for this tutorial... 2 Common Terminology... 3 Parent / Child Elements... 3 Testing a Document... 3 CSS Inheritance... 4 Exploring CSS... 4 Selectors... 4 Simple Selector... 5 Universal Selector... 5 Type Selector... 5 Class Selector... 6 The ID Selector... 6 Exercise 1 Using Selectors... 7 Exercise 2 Investigation... 8 The Box Model & Measurement... 8 Exercise 3 Box Model Demonstration... 8 Inline and Block-Level Elements... 9 Exercise 4 Altering Block-Level Elements Units of Measurement Absolute Units Relative Units and Percentages Exercise 5 Using Measurements The <div> and <span> Elements A Word on CSS properties Border Property Trevor Adams, Staffordshire University - 1 -

2 Padding Property Margin Property Dimensions Exercise 6 Styling using <div> and <span> Further Exercises References Acknowledgements Web Design & Development - Tutorial 03 Using and Applying CSS to XHTML The purpose of this tutorial is to build upon the introduction to XHTML 1.0 Strict and CSS provided in Tutorial 02. You shall explore various CSS concepts such as selector, class, measurements and box model. You will also understand the differences between inline and block-level elements. Finally, the <div> and <span> elements will be explained and how you can use them in your web sites. You should use the techniques shown in tutorial 02, such as mark-up validation, throughout this tutorial. 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) 2006 Trevor Adams, Staffordshire University - 2 -

3 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 assistance). A selection of web browsers for testing. E.g. Microsoft Internet Explorer 6.x, Opera 7.54+, Mozilla Firefox 1.x or Safari A desire to use best practices and good professional techniques Common Terminology This section briefly covers some of the terms used in this tutorial that are potentially new to you or have not been covered in any previous material. Parent / Child Elements Child element refers to an element that is contained within another. The example in Figure 1 shows a simple <body> element. The <ul> element is a child of the <body> as it is contained within it. Likewise, each <li> is a child of the <ul> and so on. It is possible for an element (<ul> & one <li> in this case) to be both a parent and child element. <body> <ul> <li>an <a href=" point</li> <li>a supplementary point</li> <li>a tertiary point</li> </ul> </body> Figure 1 Child elements: each <li> is a child of the <ul>; <ul> is a child of <body> Testing a Document When it is suggested that you test a document open it in all the browsers that are available, examine the rendered pages, take note of differences between (if any) and validate the document to ensure standards compliancy. For details on validating XHTML mark-up, see the tutorial 02. The W3C validation tool can be found at Trevor Adams, Staffordshire University - 3 -

4 CSS Inheritance Many of the CSS properties inherit, which means that a child element will assume the same properties as its parent elements (Duckett 2005). For example, if a <body> element has the following CSS rule applied: body {font-family:arial; color:blue;} All elements within the <body>, such as <h1> and/or <p>, will also have the font and colour of the <body> element as they inherit those properties. This is one of the reasons that style sheets are said to cascade. Browsers do not always implement inheritance consistently. Inheritance can save you time by allowing you to make properties cascade down to the child elements. Doing so enables you, the developer, to write fewer CSS rules to achieve the effects you desire. It is important to know about inheritance and it works, particularly when you wish to override the default inheritance behaviour. Exploring CSS This section will take you further into CSS, building on the techniques and knowledge already obtained. Selectors CSS can be used, as you have already seen, to control the way that mark-up is rendered in a browser. Rules need to be applied to parts of your mark-up and this can be done using selectors. An example of a selector is shown in Figure Trevor Adams, Staffordshire University - 4 -

5 Figure 2 Components of a CSS rule You have already learned how the selector shown in Figure 2 could be used to style <h1> elements in mark-up. However, to begin to master CSS you need to be aware further methods of stating selectors. This section will take you through the types of selectors available. Simple Selector A simple selector simply matches the name of an element in mark-up. The CSS rule given in Figure 2 is a simple selector. This is the most basic and fundamental of the CSS selectors and has also been used in the previous tutorial. Universal Selector The universal selector is implemented when you want a rule to apply to all elements. The universal selector is an asterisk (*). An example might be: * { color:red; font-family:arial, verdana, sans-serif; } The universal element is top-level, which means any other rule will be more specific, thus overriding. Type Selector The type selector is similar to a simple selector. The only difference is that the rules apply to multiple different elements or other selectors E.g. p, h1, h2 { font-family:arial, verdana, sans-serif; color:blue; font-weight:bold; 2006 Trevor Adams, Staffordshire University - 5 -

6 } This rule applies the declaration given to the <p>, <h1> and <h2> elements in a mark-up file. Class Selector The class selector is first of two elements that enable you to directly apply different rules to elements with the same name. It is conceivable and common to define a style of paragraph that is different to a regular paragraph. A class selector is defined using a period/full stop (.) character E.g. p.copyright { color:black, font-family: "Times New Roman"; } This CSS rule states that any <p> element that is of the class copyright will have black text and use the Times New Roman font. To apply this CSS rule in mark-up, the class attribute must be used. An example of which is given in Figure 3. <p class="copyright"> 2006 Trevor Adams.</p> Figure 3 using a class attribute If you wished to define a class that was not limited to one type of element, it is possible to define it without a named element E.g..copyright { color:black, font-family: "Times New Roman"; } This CSS rule could now be applied, using the class attribute, to any XHTML element that supports the class attribute. <h2 class="copyright"> 2006 Trevor Adams. </p> The ID Selector The ID selector works in much the same way as the class selector, except it matches an elements id element instead of class. As XHTML specifies that each id attribute value must be unique per document, it is a useful selector for applying style rules to unique elements. The selector is implemented using the hash (#) character. The CSS snippet in fig will apply silver text and bold font face to a <p> element with an id attribute of copyright. p#copyright {color:silver; font-weight:bold;} 2006 Trevor Adams, Staffordshire University - 6 -

7 Just as the class selector allows you to be flexible in regards to elements, the id selector is too. #copyright { color:silver; font-weight:bold;} The CSS snippet directly above allows you to apply the rule to any element that has an id attribute with value copyright. Exercise 1 Using Selectors Download the file: and save it to your personal storage. Create a style sheet and link it to the document. Examine the mark-up and discover the class attributes and id attributes. Create rules in your style sheet to add presentation to the XHTML. The CSS rules should: - Apply a default font-family to all elements of arial. - Apply a default colour to all elements of Navy. - Prologue heading should look different than a regular heading - Information class should have a silver background-color and black text. - Footer should be in smaller, bold text. - Any other style elements you feel enhance the document Save and test your file with the updates made. An example of the styled document may look like the screen shot in Figure Trevor Adams, Staffordshire University - 7 -

8 Figure 4 Example styled document to exercise 1 Exercise 2 Investigation During your personal study time, use online resources and/or the books included in the references section to learn more about CSS properties that can alter the content of XHTML elements. Experiment with font-family, font-weight, text-decoration, text-transform and text-align properties. A good web site to start: The Box Model & Measurement You now have a grasp of CSS and the properties used to affect the presentation of mark-up elements. To extend your understanding of CSS, it is necessary to understand the box model. Everything in CSS is treated like a box. Each box has the following properties: Border Separates the edge of one box from all others, exists even if made invisible Margin the margin is the distance between the edge of a box and any box next to it Padding padding the space between the border and what is inside the box Figure 5 shows the following properties in diagram form. Margin Padding Border This is a paragraph in mark-up. The solid black line that separates margin and padding is known as Border. Padding is the space between border and content. Margin is the space between the border and other mark-up elements. Figure 5 Margin, padding and border - the box model Exercise 3 Box Model Demonstration Download and save it in your personal storage area. Create and link a style sheet for this document with the rules supplied in Figure 6 (Page 9) Trevor Adams, Staffordshire University - 8 -

9 Look at the page (Example in Figure 7on page 9) and see if you can determine what elements are considered block elements and which should be considered inline elements. h1, p { border:solid 2px Black; padding:5px; margin:4px; font-family:verdana; } strong, em { border:solid 2px #999999; padding:2px; margin:23px; } Figure 6 Box Model Demonstration CSS rules Figure 7 Box Model Demonstration Example Inline and Block-Level Elements Elements in HTML are either block-level elements or inline elements. Both can be formatted in the same way and both follow the box model. Their major difference is in their default behaviour when rendered in a browser. Examine the document from Exercise 3. <h1> and <p> are block level elements and they start on a new line and take up the entire of the page width. Inline elements are those contained within the block level elements, such as <em> and <strong>. They do not force a new line and flow with the content of a block-level element Trevor Adams, Staffordshire University - 9 -

10 According to XHTML 1.0 specifications, the <body> element can only contain block-level elements. Block-level elements can contain inline elements and other block-level elements where structure allows, such as the <ul> containing <li> elements, both of which are block-level. You can alter the default display type by using the CSS property display. If you wished to make hyperlinks display as block-level elements: a { display: block; } Likewise, if you wished for each <li> to display inline: li { display: inline; } Exercise 4 Altering Block-Level Elements Create an XHTML strict 1.0 page and include the code sample from Figure 8 in the <body> element of the page. Create and link a style sheet to alter the appearance of the unordered list to a horizontal inline list of hyperlinks. This exercise should be completed without having to alter the XHTML mark-up. An example of the solution is shown in Figure 9. <ul> <li><a href=" <li><a href=" <li><a href=" </ul> Figure 8 Code sample inside <body> element - Exercise 4 Figure 9 Exercise 4 sample solution screen shots 2006 Trevor Adams, Staffordshire University

11 Units of Measurement Many of the properties that CSS can implement require measurements. This can be anything from the size of fonts, the thickness of a border to width of a heading. These values specify height or width in most instances. These values can be measured in one of three ways in CSS: Absolute Units Relative Units Percentages Absolute Units Table shows a list of absolute units available to CSS. Table 1 Absolute units of measurement Unit pt pc in cm mm Full Name Point Pica Inch Centimetre Millimetre Most of those units are self explanatory with the exception of points and picas. A point is 1 / 72 of an inch which is the same as a pixel in many personal computer displays. Points are generally used to measure font sizes and line spacing. A pica is 1 / 12 of an inch and is generally used to determine line length. Using absolute units of measurement in your CSS documents is simple, just append the unit type to the end of the value. For example, to set <p> elements to have a font size of 10pt: p { font-size: 10pt; } 2006 Trevor Adams, Staffordshire University

12 Relative Units and Percentages According to Duckett (2005), relative units and percentages can be very useful, but they also pose problems for two reasons: Their size can vary depending on the kind of media on which the document is shown Users can increase and decrease the size of fonts on a web browser, which can affect some of the units of length Relative units are pixel (px), em (em), ex (ex) and percentage (%). A pixel is the smallest basic unit of measurement in computing displays. Many web designers use the pixel measurements for fine grain control over the layout of a page on screen. An Em (em) refers to the reference element (Duckett 2005) which is either the element itself or its parent. The em measurement is originally thought to be derived from the width of a lowercase m but it is now generally considered to be the height of the font. An ex is similar to the em except it is derived from a lowercase x. Percentages provide a value in relation to another value. The percentage is calculated by the reference element, either the element itself or its container. For example, if the <body> element was set to a font size of 1em and the paragraphs were set to 150%, the calculated size of the paragraph would be 1.5em. Changing the <body> element base font size would increase the paragraph. Exercise 5 Using Measurements Create an XHTML of your own or use the sample file available at: to experiment with applying measurement units with CSS rules. You are free to enhance the document however you see fit. Try to experiment with relative units and consider how inheritance in CSS affects the visual result. Discuss with your tutor any issue that does not make sense. The <div> and <span> Elements The <div> and <span> elements are arguably two of the most useful elements available to a web developer for assisting with CSS formatting even though, by default, they do not actually do 2006 Trevor Adams, Staffordshire University

13 anything in terms of presentation. Their main purpose is the logical grouping of related elements within mark-up. The ability to group elements logically is a common task. It is conceivable that a logical document block, a book chapter for example, would be made up of many XHTML elements. It would be a long laborious task to define styles for each element, or indeed provide a class attribute for each individual instance. Grouping an entire set of elements with a group element is much more efficient as you only have to style the single element. By default, <div> and <span> do not render as anything in the browser. Where a <ul> element has a defined default form in a browser (bullet list), the <div> and <span> are completely void of structure. However, they do exist in the mark-up and that means you can attach style. Put simply, the major difference between <div> and <span>: <div> is a block-level grouping element <span> is an inline grouping element A Word on CSS properties The border, margin and padding properties have already been introduced in this handout. However, the topics about box model and units of measurement needed to be covered before using these properties could be understood properly. Border Property The border has three main components that browsers support; they are colour, style and width. They can be set using the individual property names: div.chapter { border-color:black; border-width:1px; border-style:solid; } Or in a short hand form (width, style, and colour), already used in this tutorial: div.chapter {border: 1px solid Black;} 2006 Trevor Adams, Staffordshire University

14 The border colour can take any of the named web colours and any colour specified in hexadecimal notation (preceding #). Red, green and blue values can be stated using the following notation: div.chapter { border-color: rgb(0,0,0);} /* Black */ Border width can be set using any of the measurements covered in The Box Model & Measurement, starting on page 8. Border style can be any of the named style methods: dashed, dotted, double, groove, hidden, inherit, inset, none, outset, ridge and solid. Padding Property The padding property enabled you to specify how much space should appear between the content of an element and its border: div.chapter {padding: 5px;} The value should be a length, percentage or the keyword inherit. You can specify different padding values for each side using padding-bottom, padding-right, padding-left and padding-top properties. Use padding to create white space between the content of an element and any border it has. Margin Property The margin property sets the gap between a box and any surrounding boxes; its value is a length, a percentage or the keyword inherit. div.chapter {margin: 10px;} Individual settings for each side of a box can also be specified using margin-left, margin-top, margin-right and margin-bottom properties. Dimensions As CSS treats all elements like a box, it is necessary to understand some of the properties related to dimensions. Table 2 explains some of the common properties Trevor Adams, Staffordshire University

15 Table 2 Box model dimension properties (Ducket 2005) Property Description Height Width Line-height Max-height Min-height Max-width Min-width Sets the height of a box Sets the width of a box Sets the height of a line of text (leading) Sets a maximum height that a box can be Sets a minimum height that a box can be Sets the maximum width that a box can be Sets the minimum width that a box can be It should be noted that only height, width and line-height are currently supported in Microsoft Internet Explorer 6.x. Exercise 6 Styling using <div> and <span> Download the sample document: and save it to your personal storage area. Examine the mark-up and locate the elements and make note of their classes. Style the XHTML document so that it looks like or similar to the screen shot shown in Figure 10. Figure 10 Exercise 10 sample results 2006 Trevor Adams, Staffordshire University

16 Further Exercises During your study time, you should attempt the following questions and exercises: Consider why grouping elements together in mark-up for styling purposes is considered efficient, can you explain why? Build a five page web site using one or more style sheets to determine the look of the pages. Create your page design first using paper and pen/pencil. Use the techniques in this tutorial to make your CSS efficient Experiment with border, margins and padding. A margin will take a negative value but padding will not, why is this so and why might it be useful? Investigate the z-order property and how it relates to the previous bullet point 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

Appendix D CSS Properties and Values

Appendix D CSS Properties and Values HTML Appendix D CSS Properties and Values This appendix provides a brief review of Cascading Style Sheets (CSS) concepts and terminology, and lists CSS level 1 and 2 properties and values supported by

More information

Reading 2.2 Cascading Style Sheets

Reading 2.2 Cascading Style Sheets Reading 2.2 Cascading Style Sheets By Multiple authors, see citation after each section What is Cascading Style Sheets (CSS)? Cascading Style Sheets (CSS) is a style sheet language used for describing

More information

CSS: The Basics CISC 282 September 20, 2014

CSS: The Basics CISC 282 September 20, 2014 CSS: The Basics CISC 282 September 20, 2014 Style Sheets System for defining a document's style Used in many contexts Desktop publishing Markup languages Cascading Style Sheets (CSS) Style sheets for HTML

More information

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

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

More information

HTML/XML. HTML Continued Introduction to CSS

HTML/XML. HTML Continued Introduction to CSS HTML/XML HTML Continued Introduction to CSS Entities Special Characters Symbols such as +, -, %, and & are used frequently. Not all Web browsers display these symbols correctly. HTML uses a little computer

More information

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

CSS Selectors. element selectors. .class selectors. #id selectors CSS Selectors Patterns used to select elements to style. CSS selectors refer either to a class, an id, an HTML element, or some combination thereof, followed by a list of styling declarations. Selectors

More information

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

CSS مفاهیم ساختار و اصول استفاده و به کارگیری CSS مفاهیم ساختار و اصول استفاده و به کارگیری Cascading Style Sheets A Cascading Style Sheet (CSS) describes the appearance of an HTML page in a separate document : مسایای استفاده از CSS It lets you separate

More information

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference Inline Style Syntax: Introduction to Web Design CSS Reference Example: text Internal Style Sheet Syntax: selector {property: value; Example:

More information

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference Inline Style Syntax: Introduction to Web Design CSS Reference Example: text Internal Style Sheet Syntax: selector {property: value; Example:

More information

Creating Layouts Using CSS. Lesson 9

Creating Layouts Using CSS. Lesson 9 Creating Layouts Using CSS Lesson 9 CSS Page Layout Advantages Greater typography control Style is separate from structure Potentially smaller documents Easier site maintenance Increased page layout control

More information

CSS Styles Quick Reference Guide

CSS Styles Quick Reference Guide Table 1: CSS Font and Text Properties Font & Text Properties Example(s) font-family Font or typeface font-family: Tahoma font-size Size of the font font-size: 12pt font-weight Normal or bold font-weight:

More information

Module 2 (VII): CSS [Part 4]

Module 2 (VII): CSS [Part 4] INTERNET & WEB APPLICATION DEVELOPMENT SWE 444 Fall Semester 2008-2009 (081) Module 2 (VII): CSS [Part 4] Dr. El-Sayed El-Alfy Computer Science Department King Fahd University of Petroleum and Minerals

More information

CSS Cascading Style Sheets

CSS Cascading Style Sheets CSS Cascading Style Sheets site root index.html about.html services.html stylesheet.css images boris.jpg Types of CSS External Internal Inline External CSS An external style sheet is a text document with

More information

BIM222 Internet Programming

BIM222 Internet Programming BIM222 Internet Programming Week 7 Cascading Style Sheets (CSS) Adding Style to your Pages Part II March 20, 2018 Review: What is CSS? CSS stands for Cascading Style Sheets CSS describes how HTML elements

More information

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

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

More information

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

<style type=text/css> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page*** Chapter 7 Using Advanced Cascading Style Sheets HTML is limited in its ability to define the appearance, or style, across one or mare Web pages. We use Cascading style sheets to accomplish this. Remember

More information

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST GIMP WEB 2.0 MENUS Web 2.0 Menus: Horizontal Navigation Bar WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR Hover effect: CREATING AN HTML LIST Most horizontal or vertical navigation bars begin with a simple

More information

COSC 2206 Internet Tools. CSS Cascading Style Sheets

COSC 2206 Internet Tools. CSS Cascading Style Sheets COSC 2206 Internet Tools CSS Cascading Style Sheets 1 W3C CSS Reference The official reference is here www.w3.org/style/css/ 2 W3C CSS Validator You can upload a CSS file and the validator will check it

More information

Adding CSS to your HTML

Adding CSS to your HTML Adding CSS to your HTML Lecture 3 CGS 3066 Fall 2016 September 27, 2016 Making your document pretty CSS is used to add presentation to the HTML document. We have seen 3 ways of adding CSS. In this lecture,

More information

ITNP43: HTML Lecture 4

ITNP43: HTML Lecture 4 ITNP43: HTML Lecture 4 Niederst, Part III (3rd edn) 1 Style versus Content HTML purists insist that style should be separate from content and structure HTML was only designed to specify the structure and

More information

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

The Benefits of CSS. Less work: Change look of the whole site with one edit 11 INTRODUCING CSS OVERVIEW The benefits of CSS Inheritance Understanding document structure Writing style rules Attaching styles to the HTML document The cascade The box model CSS units of measurement

More information

Assignments (4) Assessment as per Schedule (2)

Assignments (4) Assessment as per Schedule (2) Specification (6) Readability (4) Assignments (4) Assessment as per Schedule (2) Oral (4) Total (20) Sign of Faculty Assignment No. 02 Date of Performance:. Title: To apply various CSS properties like

More information

Controlling Appearance the Old Way

Controlling Appearance the Old Way Webpages and Websites CSS Controlling Appearance the Old Way Older webpages use predefined tags - - italic text; - bold text attributes - Tables (and a few other elements) use specialized

More information

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

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student Welcome Please sit on alternating rows powered by lucid & no.dots.nl/student HTML && CSS Workshop Day Day two, November January 276 powered by lucid & no.dots.nl/student About the Workshop Day two: CSS

More information

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS) Cascading Style Sheets (CSS) Mendel Rosenblum 1 Driving problem behind CSS What font type and size does introduction generate? Answer: Some default from the browser (HTML tells what browser how)

More information

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB Unit 3 Cascading Style Sheets (CSS) Slides based on course material SFU Icons their respective owners 1 Learning Objectives In this unit you

More information

Styles, Style Sheets, the Box Model and Liquid Layout

Styles, Style Sheets, the Box Model and Liquid Layout Styles, Style Sheets, the Box Model and Liquid Layout This session will guide you through examples of how styles and Cascading Style Sheets (CSS) may be used in your Web pages to simplify maintenance of

More information

Cascading Style Sheets CSCI 311

Cascading Style Sheets CSCI 311 Cascading Style Sheets CSCI 311 Learning Objectives Learn how to use CSS to style the page Learn to separate style from structure Styling with CSS Structure is separated from style in HTML5 CSS (Cascading

More information

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

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100 Introduction to Multimedia MMP100 Spring 2016 profehagan@gmail.com thiserichagan.com/mmp100 Troubleshooting Check your tags! Do you have a start AND end tags? Does everything match? Check your syntax!

More information

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

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1 Make a Website A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1 Overview Course outcome: You'll build four simple websites using web

More information

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

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model) INTRO TO CSS RECAP HTML WHAT IS CSS ADDING CSS TO YOUR HTML DOCUMENT CSS IN THE DIRECTORY TREE CSS RULES A FEW CSS VALUES (colour, size and the box model) CSS SELECTORS SPECIFICITY WEEK 1 HTML In Week

More information

Chapter 3 Style Sheets: CSS

Chapter 3 Style Sheets: CSS WEB TECHNOLOGIES A COMPUTER SCIENCE PERSPECTIVE JEFFREY C. JACKSON Chapter 3 Style Sheets: CSS 1 Motivation HTML markup can be used to represent Semantics: h1 means that an element is a top-level heading

More information

Cascade Stylesheets (CSS)

Cascade Stylesheets (CSS) Previous versions: David Benavides and Amador Durán Toro (noviembre 2006) Last revision: Manuel Resinas (october 2007) Tiempo: 2h escuela técnica superior de ingeniería informática Departamento de Lenguajes

More information

CSS. https://developer.mozilla.org/en-us/docs/web/css

CSS. https://developer.mozilla.org/en-us/docs/web/css CSS https://developer.mozilla.org/en-us/docs/web/css http://www.w3schools.com/css/default.asp Cascading Style Sheets Specifying visual style and layout for an HTML document HTML elements inherit CSS properties

More information

Web Engineering CSS. By Assistant Prof Malik M Ali

Web Engineering CSS. By Assistant Prof Malik M Ali Web Engineering CSS By Assistant Prof Malik M Ali Overview of CSS CSS : Cascading Style Sheet a style is a formatting rule. That rule can be applied to an individual tag element, to all instances of a

More information

Cascading Style Sheet Quick Reference

Cascading Style Sheet Quick Reference Computer Technology 8/9 Cascading Style Sheet Quick Reference Properties Properties are listed in alphabetical order. Each property has examples of possible values. Properties are not listed if they are

More information

Zen Garden. CSS Zen Garden

Zen Garden. CSS Zen Garden CSS Patrick Behr CSS HTML = content CSS = display It s important to keep them separated Less code in your HTML Easy maintenance Allows for different mediums Desktop Mobile Print Braille Zen Garden CSS

More information

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CSS. Lecture 16 COMPSCI 111/111G SS 2018 CSS Lecture 16 COMPSCI 111/111G SS 2018 No CSS Styles A style changes the way the HTML code is displayed Same page displayed using different styles http://csszengarden.com Same page with a style sheet

More information

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development Objectives INFS 2150 Introduction to Web Development 3. Page Layout Design Create a reset style sheet Explore page layout designs Center a block element Create a floating element Clear a floating layout

More information

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development INFS 2150 Introduction to Web Development 3. Page Layout Design Objectives Create a reset style sheet Explore page layout designs Center a block element Create a floating element Clear a floating layout

More information

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

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model 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

More information

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

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations Hun Myoung Park (1/26/2019) Cascading Style Sheets: 1 INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations ADC5030401 (2 Credits) Introduction

More information

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar GIMP WEB 2.0 MENUS Web 2.0 Menus: Horizontal Navigation Bar WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR Hover effect: You may create your button in GIMP. Mine is 122 pixels by 48 pixels. You can use whatever

More information

CSS Lecture 16 COMPSCI 111/111G SS 2018

CSS Lecture 16 COMPSCI 111/111G SS 2018 No CSS CSS Lecture 16 COMPSCI 111/111G SS 2018 Styles Astyle changes the way the HTML code is displayed Same page displayed using different styles Same page with a style sheet body font-family: sans-serif;

More information

Getting Started with Eric Meyer's CSS Sculptor 1.0

Getting Started with Eric Meyer's CSS Sculptor 1.0 Getting Started with Eric Meyer's CSS Sculptor 1.0 Eric Meyer s CSS Sculptor is a flexible, powerful tool for generating highly customized Web standards based CSS layouts. With CSS Sculptor, you can quickly

More information

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

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) Web Development & Design Foundations with HTML5 Ninth Edition Chapter 3 Configuring Color and Text with CSS Slides in this presentation contain hyperlinks. JAWS users should be able to get a list of links

More information

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

CSS: Layout Part 2. clear. CSS for layout and formatting: clear CSS: Layout Part 2 Robert A. Fulkerson College of Information Science and Technology http://www.ist.unomaha.edu/ University of Nebraska at Omaha http://www.unomaha.edu/ CSS for layout and formatting: clear

More information

ICT IGCSE Practical Revision Presentation Web Authoring

ICT IGCSE Practical Revision Presentation Web Authoring 21.1 Web Development Layers 21.2 Create a Web Page Chapter 21: 21.3 Use Stylesheets 21.4 Test and Publish a Website Web Development Layers Presentation Layer Content layer: Behaviour layer Chapter 21:

More information

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

Downloads: Google Chrome Browser (Free) -   Adobe Brackets (Free) - Week One Tools The Basics: Windows - Notepad Mac - Text Edit Downloads: Google Chrome Browser (Free) - www.google.com/chrome/ Adobe Brackets (Free) - www.brackets.io Our work over the next 6 weeks will

More information

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

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS2.1 reflects browser implementations - CSS3 is partially finished and parts are implemented in current browsers

More information

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

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS2.1 reflects browser implementations - CSS3 is partially finished and parts are implemented in current browsers

More information

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

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS3 is on its way - CSSs provide the means to control and change presentation of HTML documents - CSS is not

More information

CSS 1: Introduction. Chapter 3

CSS 1: Introduction. Chapter 3 CSS 1: Introduction Chapter 3 Textbook to be published by Pearson Ed 2015 in early Pearson 2014 Fundamentals of Web http://www.funwebdev.com Development What is CSS? You be styling soon CSS is a W3C standard

More information

CSS: formatting webpages

CSS: formatting webpages CSS: formatting webpages Why CSS? separate content from formatting (style) style can be changed easily without rewriting webpages keep formatting consistent across website allows more advanced formatting

More information

8a. Cascading Style Sheet

8a. Cascading Style Sheet INFS 2150 Introduction to Web Development 8a. Cascading Style Sheet 1 Objectives Concepts of cascading style sheets (CSS). 3 ways of using CSS: inline styles, embedded styles, and external style sheet.

More information

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web HTML & CSS SWE 432, Fall 2017 Design and Implementation of Software for the Web HTML: HyperText Markup Language LaToza Language for describing structure of a document Denotes hierarchy of elements What

More information

COMS 359: Interactive Media

COMS 359: Interactive Media COMS 359: Interactive Media Agenda Review CSS Layout Preview Review Introducting CSS What is CSS? CSS Syntax Location of CSS The Cascade Box Model Box Structure Box Properties Review Style is cascading

More information

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

<body bgcolor=  fgcolor=  link=  vlink=  alink= > These body attributes have now been deprecated, and should not be used in XHTML. CSS Formatting Background When HTML became popular among users who were not scientists, the limited formatting offered by the built-in tags was not enough for users who wanted a more artistic layout. Netscape,

More information

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

escuela técnica superior de ingeniería informática Tiempo: 2h escuela técnica superior de ingeniería informática Previous versions: David Benavides and Amador Durán Toro (noviembre 2006) Manuel Resinas (october 2007) Last revision:pablo Fernandez, Cambios

More information

ITNP43: HTML Lecture 5

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

More information

GoSquared Equally Rounded Corners Equally Rounded Corners -webkit-border-radius -moz-border-radius border-radius Box Shadow Box Shadow -webkit-box-shadow x-offset, y-offset, blur, color Webkit Firefox

More information

Parashar Technologies HTML Lecture Notes-4

Parashar Technologies HTML Lecture Notes-4 CSS Links Links can be styled in different ways. HTML Lecture Notes-4 Styling Links Links can be styled with any CSS property (e.g. color, font-family, background, etc.). a { color: #FF0000; In addition,

More information

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

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model Unit 20 - Client Side Customisation of Web Pages Week 2 Lesson 4 The Box Model So far Looked at what CSS is Looked at why we will use it Used CSS In-line Embedded (internal style-sheet) External

More information

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

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet. CSS Tutorial Part 1: Introduction: CSS adds style to tags in your html page. With HTML you told the browser what things were (e.g., this is a paragraph). Now you are telling the browser how things look

More information

Lab Introduction to Cascading Style Sheets

Lab Introduction to Cascading Style Sheets Lab Introduction to Cascading Style Sheets For this laboratory you will need a basic text editor and a browser. In the labs, winedt or Notepad++ is recommended along with Firefox/Chrome For this activity,

More information

Tutorial 3: Working with Cascading Style Sheets

Tutorial 3: Working with Cascading Style Sheets Tutorial 3: Working with Cascading Style Sheets College of Computing & Information Technology King Abdulaziz University CPCS-665 Internet Technology Objectives Review the history and concepts of CSS Explore

More information

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

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning Page Layout contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning 2 1 4.1

More information

CSC309 Programming on the Web week 3: css, rwd

CSC309 Programming on the Web week 3: css, rwd CSC309 Programming on the Web week 3: css, rwd Amir H. Chinaei, Spring 2017 Office Hours: M 3:45-5:45 BA4222 ahchinaei@cs.toronto.edu http://www.cs.toronto.edu/~ahchinaei/ survey 1 in survey 1, you provide

More information

COMP519 Web Programming Lecture 6: Cascading Style Sheets: Part 2 Handouts

COMP519 Web Programming Lecture 6: Cascading Style Sheets: Part 2 Handouts COMP519 Web Programming Lecture 6: Cascading Style Sheets: Part 2 Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University

More information

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

Session 4. Style Sheets (CSS) Reading & References.   A reference containing tables of CSS properties Session 4 Style Sheets (CSS) 1 Reading Reading & References en.wikipedia.org/wiki/css Style Sheet Tutorials www.htmldog.com/guides/cssbeginner/ A reference containing tables of CSS properties web.simmons.edu/~grabiner/comm244/weekthree/css-basic-properties.html

More information

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

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 3.1 Introduction - HTML is primarily concerned with content, rather than style - However, tags have presentation properties, for which browsers have default values - The CSS1 cascading style sheet specification

More information

ICT IGCSE Practical Revision Presentation Web Authoring

ICT IGCSE Practical Revision Presentation Web Authoring 21.1 Web Development Layers 21.2 Create a Web Page Chapter 21: 21.3 Use Stylesheets 21.4 Test and Publish a Website Web Development Layers Presentation Layer Content layer: Behaviour layer Chapter 21:

More information

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21 Table of Contents Chapter 1 Getting Started with HTML 5 1 Introduction to HTML 5... 2 New API... 2 New Structure... 3 New Markup Elements and Attributes... 3 New Form Elements and Attributes... 4 Geolocation...

More information

COMS 359: Interactive Media

COMS 359: Interactive Media COMS 359: Interactive Media Agenda Review CSS Preview Review Transparent GIF headline Review JPG buttons button1.jpg button.psd button2.jpg Review Next Step Tables CSS Introducing CSS What is CSS? Cascading

More information

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 LEARNING OUTCOMES In this chapter, you will learn how to... Describe the evolution of style sheets from print media to the Web List

More information

CASCADING STYLESHEETS

CASCADING STYLESHEETS CASCADING STYLESHEETS Cascading StyleSheets (CSS) has been mainly created because HTML is just not the right tool for precision and flexibility. HTML is not a very effective for designing web pages. Most

More information

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

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015 Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS 8 Oct 2015 What is CSS? o CSS (Style Sheet) defines how HTML elements are formatted and displayed. o It helps you easily change an HTML

More information

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

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values 3.1 Introduction - HTML is primarily concerned with content, rather than style - However, tags have presentation properties, for which browsers have default values - The CSS1 cascading style sheet specification

More information

CSS means Cascading Style Sheets. It is used to style HTML documents.

CSS means Cascading Style Sheets. It is used to style HTML documents. CSS CSS means Cascading Style Sheets. It is used to style HTML documents. Like we mentioned in the HTML tutorial, CSS can be embedded in the HTML document but it's better, easier and neater if you style

More information

Building Page Layouts

Building Page Layouts Building Page Layouts HTML & CSS From Scratch Slides 3.1 Topics Display Box Model Box Aesthetics Float Positioning Element Display working example at: h9ps://;nker.io/3a2bf Source: unknown. Please contact

More information

Page Layout Using Tables

Page Layout Using Tables This section describes various options for page layout using tables. Page Layout Using Tables Introduction HTML was originally designed to layout basic office documents such as memos and business reports,

More information

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Week 7 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 Cascading Style Sheets (CSS) Examples of CSS CSS provides a powerful and stillevolving toolkit of style

More information

Using Advanced Cascading Style Sheets

Using Advanced Cascading Style Sheets HTML 7 Using Advanced Cascading Style Sheets Objectives You will have mastered the material in this chapter when you can: Add an embedded style sheet to a Web page Change the body and link styles using

More information

Three Ways to Use CSS:

Three Ways to Use CSS: Introduction to CSS CSS Defined: Short for "Cascading Style Sheets". Determines how the elements in our XHTML documents are displayed and formatted. Designed to separate the content of a web page from

More information

Block & Inline Elements

Block & Inline Elements Block & Inline Elements Every tag in HTML can classified as a block or inline element. > Block elements always start on a new line (Paragraph, List items, Blockquotes, Tables) > Inline elements do not

More information

ACSC 231 Internet Technologies

ACSC 231 Internet Technologies ACSC 231 Internet Technologies Lecture 7 Web Typography Efthyvoulos Kyriacou - Assoc. Prof. Frederick University Resources: C. Markides (Frederick University) Slide 1 ACSC 231: Internet Technologies 23/12/2008

More information

Html basics Course Outline

Html basics Course Outline Html basics Course Outline Description Learn the essential skills you will need to create your web pages with HTML. Topics include: adding text any hyperlinks, images and backgrounds, lists, tables, and

More information

HIERARCHICAL ORGANIZATION

HIERARCHICAL ORGANIZATION A clearly defined home page Navigation links to major site sections HIERARCHICAL ORGANIZATION Often used for commercial and corporate websites 1 Repetition DESIGN PRINCIPLES Repeat visual elements throughout

More information

CMPT 165: More CSS Basics

CMPT 165: More CSS Basics CMPT 165: More CSS Basics Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University October 14, 2011 1 The Favorites Icon The favorites icon (favicon) is the small icon you see

More information

Introduction to Cascading Style Sheets

Introduction to Cascading Style Sheets Introduction to Cascading Style Sheets Welcome to the CSS workshop! Before you begin this workshop you should have some basic understanding of HTML and building web pages. What is CSS anyway and what will

More information

2. Write style rules for how you d like certain elements to look.

2. Write style rules for how you d like certain elements to look. CSS for presentation Cascading Style Sheet Orientation CSS Cascading Style Sheet is a language that allows the user to change the appearance or presentation of elements on the page: the size, style, and

More information

CSS Box Model. Cascading Style Sheets

CSS Box Model. Cascading Style Sheets CSS Box Model Cascading Style Sheets CSS box model Background Width & height Margins & padding Borders Centering content Changing display type (block vs. inline) The Box Model Background Properties Property

More information

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

IDM 221. Web Design I. IDM 221: Web Authoring I 1 IDM 221 Web Design I IDM 221: Web Authoring I 1 Week 4 IDM 221: Web Authoring I 2 Presenta(on IDM 221: Web Authoring I 3 Up until this point everything we've focused on has been related to content, and

More information

Cascading Style Sheets Level 2

Cascading Style Sheets Level 2 Cascading Style Sheets Level 2 Course Objectives, Session 1 Level 1 Quick Review Chapter 6 Revisit: Web Fonts Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your Site s Navigation Begin

More information

Introduction to using HTML to design webpages

Introduction to using HTML to design webpages Introduction to using HTML to design webpages #HTML is the script that web pages are written in. It describes the content and structure of a web page so that a browser is able to interpret and render the

More information

Cascading Style Sheets. Overview and Basic use of CSS

Cascading Style Sheets. Overview and Basic use of CSS Cascading Style Sheets Overview and Basic use of CSS What are Style Sheets? A World Wide Web Consortium (W3C) defined standard A way for web page designers to separate the formatting of a document from

More information

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags Recap on HTML and creating our template file Introduction

More information

HTML TUTORIAL ONE. Understanding What XHTML is Not

HTML TUTORIAL ONE. Understanding What XHTML is Not HTML TUTORIAL ONE Defining Blended HTML, XHTML and CSS HTML: o Language used to create Web pages o Create code to describe structure of a Web page XHTM: o Variation of HTML o More strictly defines how

More information

2005 WebGUI Users Conference

2005 WebGUI Users Conference Cascading Style Sheets 2005 WebGUI Users Conference Style Sheet Types 3 Options Inline Embedded Linked Inline Use an inline style sheet to modify a single element one time in a page.

More information

Creating and Building Websites

Creating and Building Websites Creating and Building Websites Stanford University Continuing Studies CS 21 Mark Branom branom@alumni.stanford.edu Course Web Site: http://web.stanford.edu/group/csp/cs21 Week 6 Slide 1 of 28 Week 6 Agenda

More information