Lab 4 CSS CISC1600, Spring 2012

Similar documents
1 Creating a simple HTML page

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

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

Lab Introduction to Cascading Style Sheets

CSS Cascading Style Sheets

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

CSS stands for Cascading Style Sheets Styles define how to display HTML elements

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

DAY 4. Coding External Style Sheets

CSS. M hiwa ahamad aziz Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz)

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

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

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

Assignments (4) Assessment as per Schedule (2)

Creating and Building Websites

Shane Gellerman 10/17/11 LIS488 Assignment 3

GIMP WEB 2.0 MENUS. Before we begin this tutorial let s visually compare a standard navigation bar and a web 2.0 navigation bar.

Using Dreamweaver CS6

CSS.

Web Publishing Basics I

Lecture B3 Style : Algorithmic Thinking. Computing and Art : Nature, Power, and Limits CC 3.12: Fall 2007

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles

Cascading style sheets, HTML, DOM and Javascript

HTMLnotesS15.notebook. January 25, 2015

Web Publishing Intermediate 2

Final Exam Study Guide

Web Page Creation Part I. CS27101 Introduction to Web Interface Design Prof. Angela Guercio

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

Html basics Course Outline

Wireframe :: tistory wireframe tistory.

Three Ways to Use CSS:

CSS: The Basics CISC 282 September 20, 2014

Create a cool image gallery using CSS visibility and positioning property

Exam Format: Multiple Choice, True/False, Short Answer (3 points each 75 points total) Write-the-page (25 points)

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

c122jan2714.notebook January 27, 2014

Unit 5 Web Publishing Systems Page 1 of 13 Part 4 HTML Part 4

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

Cascading Style Sheets. Overview and Basic use of CSS

CISC1600-SummerII2012-Raphael-lec3 1

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

HTML/XML. HTML Continued Introduction to CSS

Web Site Design. Stanford University Continuing Studies CS 03. Mark Branom

Setting a Background Image

Introduction to Web Tech and Programming

To link to an external stylesheet, the link element is placed within the head of the html page:

CMPT 165 Advanced XHTML & CSS Part 3

CREATING A WEBSITE USING CSS. Mrs. Procopio CTEC6 MYP1

Creating a Job Aid using HTML and CSS

BIM222 Internet Programming

HTML Overview. With an emphasis on XHTML

Basics of Page Format

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson

Overview. Part I: Portraying the Internet as a collection of online information systems HTML/XHTML & CSS

Dreamweaver CS3 Lab 2

Module 2 (VII): CSS [Part 4]

Web Development & Design Foundations with XHTML. Chapter 2 Key Concepts

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

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

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

HTML & CSS Cheat Sheet

CS134 Web Site Design & Development. Quiz1

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

Controlling Appearance the Old Way

Creating A Web Page. Computer Concepts I and II. Sue Norris

Dreamweaver CS5 Lab 2

Cascading Style Sheets (CSS)

CSS Lecture 16 COMPSCI 111/111G SS 2018

Introduction to Web Design CSS Reference

Lesson 1 HTML Basics. The Creative Computer Lab. creativecomputerlab.com

Before you begin, make sure you have the images for these exercises saved in the location where you intend to create the Nuklear Family Website.

Introduction to Web Design CSS Reference

Implementing a chat button on TECHNICAL PAPER

In the early days of the Web, designers just had the original 91 HTML tags to work with.

CSS BASICS. selector { property: value; }

Beginning HTML. A tag is a command written between angle brackets (the less than and greater than symbols). Ex. <html>

This booklet is knowledge of. a web page. of a web page find what you. you want to. SiteSell offers. Introduction

Appendix D CSS Properties and Values

Introduction to using HTML to design webpages

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

HTML and CSS: An Introduction

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

CSS exercise - Part 1

HTML. Mohammed Alhessi M.Sc. Geomatics Engineering. Internet GIS Technologies كلية اآلداب - قسم الجغرافيا نظم المعلومات الجغرافية

Modify cmp.htm, contactme.htm and create scheduleme.htm

HTML/CSS. HTML review and extra CSS review CSS Color

CSS: Cascading Style Sheets

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

Module 2 (VI): CSS [Part 3]

7300 Warden Avenue, Suite 503 Markham, Ontario Canada L3R 9Z6. Phone: Toll Free: Fax:

How the Internet Works

Title: Jan 29 11:03 AM (1 of 23) Note that I have now added color and some alignment to the middle and to the right on this example.

Dreamweaver: Portfolio Site

Introduction to Web Programming and Design

CS Multimedia and Communications REMEMBER TO BRING YOUR MEMORY STICK TO EVERY LAB!

> > > > Cascading Style Sheets basics

Fundamentals of Web Technologies. Agenda: HTML Links 5/22/2017. HTML Links - Hyperlinks HTML Lists

8a. Cascading Style Sheet

Cascading Style Sheets

Transcription:

Lab 4 CSS CISC1600, Spring 2012 Part 1 Introduction 1.1 Cascading Style Sheets or CSS files provide a way to control the look and feel of your web page that is more convenient, more flexible and more comprehensive than adding parameters to XHTML tags (like <td bgcolor="blue">). 1.2 Style sheets let you define a wide range of settings such as colors, font types, font sizes, boxes around regions on your web page and spacing between various types of elements on the page. 1.3 Style sheets are especially useful because you can create one CSS file that defines the look and feel of multiple web pages. Part 2 Getting Started 2.1 A CSS file is a separate file from an XHTML file. You create the CSS file in a text editor, just like you created your XHTML file. 2.2 Create a new folder and name it lab4. In that folder, put a copy of your HTML file from lab 2 and any other additional files (images, audio etc) 2.3 Now you need to add and modify a few tags in your existing HTML file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="my-style.css"> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> </head> <body>... </body> </html>

2.4 Validate your new XHTML file at: http://validator.w3.org/ 2.5 Note that the <link...> and <meta...> tags are contained inside the <head>...</head> tags. 2.6 Add the link tag (as above, but use your file name) to your css file. Part 3 Create your CSS file 3.1 Open a new file in your text editor (Notepad on a PC). This new file will be your separate CSS file that will contain the style sheet rules. 3.2 Save this file with an extension of.css The full filename should be the value of the href parameter in the link tag you created above. - Example: my-style.css. Part 4 The Basics 4.1 Adding a Comment: - Inside the file, that you just created add a comment at the very top, which identifies that this file belongs to you: /* Your-name CSS document */ 4.2 Enter a body rule to set the properties of the body element in the HTML file. The example below sets the background and text colors. Note that these are the same properties that we set earlier, by using the <body> tag and its parameters bgcolor and text. You can set more properties using a style sheet. Note that the property settings in the style sheet take precedence over any set directly in the HTML tags. body { background: white; color: brown; 4.3 Note the use of punctuation: - the open-curly-bracket { at the beginning of the rule, - the close-curly-bracket at the end of the rule, - the colon : after the name of each property being set by the rule, and - the semi-colon ; after the value of each property. 4.4 Enter the rule, above, using your text editor. Make sure that you specify different colors here than the ones in your XHTML <body> tag, so that you can be sure that the CSS file is being picked up by the browser.

4.5 When you are ready to save the file, make sure it is named with your last name followed by -style.css. For example, my file is called: meyer-style.css Remember, this file name should match the value of the href parameter in the <link> tag that you entered in the step 2.6. 4.6 After you save both files (HTML and CSS), reload your HTML page in your browser. You should see the new colors for the background and text that you specified in your CSS file. 4.7 NOTE: There are dozens of other standard tags you might be using in your XHTML file, including: h1, h2, h3, h4, h5, hr, and p each of these can be redefined using the technique above. Example: p { color:orange; text-align:center; font-family:"times New Roman"; font-size:20px; Part 5 Setting link properties 5.1 You created several links in your XHTML page. It is possible to change the color and behavior of those links. Links recognize different "states" or conditions: a:link/* unvisited link */ a:visited /* visited link */ a:hover /* mouse over link */ a:active /* selected link */ 5.2 Add the following code to your CSS file. Then save it, and refresh your XHTML file. Within your XHTML file move your mouse over the links to see the effects. a:link, a:visited, a:active { color: red; a:hover { font-size:150%; background: green; font-family:monospace; color: yellow; text-decoration:none;

Part 6 Dividing up your web page 6.1 One of the most powerful aspects of style sheets is the ability to divide your web page into sections. You can then set the properties within each section, regardless of whether you have lists, tables or whatever inside the section. 6.2 Using sections requires two things: (1) Specifying the extent of the section in the XHTML file using the <div class="name">... </div> tags or the <span class="name" tags>... </span>. (2) Specifying properties for the section in your CSS file. 6.3 Bring up your XHTML file in the text editor and add the following code: This is how a <div class="caution"> division tag </div> behaves. <br /> This is how a <span class="caution"> span tag </span> behaves. <br /> 6.4 Now go to your CSS file and add the following lines:.caution { font-size:200%; color: Red; 6.5 Save both of your files and then reload the XHTML file. Now you should see a difference! Part 7 Setting table properties 7.1 You can use a style sheet to set the properties of a table. For example, the syntax for changing the colors of all the table cells and text is: table { background: magenta; color: pink;

7.2 Table properties that can be set include: Name Description Possible Values color color of text in table cells any valid color name or hex value background background color for table cells any valid color name or hex value font-family font specification for text in table cells examples: serif, sans-serif, monospace, courier, verdana font-size size of font in table cells relative value (e.g., 200%) or absolute (e.g., 8pt) values 7.3 More great things that can be done with tables can be found here: http://www.w3schools.com/css/css_table.asp 7.4 Try setting the color properties of your table by adding a table rule to your CSS file. Place it in the file after the body rule. Actually, it does not matter which order rules are placed in a CSS file. The important thing is to keep the rule together, starting with the name of the rule, followed by the open-curly-bracket, the list of property settings and then the close-curly-bracket. Part 8 Setting list properties 8.1 You can use a style sheet to set the properties of a list. For example, the syntax for changing the background color of the whole unordered list is: ul { background: black; 8.2 Try adding a ul rule to your CSS file, as above. Save the file and reload your XHTML file in the browser. See how it looks. 8.3 You can also set the properties of list items: li { font-size: 16pt; border: solid; border-width: thin;

Part 9 Validating your CSS and XHTML files 9.1 Once you have made your changes you will want to make sure that your XTHML file is still "valid": http://validator.w3.org/ 9.2 You can also make sure your CSS file is "valid": http://jigsaw.w3.org/css-validator/ 9.3 Validate both your XHTML file and your CSS file and add the appropriate tags to the bottom of your XHTML page.