Free Essay

Hello World

In:

Submitted By gheloberja
Words 18704
Pages 75
In Full
Colour

What you need to know and how to do it

Spend less time reading and more time doing with a visual step-by-step approach to
HTML & CSS programming

brilliant HTML & CSS
Brilliant HTML & CSS provides quick, easy-toaccess information with…

• Practical tasks presented in short accessible sections

Brilliant HTML & CSS will enable you to create accessible, standards-compliant websites – equipping you with knowledge on the theory, coding skills, and best practice needed to build sophisticated Web pages. This book will show you how to…

• Numbered steps to guide you through each task

• Understand and use HTML tags and attributes

• Numerous example screenshots

• Mark-up text, links, images, tables and forms

• Cross reference boxes pointing you to related tasks in the book, or completed examples upon the website

• Get started with CSS

• Full colour design throughout
• Detailed Contents to help you find exactly what you need

• For your information sections alerting you to relevant tips, tricks and advice
• And a Troubleshooting guide to help you sort out the most common problems and queries

• Work with Style Sheets and selectors
• Format basic elements and font styles
• Start using Web-safe colour in your pages
• Understand and define Link States
• Master spacing, borders and element sizing
• Align and place elements within your page
• Understand and organise your site structure
• Perfect your site navigation
• Take your website live!

Visit us on the Web at www.pearson-books.com/brillianthtml HTML & CSS

£17.99

CVR_BRAN1529_01_SE_CVR.indd 1

brilliant brilliant HTML & CSS

Brilliant guides allow you to find the information that you need easily and without fuss. Using a highly visual, step-by-step approach, Brilliant books will solve your technology problems and guide you through essential tasks, providing you with exactly what you need to know, just when you really need it.

brilliant
In Full Colour

James A. Brannan

HTML &
CSS

what you need to know and how to do it
2/3/09 15:20:11

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page i

Brilliant
HTML & CSS
James A. Brannan

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page ii

Pearson Education Limited
Edinburgh Gate
Harlow CM20 2JE
United Kingdom
Tel: +44 (0)1279 623623
Fax: +44 (0)1279 431059
Website: www.pearsoned.co.uk

First published in Great Britain in 2009
© Pearson Education Limited 2009
The right of James A. Brannan to be identified as author of this work has been asserted by him in accordance with the Copyright, Designs and Patents Act 1988.
ISBN: 978-0-273-72152-9
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
Library of Congress Cataloging-in-Publication Data
Brannan, James A.
Brilliant HTML & CSS / James A. Brannan.
p. cm.
ISBN 978-0-273-72152-9 (pbk.)
1. Web sites--Design. 2. HTML (Document markup language) 3.
Cascading style sheets. I. Title.
TK5105.888.B7243 2009
006.7'4--dc22
2009002154
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without either the prior written permission of the publisher or a licence permitting restricted copying in the United Kingdom issued by the Copyright Licensing Agency Ltd,
Saffron House, 6–10 Kirby Street, London EC1N 8TS. This book may not be lent, resold, hired out or otherwise disposed of by way of trade in any form of binding or cover other than that in which it is published, without the prior consent of the Publishers.
10 9 8 7 6 5 4 3 2 1
13 12 11 10 09
Typeset in 11pt Arial Condensed by 30
Printed and bound in Great Britain by Ashford Colour Press Ltd, Gosport, Hants
The publisher’s policy is to use paper manufactured from sustainable forests.

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page iii

Brilliant guides
What you need to know and how to do it
When you’re working on your computer and come up against a problem that you’re unsure how to solve, or want to accomplish something that you aren’t sure how to do, where do you look? Manuals and traditional training guides are usually too big and unwieldy and are intended to be used as end-to-end training resources, making it hard to get to the info you need right away without having to wade through pages of background information that you just don’t need at that moment – and helplines are rarely that helpful!
Brilliant guides have been developed to allow you to find the info you need easily and without fuss and guide you through the task using a highly visual, step-by-step approach – providing exactly what you need to know when you need it!
Brilliant guides provide the quick easy-to-access information that you need, using a table of contents and troubleshooting guide to help you find exactly what you need to know, and then presenting each task in a visual manner. Numbered steps guide you through each task or problem, using numerous screenshots to illustrate each step. Added features include ‘Cross reference’ boxes that point you to related tasks and information on the website or in the book, while ‘For your information’ sections alert you to relevant expert tips, tricks and advice to further expand your skills and knowledge.
In addition to covering all major office PC applications, and related computing subjects, the Brilliant series also contains titles that will help you in every aspect of your working life, such as writing the perfect CV, answering the toughest interview questions and moving on in your career.
Brilliant guides are the light at the end of the tunnel when you are faced with any minor or major task.

iii

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page iv

Publisher’s acknowledgements
Every effort has been made to obtain necessary permission with reference to copyright material. In some instances we have been unable to trace the owners of copyright material, and we would appreciate any information that would enable us to do so.

Author’s acknowledgements
Thanks to Adobe, for allowing screen shots of Adobe Kuler. Thanks also to
FreeCSSTemplates (www.freecsstemplates.org); Rock Racing, and other websites who were gracious enough to permit me to include screenshots of their website. I am indebted to the creator of Vista Inspirate icons, by Saki on KDE-look.org; the website www.w3schools.com provided references on HTML and CSS, both of which are invaluable online resources. And thanks to the editorial team at Pearson, and my book agent, Neil Salkind at StudioB.

About the author
James A. Brannan is a consultant in Washington, DC, in the United States. He’s developed websites, using everything from AWK to CSS to Enterprise Java, and lives off government spending. Other than that he lives a pretty boring, but reasonably fulfilling, life. He has two kids and a wife but no dog. Like a true American, rather than bike commuting, he drives his car – correction, Sports Utility Vehicle – an hour each way to work every day, but then turns around and rides his bike so hard his eyes pop out for two hours or so near his home. Like a true computer book author, he has a pipe-dream that someday authoring technical books will lead to writing the ‘Great American Novel’.

For Dr. Rosemary Conover. Thanks, I followed your advice and never looked back after making my decision. Now I'm doing it again…

iv

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

14:29

Page v

i

Introduction
HTML & CSS
Welcome to Brilliant HTML & CSS a visual, quick reference guide that will teach you all that you need to know to create clean, forward-looking, standards-compliant, accessible websites using HyperText Markup Language & Cascading Style
Sheets. It will give you a solid grounding on the theory, coding skills, and best practices needed to use HTML & CSS to build sophisticated Web pages – a complete reference for the beginner and intermediate user.

Find what you need to know – when you need it
You don’t have to read this book in any particular order. We’ve designed the book so that you can jump in, get the information you need, and jump out. To find the information that you need, just look up the task in the table of contents or Troubleshooting guide, and turn to the page listed. Read the task introduction, follow the stepby-step instructions along with the illustration, and you’re done.

How this book works
Each task is presented in two distinct columns: with tasks listed in the sidebar and example screenshots and HTML or CSS code displayed on the main part of the page.

What you’ll do
Find what you need to know – when you need it
How this book works
Step-bystep instructions
Troubleshooting guide
Spelling

Completed Task examples can be found at: www.pearson-books.com/ brillianthtml
Wherever you see a
‘Cross reference’ box, just log onto the website and select the appropriate link to view an example of the task.

Every example follows a set of Task Steps which are numbered
( 2 ) to indicate a screenshot, feature or function.
The HTML and CSS examples within the main text are displayed alongside a numbered list, to help you identify any particular piece of coding mentioned in a Task Step. Just refer the to bracketed numbers at the end of a Task Step with the list beside the code.
Numbers are coloured according to chapter. Please note: the numbered list does not form part of the code!

v

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page vi

Please note:
Creating HTML comments ‘HTML’ and ‘CSS’ are initialisms, so are capitalised throughout this book, for style and consistency. The actual code written inside HTML tags is not casesensitive, but for best practice it is advised to be consistent throughout. Document extensions however,
(.html for example), should always be lower case!

Step-by-step instructions
This book provides concise step-by-step instructions that show you how to accomplish a task. Each set of instructions includes images that directly correspond to the easy-to-read steps. Eye-catching text features provide additional helpful information in bite-sized chunks to help you work more efficiently or to teach you more in-depth information. The ‘For your information’, ‘Timesaver tip’ and ‘Jargon buster’ features provide tips and techniques to help you work smarter, while the Cross-reference URLs show you completed examples of the task. Essential information is highlighted in ‘Important’ boxes that will ensure you don’t miss any vital suggestions and advice.

Troubleshooting guide
This book offers quick and easy ways to diagnose and solve common problems that you might encounter, using the Troubleshooting guide. The problems are grouped into categories.

Spelling
We have used UK spelling conventions throughout this book, with the exception of all code, which ALWAYS uses US spellings. You may also notice some inconsistencies between the text and the software on your computer which is likely to have been developed in the USA. We have however adopted US spelling for the words ‘disk’ and ‘program’, within the main text, as these are commonly accepted throughout the world.

vi

Task steps
1 Open the HTML page from the

previous task.

This chapter closes with one final, simple but important task.
You can add comments in your HTML pages. Comments are notes to yourself and are not rendered by browsers. Computer programmers use comments extensively in their programs.
Comments describe what the code is doing and allow people to view the code later and figure it out. HTML comments serve the same purpose. Comments are different from HTML tags.
HTML comments begin with a .
Everything between is considered a comment and is not rendered by browsers.

2 Add a comment within the

body element. (7) (8)
3 Save and view in your

browser.

Jargon buster
Extension – Letter following a filename's that indicates the information type of file. For instance,
.html is an extension that indicates the file contains
HTML.
Integer – A whole number.
Code – Computer instructions, short for source code. Source code is written computer instructions. Cross reference
Refer to tasks_html/task_basic_html_document/ first.html for completed example.
This results of this task are straightforward, the comment shouldn’t be visible in your Web browser.
1
2
3
4
5
6
7
8
9
10

My first HTML document’s title. My first HTML document. Important

!

Please note: Users can choose View Source in their browser and read your comments.

14

Troubleshooting guide
HTML basics

Understanding hyperlinks

If you wish to create an HTML document, and you don’t know how, see Creating a basic document: document declaration, header, metadata and body, pg. 12.

If you wish to add a URL to your document, see Using hyperlinks - absolute URLs, pg.
47; see also: Using hyperlinks: relative
URLs, pg. 49.

If you wish to add a comment to your HTML, see Creating HTML comments, pg. 14.

If you wish to have a linked page open in a new browser window, see Adding targets to hyperlinks, pg. 52.

If you wish to create an HTML paragraph, see Creating HTML paragraphs, pg. 20.
If you wish to create headings, see Adding headings to your document, pg. 22.
If you wish to add a list of items to your document, see Creating ordered and unordered lists, pg. 24; see also: Creating a definition list, pg. 28.

If you wish to link from one location in a document to another location in the document, see Creating anchors, pg. 55.
If you wish to link to an email address, see
Linking to an email address, pg. 57.

If you wish to change a list to use letters or
Roman numerals, see Formatting ordered and unordered lists, pg. 30.

If you wish to change a hyperlink’s appearance or colour, see Formatting hyperlinks: color, pg. 184; see also:
Formatting hyperlinks - lines, borders, background color, pg. 186.

If you wish to add quotation marks, see
Formatting quotations, pg. 32.

If you wish to create an image link, see
Formatting hyperlinks - image links, pg. 188.

If you wish to format your HTML, see
Marking up other text elements, pg. 35.

Adding and editing images with HTML

If you wish to add special characters to your HTML, see Inserting special characters, pg. 39.

If you wish to add an image to your page, see Adding images to a Web page, pg. 64.

Troubleshooting guide 289

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page vii

Contents
1. Introducing HyperText Markup Language (HTML)
Getting everything in order – text editors and Web browsers
Understanding elements, tags and attributes
Looking at the basic structure of an HTML page
Creating a basic document – document declaration, header, metadata and body
Creating HTML comments

2. HTML text layout tags
Creating HTML paragraphs
Adding headings to your document
Creating ordered and unordered lists
Creating a definition list
Formatting ordered and unordered lists
Formatting quotations
Marking up other text elements
Inserting special characters

3. Understanding hyperlinks
Understanding Uniform Resource Locators (URLs)
Using hyperlinks – absolute URLs
Using hyperlinks – relative URLs
Adding targets to hyperlinks
Creating anchors
Linking to an email address

4. Adding images to your Web page
Exploring image optimisation
Adding images to a Web page
How to display a custom icon in a browser (a favicon)
Creating image links
Creating image links – thumbnails
Creating an image map

1
3
7
9
12
14

15
18
20
22
26
28
30
33
37

41
43
45
47
50
53
55

59
61
62
65
66
68
70

vii

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page viii

5. HTML tables
Creating table rows and data cells
Adding padding and spacing to table cells
Adding headings to tables
Adding a caption to a table
Adding frame attributes to tables
Specifying column spans and row spans
Specifying a table’s header, body and footer
Adding table dividing lines using rules

6. HTML forms
Building a simple form
Adding a check box
Adding radio buttons
Adding file fields
Adding a text area
Adding select elements (lists and menus)
Adding a fieldset and legend

7. Introducing Cascading Style Sheets (CSS)
Understanding ids and class names
Understanding the div element
Understanding the span element
Understanding CSS rules
Specifying CSS styles
Adding CSS comments

8. Formatting fonts and text using CSS
Setting an element’s font-family
Setting an element’s font-style
Setting an element’s font-weight and size
Setting an element’s font using the font declaration
Decorating text and changing case
Aligning text
Formatting text using word- and letter-spacing

9. Using CSS to assign colour
Understanding Web colours – choosing a palette
Specifying a colour four different ways
Setting background colour
Setting foreground colour

viii

73
75
78
81
83
85
88
90
92

95
97
101
104
106
108
110
114

117
120
122
126
128
133
137

141
144
149
152
155
157
159
161

163
165
168
170
175

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

14:30

Page ix

10. Using CSS to format hyperlinks
Formatting hyperlinks – colour
Formatting hyperlinks – lines, borders, background colour
Formatting hyperlinks – image links

11. Using CSS to asign padding, margins and borders
Setting element padding
Setting element margins
Setting element borders
Setting width and height (percentage)
Setting width and height (pixels)

12. Positioning elements using CSS
Positioning elements using float and clear
Positioning elements using relative positioning
Positioning elements using absolute positioning
Positioning elements using fixed positioning

13. Exploring different page layout strategies
Using a fixed-width layout – one column
Using a liquid layout – one column, centred
Using a liquid layout – two columns
Using a liquid layout – three columns
Using a combined layout – two columns liquid, one fixed
Creating a liquid layout using a table

14. Site structure and navigation
Understanding a flat site structure
Understanding a tiered site structure
Looking at some websites’ navigation strategies
Creating a global top or bottom menu
Creating a left floating site menu
Creating a local navigation menu
Creating a breadcrumb trail

15. Validating and publishing your website

177
180
182
184

187
191
194
197
199
201

203
206
211
214
222

225
229
231
233
236
238
240

243
247
250
253
256
259
261
262

267

Validating your HTML and CSS
Uploading your website to a service provider

268
270

Jargon buster
Appendix A. HTML tags used in this book
Appendix B. CSS properties covered in this book
Appendix C. CSS colour name, hexadecimal value and RGB value
Troubleshooting guide

273
275
278
284
289

ix

A01_BRAN1529_01_SE_FM.QXD:BRILLIANT

30/1/09

10:38

Page x

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 1

1

Introducing HyperText
Markup Language (HTML)
What you’ll do
Introduction

Get everything in order – text editors and Web browsers

HTML is a markup language. A markup language is a language where you add instructions to text. The instructions tell the computer how to display the text enclosed by the instructions.

Understanding elements, tags and attributes

Text to act upon.
In the mid to late 1990s the only good way to write HTML was by hand. You typed the text and then added the HTML tags.
These days, however, you almost don’t even need to know
HTML or CSS (Cascading Style Sheets). For example, Apple’s iWeb application makes publishing a website easier then ever before. Choose a template, change the stock photos with your own, and add your own text. Easy, no HTML required, and certainly no CSS. With products such as DreamWeaver, almost nobody creates a professional website by hand using a text editor. So why this book? And why countless other HTML books on the shelves of your local bookshop?

Look at the basic structure of an
HTML page
Creating a basic document – document declaration, header, metadata and body
Creating HTML comments

True, these tools do make Web development easier. But suppose you’ve just developed your website using iWeb, you’ve pointed and clicked, and dragged and dropped, but now you wish to add your favourite YouTube playlist to your website using YouTube’s embedded video player. There’s no drag-’n’drop control for that, what to do? You must add what iWeb calls an ‘HTML snippet’. An HTML snippet allows you to write some HTML and embed it directly in your iWeb page. Just one

Introducing HyperText Markup Language (HTML) 1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 2

problem, though. Inserting an HTML snippet requires knowing some HTML. If you didn’t take the time to learn basic HTML and CSS, you probably won’t have much luck inserting an
HTML snippet.
Knowing HTML and CSS will free you from being a slave to the tools – allowing you to use the tools when appropriate and fall back on a text editor when needed. In this book, I assume nothing more than a simple text editor and Web browser. By the end of the book, you will have the HTML and CSS skills necessary to view HTML source code and, if necessary, fix it yourself. If you plan on continuing to learn more on Web development after finishing this book, then I would recommend learning Adobe’s DreamWeaver. DreamWeaver is the standard in Web development tools. Besides, it seems everybody nowadays uses DreamWeaver, and it’s a skill in great demand in the information technology field. A good book for learning is Brilliant DreamWeaver by Steve Johnson, but before you rush out and buy his book, do yourself a favour: take the time to learn basic HTML and CSS first. Trust me, you will be glad you did when confronted with an ‘HTML snippet’ or something similar.
In this chapter you get organised for the future exercises. You also learn basic HTML document structure. If you want to actually do the tasks, be sure to understand this chapter’s tasks. You must have a text editor and you must know how to load the finished page in your browser. Pretty basic tasks but very important. If you just want to read along, I have good news. Completed examples for all tasks are available via this book’s website. Every task references the finished example, so all you have to do is look at the finished example. Of course, if you don’t even want to do that, as with all Brilliant series books, the steps are clearly numbered in supporting code and figures. If you already know how to edit, save and view an
HTML page, just skim this chapter. If you don’t, be sure not to skip this chapter. You need these basic skills before you can complete the examples in this book.

2

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 3

Before getting started, you need to ensure that you have everything needed for accomplishing the tasks to come. You must identify an HTML editor, create a folder for storing your work, select a Web browser for viewing the resulting HTML page, and obtain some online reference material.
4
Hello
World!
6

Getting everything in order – text editors and Web browsers Task steps
1 Choose an HTML editor. The

first thing you need is a simple text editor. If working in Windows, use TextPad. If using a Mac, use TextEdit.
2 Create a folder for storing your

work.
3 Identify your browser. Choose

the browser you normally use to surf the Web. I use Safari, so you will notice many Safari screen shots in this book.
4 Start your text editor and type

the text above, left.
5 Save the document. Give it an

.html extension.
6 Notepad users. When saving,

click on File, Save As, and then Select All Files from the
Save As Type drop-down, when saving your file. If you don’t, Notepad appends a .txt extension to your file and your browser interprets the file as plain text rather than HTML.
You must add the .html extension yourself, so type index.html when saving.

Introducing HyperText Markup Language (HTML) 3

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

Getting everything in order – text editors and Web browsers (cont.)

10:39

Page 4

7

7 TextEdit users. Before saving,

change TextEdit’s settings so it saves documents as plain text. From the TextEdit menu, select Preferences. In the dialogue box that appears, select the New Document tab and choose the Plain text option. On the Open and Save tab, ensure the Add “.txt” extension to plain text files check-box is not checked.
Also, ensure the Ignore rich text commands in HTML files check-box is checked.

Important
Note: HTML document extensions (.html) are
Lower Case!

4

!

7

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 5

Getting everything in order – text editors and Web browsers (cont.)
8 After saving, open your

i

For your information
The World Wide Web Consortium, W3C, is the World
Wide Web’s governing body. Although it has no legal authority, it is a consortium of all the major players:
IBM, Microsoft, Apple, Hewlett Packard and other major companies. What the W3C does is get together and get everyone to agree on standards. It researches, meets and publishes specifications for different Web-related languages. Standards to come out of W3C include XML,
HTML and CSS, among others. HTML 4.01 is a W3C recommendation. You can download the specification at the W3C website: www.w3c.org and review it if you desire. The reading is dry, but it is the source on HTML.
The CSS specification is also available online at W3C’s website. browser and open the file. For example, in Safari choose File
– Open File – and then navigate to the file. After selecting the file, you should see ‘Hello World’ in the main browser window.
9 Bookmark or download some

HTML/CSS references. This book isn’t a comprehensive reference. You may need a comprehensive reference to consult while completing the tasks in this book.
10 Navigate to

www.w3schools.org and bookmark the page.
11 Navigate to the Web Design

Group’s (WDG) website – www.htmlhelp.com – and bookmark the page.
12 Navigate to www.w3c.org, the

World Wide Web Consortium’s website. Bookmark the page.

Introducing HyperText Markup Language (HTML) 5

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

Getting everything in order – text editors and Web browsers (cont.)

Timesaver tip
Your computer probably automatically opens HTML files using your favourite web browser. Double click on the page created in this task (index.html) and it should appear in you browser. If it doesn’t, right click on index.html and choose Open With and be sure to select Always Open
With check-box if on a
Mac. If on Windows choose Open With, Choose
Program and check the
Always use the selected program to open this kind of file check-box.

6

30/1/09

10:39

Page 6

For your information

i

Browser selection
You can choose from several browsers. Opera, Internet
Explorer, Safari and FireFox are the most popular browsers. If using Windows, the chances are you have
Internet Explorer. If using Mac, you certainly have
Safari. As you are reading a book on HTML and CSS,
I’m going to take a leap of faith and assume you already have a browser and know how to use it. The only caveat
I’d add, is that if you have been holding off on updating it to the latest version, now is the time to do it. This book uses HTML 4.01 Transitional and CSS 2.01. If your browser is outdated beyond a version or two, there is a very good chance that some examples are not going to work in your browser.

For your information
Web hosting
If you want others to see your site you will eventually need to publish it. There are ample Web hosting companies on the Internet, both paid and free. But before going out and paying for space on a Web host, the chances are that you already have some free space as part of your account with your service provider. BT, the United Kingdom’s largest Internet service provider, provides subscribers 15 megabytes of personal Web space. I have an earthlink.net account, with which comes 10 megabytes to create my own personal website; and if you are a student, you almost certainly have space to host your personal website. For more information, check with your service provider or school’s IT department. It is worth your while to check and find out if you have free space.

i

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 7

An HTML document is comprised of elements. Elements exist for things such as headings, paragraphs, tables and other objects that comprise an HTML document. An element consists of a start tag, content and end tag.

Understanding elements, tags and attributes

HTML elements are constructed by a start tag marking the element’s beginning, one or more attributes, some optional content and an end tag. Tags are instructions that tell browsers to format its content a certain way. Tags are enclosed in two angle brackets (). For example, as your browser loads an HTML document, when it reaches the tag, it knows that everything it loads until it reaches the closing tag is part of the body element.
Attributes define an element’s properties. Consider attributes as adjectives. For example, the image element contains a source attribute.

A table element often contains a border attribute.

Attributes are name/value pairs that provide browsers with further instructions on rendering elements. The table tag with a border attribute tells the browser to not just create a table, but to create a table with a border. Moreover, make the border one pixel wide. The values an attribute can have vary depending on the attribute. Some attributes can take text, for example the

Introducing HyperText Markup Language (HTML) 7

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

Understanding elements, tags, and attributes
(cont.)

30/1/09

10:39

Page 8

image tag’s src (source) attribute. The browser cannot know in advance all the possible values for a source, so the attribute is not constrained. However, the table tag’s border value is constrained. You can’t have a border of ‘Sam’ or ‘Frank’, only an integer value that specifies pixels. Other attributes are similarly constrained. Some attributes only allow one of several predefined choices. For example, the input element’s type attribute accepts the values: button, check-box, file, hidden, image, password, radio, reset, submit and text.

For your information
Few people bother referring to elements and instead just call everything tags. For example, you will see written: ‘the paragraph tag’, ‘the body tag’, ‘the HTML tag’. In common web vernacular, tag and element mean the same thing.
This book is no different, but I do use both terms throughout to remind you that they mean the same.
Hopefully it doesn’t distract you.

8

i

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 9

An HTML document consists of two parts: the header and the document’s body. The header, specified by the tag, contains data not actually displayed by browsers. The head element is where you place the document’s title, any metadata describing the document and other data pertaining to the document. The body element is where the
Web page’s content is placed.
The first line in an HTML document should be the document type definition (DTD). A document type definition declares the
HTML version. There are three HTML 4.01 DTDs: HTML 4.01
Strict DTD; HTML 4.01 Transitional DTD; and HTML 4.01
Frameset DTD. In this book we use HTML 4.01 Transitional. You don’t really need to know too much about the doctype, other than that it is good form to add this to an HTML document’s first line. This line tells your browser to expect an HTML document that conforms to the HTML 4.01 Transitional DTD.

Looking at the basic structure of an HTML page

Important

!

If you do not specify a
DTD your browser will revert to ‘quicks’ mode, and make its best guess in how to render the page!

After the DTD, the first element is the HTML element. The
HTML element is comprised of the opening and closing tags. The browser views everything between these tags as an HTML document.

HTML documents contain two sections, defined by the header and body elements. The document’s header adds basic information about the document, such as its title, metadata, scripts, styles, etc. The body is the document’s content.
Everything appearing in the body appears as the document displayed in the browser’s window, and is where you place content and formatting HTML tags.

Introducing HyperText Markup Language (HTML) 9

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

Looking at the basic structure of an HTML page
(cont.)

Task steps
1 Open your browser and

navigate to the www.onlinebikecoach.com website.
2 If using Safari, go to the

menu and select View and then View Source. If using
FireFox, select View and then
Page Source.
3 Note, the document’s DTD is

HTML 4.01 Transitional.
4 Notice the document is

comprised of two sections, the head and the body.
5 Within the tags,

there are several other tags.
For example, notice the title, metadata, script and link tags.
6 The tag is

particularly important, this element tells browsers to get a CSS stylesheet from the location specified and apply that style to the document.
You’ll learn more on this element later.

10

30/1/09

10:39

Page 10

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

4

3

30/1/09

10:39

Page 11

5

6

Looking at the basic structure of an HTML page
(cont.)

7 The body contains the HTML

you see in the page as viewed in your browser.
8 Scroll through the document

and view the different tags. It’s okay if you don’t understand everything, the important thing to take away from this task is the document’s basic structure. 7

Introducing HyperText Markup Language (HTML) 11

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

Creating a basic document – document declaration, header, metadata and body

30/1/09

10:39

Page 12

In the last task you reviewed an HTML document’s layout. In this task you will learn to create a simple HTML document.

Table 1.1 Tags used in this task

1 Open your text editor and

create a new document.

Function

Specifies the HTML document’s DTD.

Specifies an HTML document.

Task steps

Tag

Specifies an HTML document’s header.

Specifies an HTML document’s title.

Specifies metadata about an HTML document.

Specifies an HTML document’s body.

2 Before you forget, choose

Save As, and save the document. Be sure to give it a
.html extension, and don’t forget to set up your editor correctly, as instructed earlier in this chapter.
3 Add an opening and

closing tag. (4,8)
4 In the HTML element, add the

header element’s opening and closing tags. (5,6)
5 Below the header element,

This results of this task are straightforward. Your document’s title should appear at your browser’s top. You should also see the text you typed now displayed in your browser’s window.
1
2
3
4
5
6
7
8

My first HTML document’s title. My first HTML document.

add the body element. (7)
6 Within the body element, add

some text. (7)
7 In the header element, add a

title in the header. (5,6)
8 Save the document and view

in your browser.

12

Important
Remember: the numbers beside the code are an indicator and should not be included within your document!

!

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

10:39

Page 13

Creating a basic document – document declaration, header, metadata and body (cont.)

i

For your information
Create an informative title. Use descriptive titles such as
‘James Brannan’s HomePage’ rather than ‘My HomePage’.
What appears as the link in Google is your title. When a user bookmarks your page, the title is the default name given the bookmark. Make it descriptive and interesting, and your site will get more visits.

Timesaver tip
Create a template for the rest of this book and save it as template.html. Use this file repeatedly as your task's base file.

insert title here Introducing HyperText Markup Language (HTML) 13

1

M01_BRAN1529_01_SE_C01.QXD:BRILLIANT

30/1/09

Creating HTML comments Task steps
1 Open the HTML page from the

previous task.

10:39

Page 14

This chapter closes with one final, simple but important task.
You can add comments in your HTML pages. Comments are notes to yourself and are not rendered by browsers. Computer programmers use comments extensively in their programs.
Comments describe what the code is doing and allow people to view the code later and figure it out. HTML comments serve the same purpose. Comments are different from HTML tags.
HTML comments begin with a .
Everything between is considered a comment and is not rendered by browsers.

2 Add a comment within the

body element. (7) (8)
3 Save and view in your

browser.

Jargon buster
Extension – Letter following a filename's that indicates the information type of file. For instance,
.html is an extension that indicates the file contains
HTML.
Integer – A whole number.
Code – Computer instructions, short for source code. Source code is written computer instructions. Cross reference
Refer to tasks_html/task_basic_html_document/ first.html for completed example.
This results of this task are straightforward, the comment shouldn’t be visible in your Web browser.
1
2
3
4
5
6
7
8
9
10

My first HTML document’s title. My first HTML document. Important
Please note: Users can choose View Source in their browser and read your comments.

14

!

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 15

2

HTML text layout tags
Introduction
Despite the popularity of viral video sites such as YouTube, the
Web remains comprised primarily of text. Web pages are most akin to printed magazines. Magazines are text with photos.
Formatting magazines, or Web pages, at its most basic, is formatting text. There are many more mundane formatting tasks you must do before adding eye-catching graphics. Text requires breaking into paragraphs, long quotations need to be set apart from other text and sections distinguished by headings. Key phrases require emboldening, shorter quotations require quotation marks and key points should be displayed as lists. This basic text formatting makes the Web page easier to navigate, summarise and understand.

What you’ll do
Create HTML paragraphs
Add headings to your document
Create ordered and unordered lists Create a definition list
Format ordered and unordered lists Format quotations
Mark up other text elements
Insert special characters

In this chapter you explore basic HTML text formatting. You should understand basic text layout before applying cool backgrounds to your page, dazzling fonts and adding interesting photos. Don’t worry though, soon enough, in the second section of this book, you will learn how to make brilliant Web pages using CSS. The tasks in this chapter provide you with more mundane but highly important fundamental text layout HTML elements.
HTML provides several tags for marking up text into appealing paragraphs. The most fundamental is the paragraph element.
The paragraph element consists of the opening tag and closing tags, and any content between them. The browser knows that all text occurring between the paragraph element’s opening and closing tags form a cohesive paragraph.

HTML text layout tags 15

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 16

The heading elements – represented by the tags:
, , , ,
, – are equally fundamental.
Heading elements allow you to easily add section headers to your paragraphs so you can divide your page into hierarchical topics. Headers are hierarchical, where is the topmost heading (with the largest heading font), and is the bottommost heading (with the smallest heading font).
HTML also provides several other basic text formatting tags.
There are three tags to create lists. The ordered list element – represented using the tags – allows you to easily create a numbered or ordered list: the unordered list element,
, an unordered list; and the definition list element, , a definition list. You can specify quotations using the quotation element, , for shorter quotations and the blockquote element,
, for larger quotations that you wish to set apart from a paragraph. There are also tags for making your text look like computer terminal printout, emphasising keywords and other basic formatting tasks you would expect of any decent word processing, or magazine layout software. This chapter explores these basic tags and their use in your HTML pages.

Important
Remember the discussion about elements versus tags in
Chapter 1? Although technically different meanings, you can use the terms element and tag interchangeably. An element is the logical unit or the meaning. Tags are the physical markup, the opening and closing text that distinguishes an element’s beginning and ending. For example, the paragraph element consists of the opening and closing tags and anything between the two tags is the element’s content. But in Web vernacular, tag and element are equivelant. You can refer to the paragraph tag or the paragraph element and most people will understand you mean the tag.
Remember, this book uses both terms interchangeably.

16

!

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 17

For your information

i

With the HTML 4.01 specification’s release, the W3C deprecated most formatting; CSS simply does a better job.
For example, when laying out a paragraph in the past you could specify an align attribute in the paragraph element’s opening tag, , and give it a value of left, right, centre or justify. For example: . This attribute formatted the paragraph as you would expect, right aligned the text to the right, centre centred the text, left aligned the text to the left and justify the text.

2

Although most browsers still accept the align attribute, it is deprecated. There is no guarantee that the align attribute will display correctly in the future. Most other formatting attributes for basic HTML tags have likewise been deprecated. In this chapter, and in future chapters,
I omit deprecated tags and attributes from the tasks. As a result of this omission, the task results in the next couple of chapters will seem, well, a tad ugly. But don’t worry, in future chapters you apply CSS styles to them, making them appear as modern Web pages.

HTML text layout tags 17

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

Creating HTML paragraphs For your information
Using a closing tag when using the paragraph element is not required.
Browsers recognise some text some more text as two distinct paragraphs.
But not closing your paragraph forces the browser to guess where the paragraph ends and could possibly lead to unpredictable results. It’s also just plain sloppy. Be safe and tidy, always end your opening paragraph tag with a closing paragraph tag.

30/1/09

10:41

Page 18

A paragraph element consists of an opening tag, a closing tag and any text between the two tags. This element defines paragraphs. When rendered, text inside a paragraph element appears as a single paragraph, with extra space before and after the paragraph’s text, much like a paragraph in Word or OpenOffice Writer.

i

HTML paragraphs are left-aligned by default and the first line is not indented. You can align a paragraph using its align attribute. For example, . But note, this formatting attribute is deprecated and shouldn’t be used. Use
CSS instead. Trust me, you’ll see, it’s easier and more robust to use CSS. Oh, one final thing you should know about paragraphs. You cannot hit your [Return] key and expect the browser to render the linebreak. Web browsers handle paragraph wrapping automatically. To override this behaviour you must use the tag (covered in a later task).

Table 2.1 Tag covered in this task
Tag

Function

Specifies a paragraph.

Cross reference
See tasks_html/task_html_paragraphs/paragraph.html for the finished example.

Cross reference
The task ‘Aligning elements’ in Chapter 12 covers aligning elements using CSS.

18

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 19

The results of this task are straightforward: the paragraph tags separated the text into three distinct paragraphs.
1
2
3
4
5
6
7
8
9
10
11
12
13

SeguroImpulso Software and Consulting
---snip--- consulting services.
SeguroImpulso Software and
Consulting
---snip--- under development.
On this site you will find information ---snip--- track racing, or even cyclocross.

Creating HTML paragraphs (cont.)

Task steps
1 Open the template and save

with a different name.
2 Add three sets of

tags to the body element.
(5, 7, 9)
3 Type some text in all three

paragraph elements.
4 Save and display the page in

your browser.

4

HTML text layout tags 19

2

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

Adding headings to your document Task steps
1 Open the template and save

with a different name.

10:41

Page 20

Headings on a Web page are like headings in a Word or
OpenOffice Writer document: they allow users to browse the page and determine what sections, if any, they are interested in. Headings also reinforce comprehension by providing a summary of a page’s content. HTML headings go six levels deep, where each heading level denotes decreasing emphasis.
Headings use the following tags: , ,
, , and .
Browsers render headings larger and bolder than normal text, with rendered the largest and the smallest. As with the paragraph element, headings have an optional – but deprecated – align attribute that shouldn’t be used.

2 Add three sets of

tags to the body element and type some text in all three paragraph elements. (6, 9, 13)
3 Add tags above

the first paragraph and add some text to the element. (3)
4 After the tag, but

before the first tag, type the tags.
Between the tags, enter some text. (8)

Table 2.2 Tags covered in this task
Tag

Function

Specifies a first level heading.

Specifies a second level heading.

Specifies a third level heading.

Specifies a fourth level heading.

Specifies a fifth level heading.

Specifies a sixth level heading.

5 Repeat step 4, only place the

second-level header between the first and second paragraphs, and the second and third paragraphs. (12)
6 At the bottom of the page (but

before the tag) add
, , and tags. Between each tag set add appropriate heading text. (16, 17, 18, 19)

20

Cross reference
See tasks_html/task_html_headings/heading.html for the finished example.
As with the previous task, this task is also straightforward. The heading tags added headings to the HTML page. The added the largest heading text, while added the smallest.

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

30/1/09

10:41

Page 21

Seguro-Impulso Software and
Consulting
Seguro-Impulso’s Mission
Seguro-Impulso Software and
Consulting ---snip--- services.
SeguroImpulso’s Products.
SeguroImpulso Software and Consulting first product ---snip--- under development. What’s on the Site?
On this site you will find ---snip--fit, you will take up timetrialing, track racing, or even cyclocross. test3 test4 test5 test6

Adding headings to your document (cont.)

7 Save your work and display it

2

in your browser.

For your information

i

Don’t leave this task thinking that headers are a catch-all formatting for making text larger. They really should only be used for bona fide headers. Bona fide headers, together with paragraphs, provide basic document structure. You should use
CSS for formatting text that isn’t a bona fide header.

7

HTML text layout tags 21

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

Creating ordered and unordered lists 30/1/09

10:41

Page 22

A list is an easy way to summarise information. You probably use two list types extensively in your everyday life. When you create a numbered, heirarchical list, you are creating an ordered list. When you create a list without numbering – a list of items – you are creating an unordered list. In HTML, there are three list types: ordered lists; unordered lists; and definition lists. In this task you learn to use ordered and unordered lists. In the next task you learn definition lists.
Ordered lists present data, when order is important. For example, my top three favorite bike brands (in order):
1. Fuji
2. Huffy
3. Serotta
Unordered lists present data where order is unimportant. For example, current programming languages I’m using at work (in no particular order):
Java
C
JavaScript
You present numbered, or ordered, data using the tags and unordered lists use the tags. List elements in ordered and unordered lists are inserted in the list using the tags.
FujiHuffy
Serotta
JavaC
JavaScript
Ordered lists are particularly valuable for presenting ordered instructions, such as the tasks in Brilliant series books. List elements are given their own text line and their own number.
Unordered lists are are also useful by providing emphasis to

22

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 23

distinguish each element in a group of items. List elements in the unordered list, like the ordered list, are each given its own text line.

Creating ordered and unordered lists (cont.)

Table 2.3 Tags covered in this task
Tag

Function

Specifies an unordered (bulleted) list.

Specifies an ordered (numbered) list.

Specifies a list element.

2

Cross reference
See tasks_html/task_html_lists/ordered_unordered
.html for the finished example.

Cross reference
In the Using hyperlinks – absolute URLs task, in Chapter
3, you use an unordered list to organise a list of links to other websites.

HTML text layout tags 23

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

Creating ordered and unordered lists (cont.)

Task steps
1 Open the template and save it

with a different name.
2 Type an tag pair

in the body element. (6, 32)
3 Type three or four

tag pairs in the ordered list element. Place text between each pair’s opening and closing tags.
(7, 10, 14, 26, 29)
4 Type another set of

tags between the opening and closing of one of the list elements.
(16, 24)
5 Place a couple

tags in the nested ordered list element and enter some text in each. (17, 19, 20, 21, 23)
6 Below the outermost

tag, type the tags. (35, 41)
7 Type a few tags

in the unordered list element and enter some text in each.
(36, 37, 39, 40)
8 Save your work and display it

in your browser.

24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

10:41

Page 24

iNtervalTrack QuickStart
QuickStart Steps (Assuming Sensors,
DVD Playback, and M3U Playlist)

Start the Mac DVDPlayer, navigate to where you wish iNtervalTrack to start playing, and press pause.
Activate iNtervalTrack’s DVDPlayer plugin, check fullscreen, check mute sound, then click the Finished button Configure the QuickTimePlayer Music
Player plugin.

Select the QuickTimePlayer Music
Player plugin.
Select Play a Playlist.
Click the browse button.
Select the M3U playlist to play. Click Finished.

From the Window menu, select View
All Horizontal. Move the window to desired location and size.
Click Start, jump on your bike, and start pedaling (the software gives you a ten second countdown.)

Prerequisites for Running iNtervalTrack QuickStart

iNtervalTrack Software
SerialPort speed and cadence sensor. A M3U playlist already created.
A DVD in your DVD drive.

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 25

After completing this task you should see a numbered list. In one of the numbered list’s items, you should see a nested list.
This nested list should be a numbered list, indented from the outer list. Below the outermost ordered list you should see an unordered list. This list should be a list where each line begins with a bullet.

Creating ordered and unordered lists (cont.)

8

Important

!

Overlapping tags
As the task illustrates, you can nest lists within other lists. Any list type can be nested in any other list type. But be careful, you can get unpredictable results when nested list tags get mixed with the containing list. This mixing is called overlapping tags.
For example, My
HeadingMy
Paragraph text is an overlapping tag example.
The results of such a mistake in a browser are unpredictable. Avoid overlapping tags!

HTML text layout tags 25

2

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

Creating a definition list

Task steps

10:41

Page 26

In the previous task you learned the ordered and unordered list types. In this task you will learn about definition lists. Definition lists present term definitions. For example, consider Serotta’s definition. The definition consists of a definition term, Serotta, and an actual definition: A manufacturer in the United States of high-end, custom bicycles. You wrap the definition’s term in tags and the term’s definition in tags. Using a definition list, you can quickly create a formatted glossary using HTML.

1 Open the template and save it

as a new page.
2 Type a tag set

in the body element. (5, 17)
3 Type two tag

sets in the definition list. (6, 9)
4 Type a word to define in each

definition term element.
5 Just below the definition term

element, type a tag set in each definition list.
(7, 10)
6 Type each term’s definition in

the corresponding tag set.
7 Save your work and open it in

your browser.

26

Cross reference
See tasks_html/task_html_lists/definition.html for the finished example.
The results of this task are straightforward. You should see two terms aligned with the left margin. On the line below each term, you should see the term’s definition indented by five spaces. Note that terms with multiple line definitions are wrapped and indented to align with the previous five-space indented line.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Glossary of Terms

Serotta
A manufacturer in the United States of high-end, custom bicycles.
Time trial
A cycling event where the athlete races against the clock to get the minimum time possible. It can be a team event or individual event. Common time trial types are the 40K road time trial and the 1K track event – affectionately called "the kilo".

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 27

Creating a definition list
(cont.)

2

HTML text layout tags 27

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

Formatting ordered and unordered lists

Task steps
1 Open the template and save it

with a different name.

30/1/09

10:41

Page 28

Against my better judgement, I’m including this task.
Personally, I feel it safest to treat deprecated elements and attributes as non-existent. Nobody ever created a page that was rendered incorrectly, or a program that didn’t run, because they didn’t use deprecated language features. However, formatting a list is something that is still commonplace. For example, maybe you wished to use Roman numerals to number your list. Or maybe you wanted to use square rather than round bullets.
Although CSS is now the recommended way to implement such formatting, you can do it directly in the HTML tag.
Although it is deprecated, so your really shouldn’t: you can specify an ordered list element’s value.

2 Add an ordered list with three

list items. (14)
3 Add a header just below the

ordered list. (16)
4 Create another ordered list

with three list items. Only for the first number add a value attribute and give it a value of four. (18)
5 Create an unordered list with

a type of square. (21)
6 Save and open in your

browser.

Table 2.4 Deprecated formatting attributes for ordered and unordered lists
Ordered lists type="1" 1, 2, 3 …

type="a"

a, b, c …

type="A"

A, B, C …

type="i"

i, ii, iii … (lowercase Roman numerals)

type="I"

I, II, III … (uppercase Roman numerals)

Unordered lists type="disc" disc

type="circle"

circle

type="square"

square

Cross reference
See tasks_html/task_deprecated_list_formats/ ordered_unordered.html for completed example.
The results are straightforward. The ordered list should go from one to three and then the second list from four to six. The unordered list should be squares rather then round bullets.

28

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

30/1/09

10:41

Page 29

Deprecated List
Attributes

The steps to take.
Step one.Step two.Step three.
This is an interruption in the list. Step four.Step five.Step six. Item one.Item two.

Formatting ordered and unordered lists
(cont.)

2

HTML text layout tags 29

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

Formatting quotations Important

Internet Explorer does not support the tag.

30

10:41

Page 30

Quotations in HTML pages are just like quotations in print. Just remember what you learned when learning how to write a term paper. You should attribute your sources – when you take verbatim text from another source you must quote the source.
Like writing an essay, shorter quotations are displayed in your paragraph’s body and simply enclosed in double quotation marks. Longer quotations are separated and indented to distinguish it from your text.

!

Don’t abuse the blockquote element. You should only use it when creating a bona fide quotation, not for general paragraph indentation. First, visionimpaired people use reading devices to read a
Web page. They are going to mistakenly think your page is filled with long quotations. Second, CSS does a much better job at aligning paragraphs. CSS is the easy and correct way to indent general text.

Important

30/1/09

The blockquote and quote elements display quotations in an
HTML page. You format larger quotes using the tags. For shorter quotes use the tags. The resulting formatting is as you would expect – the same as what is expected in word processors or printed pages. The blockquote element is a separate indented paragraph. The q element is a shorter quote, displayed in-line with the rest of the text, but enclosed in opening and closing double-quotation marks.

Table 2.5 Tags covered in this task
Tag

Specifies a short, in-line, quotation. !

Function

Specifies a long quotation (a separate, indented quotation).

Cross reference
See tasks_html/task_html_quotations/whyrollers.html for the finished example.

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 31

After completing this task you should see the quotation displayed in-line with the paragraph’s text. The only difference is that a double quote is added to the beginning and ending of the quotation. The blockquote, in contrast, is displayed beginning on its own line. The text in the blockquote is indented from normal paragraphs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

Rollers – The Key to Smooth
Cycling
It is a well-known fact that rollers are the quickest path to smooth bike handling. My coach used to say, overcorrect your steering and you fly right off the rollers, you gotta learn to steer gently if you don’t want to fall.

Wikipedia defines bicycle rollers as:
Bicycle rollers are a type of bicycle trainer which makes it possible to ride a bicycle indoors without moving forward. ---snip--bicycle’s wheelbase. Generally, the front roller is adjusted to be slightly ahead of the hub of the front wheel. For your information

Formatting quotations (cont.)

Task steps
1 Open the template and save

with a new name.
2 Enter a paragraph in the body

element. (7)
3 Somewhere in the paragraph,

identify a sentence to make a quote. 4 Just before the quotation, type

the opening tag. At the end of the quotation, type the closing tag. (10)
5 Below the paragraph’s closing

tag, type an opening tag and a closing tag. (17, 24)
6 Enter some text in the

blockquote element.
7 Save and display in your

browser.

i

You can embed tags in another set of tags. The embedded quotation is rendered as a single quote. At least it is supposed to be rendered this way. Different browsers may render it differently.
You can also embed standard formatting tags within blockquote elements.

HTML text layout tags 31

2

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 32

Formatting quotations (cont.)

For your information
The blockquote element has an optional cite attribute. If the quotation’s source comes from another website, you can enter the URL in this attribute. Your browser doesn’t display the cite attribute’s value, but it is useful for the metadata it provides.

32

i

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 33

There are many other elements used to mark up HTML text.
Covering each one separately would add 16 more tasks to this chapter. But each element doesn’t warrant its own task, as the elements covered in this task are quite easy to grasp. Still, this task explores 16 elements, so pay attention! Note, in this task I only cover elements that are not deprecated, so don’t worry that you’re learning an irrelevant element. There really is no reason to learn deprecated HTML formatting tags when CSS is so much more powerful for layout.
The elements covered in this task are the b, br, i, big, small, em, strong, sub, sup, del, ins, code, samp, kbd, var and cite elements. Table 2.6 Basic text formatting tags covered in this task
Tag

Function

greater-than sign

1 Open the template and save it

as a new page.
2 Between the body tags, enter

&, £, ¢,
©, ®, °,
±, ×,
÷, "e;,
< and > text. (4–7)
3 Now, between each special

character code, type the
  code. (4–7)
4 Add a definition list, dl,

after the previous step’s line and enter the following text for the definition term: automaç&atil de;o and then enter
“Portuguese for automation”. as the definition. (8–11)

quotation mark

<

Task steps

division character

"

Inserting special characters The results of this task are pretty straightforward, you should see each special character displayed in your browser rather then the code typed in the HTML.

5 Save and display the work in

your browser.

Cross reference
See tasks_html/ task_html_special_ characters/special
.html for completed example. HTML text layout tags 37

2

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

Inserting special characters (cont.)

For your information
Unicode and languages other then English
Unless you live in the most rural of areas, chances are you hear at least one or more languages other than English spoken on any given day. It’s a multilingual world. Chances are you speak at least a little of a language other than
English. Setting up your computer’s default character set for languages other than
English is beyond the scope of this book; but you should note that you can specify the character encoding of your page. Refer to the W3C’s website for more information
(www.w3c.org/International).
Don’t leave this task thinking you must use special characters if you wish to create a website in a language other than English. You don’t; special characters are for single words or short sentences. 38

i

30/1/09

1
2
3
4
5
6
7
8
9
10
11
12
13

10:41

Page 38

& £ ¢ &cop y; ® ° ±&n bsp;× ÷ "&nb sp;< > automação
Portuguese for automation.

Jargon buster
Viral video – Video shared over the Internet. This sharing leads to the video becoming popular.
Deprecated – Replaced software features that should no longer be used. A replaced element or attribute that is outdated by a newer element, attribute or construct. For instance, most HTML formatting features were replaced by
CSS, so these HTML formatting features are deprecated.

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 39

For your information
Within the body element, there are two HTML tag types: block-level and in-line. A block-level tag formats blocks of text, and causes browsers to render a new line following the element's closing tag. Block-level elements may contain other block-level elements and in-line elements.
Block-level elements are used for holding larger amounts of data. For instance, the paragraph element is a block-level element. Think of block-level elements as your page's building-blocks.

i

Inserting special characters (cont.)

2

In contrast, in-line elements are for applying formatting to smaller data structures such as hyperlinks, images and other tags. In-line elements may only contain other in-line elements and cannot contain block-level elements.

Table 2.8 Block-level elements

...

HTML text layout tags 39

M02_BRAN1529_01_SE_C02.QXD:BRILLIANT

30/1/09

10:41

Page 40

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

14:31

Page 41

3

Understanding hyperlinks
Introduction
The World Wide Web as we know it is founded on hyperlinks. A hyperlink is a location in a resource that links to another location in that resource or links to another resource. When you click on the link in your browser, your browser knows where to go through the uniform resource locator, or URL. A URL is the address that identifies a resource. Usually that resource is another Web page, although it might be something else, such as an image or video.

What you’ll do
Understand uniform resource locators (URLs)
Using hyperlinks – absolute URLs
Using hyperlinks – relative URLs
Adding targets to hyperlinks
Creating anchors
Linking to an email address

When you view a Web page in your browser, you’re actually viewing text mixed with one or more URLs. Before being displayed by a browser, an HTML page consists of text, nothing more, nothing less. All the images, movies, sounds and other multimedia are text hyperlinks to the actual resource. As a browser reads the page’s HTML, it finds the resource by using the resource’s URL, downloads it and places the resource in the appropriate location in the page. If the resource is an image, it displays the image. If the resource is Flash, or some other multimedia, it loads the appropriate plugin and loads the resource into the plugin. If a browser doesn’t know how to handle the resource, the browser usually raises a dialogue box either asking you to choose the application to open the resource with, or if you wish, to save the resource. When you physically click on a hyperlink with your mouse, you are instructing your browser to find the resource the hyperlink points to and load it. If it is an HTML page, your browser replaces the current page with the page newly retrieved.

Understanding hyperlinks 41

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 42

The technical information behind a URL is beyond the scope of this book. Anyway, you don’t need to know all the technical information; if you are interested, just google it and you will find more than you ever wished to know about the subject. For our purposes, however, just think of it as a unique, global address. More on URLs in the first task.

For your information
Most websites these days are dynamic. Rather than serving static HTML pages, there is an intermediate layer where a programming language actually dynamically writes the HTML page and sends the results to a Web server that delivers the page to your browser. For example, if you go to ebay.co.uk and navigate the listings, these listings are dynamically generated, you will not see static page names such as listing.html in your browser’s address bar.

42

i

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 43

Understanding uniform resource locators (URLs)

If you have any experience surfing the Web, you probably already understand uniform resource locators (URLs). URLs are addresses, much like the address to your house. Actually, a better analogy would be an apartment complex. An apartment’s main address – or base address – points to the apartment complex.
127 Garden Grove Apartments
The apartment’s address then points to the apartment’s actual unit number in the complex.

Task steps
1 In your browser, type:

Apt #27
But URLs take it one step further. A URL can point to a room and even a location in the room.

www.webopedia.com into the address bar and hit
[Return]. This takes you to the online resource: Webopedia.
2 Add:

Master Bedroom/left corner
So the complete URL would be:
/127 Garden Grove Apartments/Apt
#27/Master Bedroom/left corner
A complete URL begins with the protocol identifier. You almost never enter the protocol when typing an address into your browser. You usually simply type the domain name rather than the protocol followed by the domain name. For example, you would usually just type uk.yahoo.com rather than http://uk.yahoo.com. Your browser guesses that you mean the hypertext transport protocol (http) and prepends it to your URL.

/TERM/d/domain_name.html to the address and hit
[Return]. This takes you to the static page domain_name.html: a definition of domain name.
3 Now type the address

www.paypal.com in your browser’s address bar and press [Return]. As your browser navigates to PayPal, it changes the protocol from http to https. The https protocol, adds an encryption layer to http so that hackers cannot eavesdrop on the information being sent to your browser. Http is the primary protocol used by the Web. It is transparent to you, though. Just know that, behind the scenes, http is the way computers understand that they are sending Web pages to one

Understanding hyperlinks 43

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

Understanding uniform resource locators (URLs)
(cont.)

http://www.myserver.com/mypath/

5 Type uk.yahoo.com and

press [Return] to navigate to
YahooUK. After navigating to it, enter index.html after the trailing slash. Your browser navigates to the same page.

44

Page 44

After the resource’s server name, comes the path to the actual resource’s location. Note that the path can simply be a / when the resource is in the website’s root folder.

http://theocacao.com/ into your browser’s address bar and press [Return]. This takes you to Scott Stevenson’s site.
It’s a great resource on Mac
OS X programming using
Cocoa, incidentally.

Step 5 illustrates an important best practice.
Often, sites will name the primary page default.html or index.html, when a user navigates to the location without specifying the file, the location’s Web server sends the browser the default page. You should do the same.

10:41

another via headers. After the protocol comes the server’s name.
The server name specifies the computer name of the resource’s location. It specifies the apartment complex, for example.

4 Finally, type:

For your information

30/1/09

i

Finally, after the path comes the actual resource. http://www.myserver.com/mypath/mypage.html 4

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 45

In the last task I introduced URLs. URLs are what you use to navigate the Web. They are also the way users navigate both to and from your site. URLs can be either external or internal. An external URL points to another website, while an internal URL points to another resource on your site. An absolute URL shows the entire path to a resource. You use absolute URLs to point to external resources. A relative URL is for navigating from one section of a site to another. For example, in our apartment complex example in the previous task, moving from one apartment complex to another would require an absolute
URL. Navigating within the same apartment complex allows the use of relative URLs.

Using hyperlinks
– absolute URLs

Task steps
1 Open the template and save it

with a different name.
2 Find two or three sites you

You use the anchor tag to reference other locations.
Those locations can be other locations in the same document or different documents. The marking up anchors task illustrates the use of the anchor tag for linking to other locations in the same document. This task illustrates the use of the anchor tag for navigating to other documents. You use the anchor tag’s href attribute to specify to other documents. This task illustrates using href to point to external sites using absolute URLs. The next task illustrates internal links using relative URLs.

wish to link to and jot down the Web address. Also, note the title that your browser displays for the pages and jot that down also.
3 Between the body tags in

links.html, create an unordered list, with the same number of items as the sites identified in Step 2. (7–18)
4 Enter the Web page titles as

Table 3.1 Tag covered in this task

the list elements. (10, 14, 16)
5 Now, at the beginning of each

Tag

Function

Specifies an anchor. A link to another document or another location in a document.

title type the opening tag and for the href attribute type the URL. (8, 13, 15)
6 At the end of each title, type

the closing tag.
(12, 14, 17)

Cross reference
See tasks_html/task_html_links_ absolute/links.html for completed example.

7 Save and open in your

browser.

Understanding hyperlinks 45

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

Using hyperlinks
– absolute URLs
(cont.)

Important
You never use backward slashes in URLs, you always use forward slashes. Even in Windows.

46

!

30/1/09

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

10:41

Page 46

www.cyclingnews.com – the first WWW cycling results and news service YouTube – Broadcast Yourself
Chris Hoy |
Olympic Champion Cyclist

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 47

You use relative URLs to link to documents within your website.
In this example you explore relative URLs. If you followed the absolute URL to the left corner of the master bedroom:

Using hyperlinks
– relative URLs

127 Garden Grove Apartments/Apt
#27/Master Bedroom/left corner then, to get to the kitchen, you wouldn’t want to go back outside the apartment complex and navigate back to the kitchen:

1 Save the template twice,

127 Garden Grove Apartments/Apt
#27/kitchen
Instead, you would simply want to go back to the apartment’s main entrance and navigate to the kitchen:

Relative URLs allow simpler navigation within the same website. You need to know a little about navigating computer file paths using the command line to successfully understand relative URLs. If you use Windows, type cmd in Run to go to the commandline prompt. For example, on Windows XP, from the Start Menu choose
Run. In the Run window’s open dialogue box, type cmd and press [Return]. This takes you to the command prompt. To navigate a level up type cd followed by a space and two periods (cd ..), to navigate a level down type cd ./ and the directory’s name.
On OS X, go to Utilities and open Terminal.app. A bona fide UNIX command terminal is opened (you did know
OS X is a UNIX variant, right?). If you want to know your current directory, type pwd. To navigate up a directory type cd .., to navigate down a directory type cd ./ followed by the directory name.

assigning the filenames main.html and sub.html. 2 Create a folder named

asubfolder in the same folder as the two newly created
HTML pages.

../kitchen

Important

Task steps

3 Create an HTML page in the

!

newly created folder. Name the file subtwo.html.
3 Open main.html and type

some text. Create a link around some text. In the href, have it point to a sub.html.
(11)
4 Create another link in

main.html and have it point to the subtwo.html page in the asubfolder subfolder. (8, 9)
5 Save main.html and open

sub.html.
6 Type some text and create a

hyperlink to main.html.
(22, 23)
7 Save and open

subtwo.html.

Understanding hyperlinks 47

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

Using hyperlinks
– relative URLs
(cont.)

8 Save subtwo.html and

open main.html in your browser. Navigate through the added links on the three pages. 30/1/09

10:41

Page 48

Cross reference
See tasks_html/task_html_links_relative/main.html for completed example.
The link in main.html to sub.html simply references the file, as they are in the same folder. The link from main.html to subtwo.html includes a . to indicate the current directory, a forward slash, the subdirectory’s name and the file.
The link from subtwo.html back to main.html includes a .. which navigates back to the next level up. Finally, in sub.html, note that you can combine .. and . into a complete path, even if they are nonsensical, like the example.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

48

About Me
I love cycling, see hello. I also love programming and writing. See my online resume for my programming experience.

Resume – James A. Brannan back to bio the hard way... M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

26
27
28
29
30
31
32
33
34
35
36

30/1/09

10:41

Page 49

HELLO
Back to Bio.

Using hyperlinks
– relative URLs
(cont.)

Important

!

If you open a.html in tasks_html/task_html_links _relative/asubfolder/a.html you will notice that the image tag’s source is
Ym.png not ym.png.
Remember that, although in
Windows URLs are not case sensitive, on Linux and
OSAX they are. It is imperative you use the correct case.

For your information

i

If you wish to do so, you can make internal links fully qualified URLs. But it is much easier to use relative
URLs for internal links.

Understanding hyperlinks 49

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

Adding targets to hyperlinks

10:41

Page 50

An anchor can have a target attribute. The target attribute specifies where to open the resource linked to by the anchor element. Table 3.2 Attributes covered in this tasks
Attributes of an anchor element ( tags)

Task steps

_blank

Open the resource in a new window or new tab. _parent

Open the resource in the parent frame.

_self

Open the resource in the same frame.

_top

Open the resource in the same window.

1 Open the template and save

with a different name.
2 Add three hyperlinks to an

external site. (13, 19, 25)
3 In the top link, add the target

attribute and assign it
_blank. (13)
4 In another link add a target

with _self for its value. (19)
5 In the third link, add a target

with _top for its value. (25)
6 Save, open in your browser

and observe the different behaviour of the three links.

Target is most useful when using framesets, but nobody uses frames these days. This book doesn’t even cover frames, they have fallen so out of use. However, there is still one quick and easy use for target: when linking to a resource, you can specify that it should open in a new window or tab. For example, if you linked to another site, normally when the user clicks on the link they would leave your site when the browser loads the new site’s page. When using the _blank attribute, the browser remains on your site, but opens a new window to display the resource. Cross reference
Refer to tasks_html/task_html_targets/target_blank.html for completed example.

After completing this task, when you click on the first link, it opens in a new browser. Unless you use frames, this is by far the most useful target attribute you can use. This allows you to link to external sites and when users click on the link they don’t navigate away from your site. Instead a new window

50

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 51

opens. If you have ever been to a gambling site, or some other site offering anything ‘free’ – you have probably seen more examples of the _blank target than you care too.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Adding targets to hyperlinks (cont.)

You can spend hours reading ---snip--every day. Brilliant Mac OSX
Leopard is a book that accomplishes this, I use it.

Target=_blank:
Brilliant Mac OSX Leopard

Target=_self:
Brilliant Mac OSX Leopard

Target=_top:
Brilliant Mac OSX Leopard

3

Understanding hyperlinks 51

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 52

Adding targets to hyperlinks
(cont.)

For your information
Frames and targets
Depending upon how long you’ve been using the
Internet, you may of heard about frames. Frames are unattractive and are rarely used nowadays. Frames allow you to divide your browser into different regions and load independent HTML pages into each frame. Targets helped with frames. You could name each frame in the frameset, and in any link on any of the independent pages you could specify the target. The resource referenced by the URL would then be loaded into the specified target.

52

i

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 53

In Web slang, anchor does not refer to the anchor element. An anchor element is usually just called a link, or hyperlink. The coloquial ‘anchor’ definition refers to a specific type of anchor element, where the link refers to another location in the same page. For example, you might have a long page with a table of contents at the top. Each item in the table of contents can be linked to its appropriate location in the page.

Creating anchors

Task steps

Cross reference
See tasks_html/task_html_anchors/anchorsexample. html for completed example.
To get the full effect, you should resize your browser window so only the first paragraph is visible. When you click on the link, the visible text should jump to the anchor you defined.
When you click on the hyperlink to the second page, it should load in the page and navigate directly to the anchor on the second page.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Anchor Example

You use anchors to link from one location on a page to another. They are most useful for long text pages that users must scroll as they read the page.

Anchors can also link to an anchor on another page.

1 Open the template and save it

using a different name.
2 Type a simple paragraph in

the document, then type ten tags and enter some simple text. (20, 21)
3 In the inital paragraph, choose

a word and add a link around it. But, instead of specifying another document, type the
[#] key followed by a simple name. For example,
#scroll_def. (14)
4 In the text below the

tags choose a word and place a link around it. Do not add an href attribute, but instead add a name attribute. For the name attribute’s value, type the same name (minus the #), for example, scroll_def. (24)
5 Create another simple html

page with about 10–15 tags. After the tags, add an anchor to the page. (44)

Understanding hyperlinks 53

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

Creating anchors
(cont.)

6 Back in the original page,

create a hyperlink leading to the new page then, only at the end of the URL, add # and the anchor name you created in the other page. (17, 18)
7 Save your work and open it in

your browser.

For your information
When typing long pages, a good practice is to list the headings at the top of the page and provide anchors to the relevant section in the page. This makes it easy for users to skim your page and decide if they want to read in more detail.

54

i

10:41

Page 54

22
23
24
25
26
27
28
29
30
31
33
34
35
36

scroll

Webopedia defines scroll as:

To view consecutive lines of ---snip--up one row, so that the top line disappears. 37
38
39
40
41
42
43
44
45
46
47

—-snip—-

scroll
All the way at the bottom.

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:41

Page 55

Go to any website and you will usually see a ‘contact me’ link somewhere on the main page. When you click it, your default email program usually activates and presents you with a dialogue box to complete the email and send it. On Windows,
Outlook is probably activated. On Mac, Mail is activated and a
New Message dialogue box is presented.
Mail links begin with a mailto: rather than an http:// at the beginning. This tells a browser that the link’s protocol is email. The basic form of a mailto link is as follows.

Linking to an email address

Task steps
1 Open the template and save

Contact Me.
If you want, you can even pre-fill some of the email’s fields. You can specify an email’s subject and even its message. You can also specify email addresses for the cc and bcc fields. And of course you can specify multiple recipients for any of the recipient fields.

using a different file name.
2 Add a paragraph with some

text. (7)
3 Add a link only for the href

use mailto:emailaddress. Try using your actual email address. (10)
4 Copy the newly created page

Cross reference
See tasks_html/task_html_email_link/mailto.html for completed example.
Once this task is complete click on the first page’s link and a dialogue box to compose an email message should appear.
The subject line and recipient should be pre-filled. The second page’s link should open a dialogue box with all the fields pre-filled. There should be more than one recipient.
1
2
3
4
5
6
7
8
9
10
11

Yes, I’m interested in iNtervalTrack!

Please send me more info.

and save with a different name. 5 Edit the email address and

add a subject. Note the %20 for spaces, this is important.
(25)
6 Add a cc and a bcc. Note the

& between subject, cc, and bcc. Also, note that the values for these fields do not have a single or double quote.
(27, 28)
7 Add another cc value by

placing a semicolon and a second email address. You can send emails, cc and bcc to as many addresses as desired by using semicolons between addresses. (28)
8 Add a body value by typing:

&body. (29)

Understanding hyperlinks 55

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

Linking to an email address
(cont.)

browser. Move your mouse over the link, and notice the lower left corner of the browser’s status bar.
10 Click on the link, and your

system’s mail program should open with an email ready to send, with the To, cc, bcc,
Subject and Body fields prefilled.

Unless typing an extremely short body message, you wouldn’t normally want to populate the body. It is just too cumbersome to type the message in-line.

56

Page 56

12
13
14

9 Save and open in your

For your information

10:41

i

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

Yes, I’m interested in iNtervalTrack!

Please send me more info.

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:42

Page 57

Cross reference
In Chapter 6, I show you how to design a form that a user submits via email.

Linking to an email address
(cont.)

Jargon buster
Plug-in – Additions you can install in your browser that allow playing multimedia content not otherwise supported by a browser. For instance, Adobe Flash is a plug-in you must install separately from your browser.
‘Google it’ – In Web vernacular, ‘googling it’ is looking up something online using Google.

Important

!

For the mailto to work, you must have a system mail client. If you use Explorer and Outlook, chances are this just works. The same is true for Safari and Mail on Macs. If it doesn’t work, you should consult your system’s documentation to set up your mail client.

Understanding hyperlinks 57

3

M03_BRAN1529_01_SE_C03.QXD:BRILLIANT

30/1/09

10:42

Page 58

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 59

4

Adding images to your
Web page
What you’ll do

Introduction
Two or three years ago, it was important that a book like this started a chapter on images with a lengthy discussion about optimising images for the Internet. Now, not so much. In the day of YouTube, and high-speed Internet access in the interior of Brazil, image optimisation is not so crucial. In less than five years, the average person has gone from using a 56K dial-up connection to an always on cable modem or ISDN line. Do you remember the days when you would sit and literally wait for an image to load? Seems like a distant memory, doesn’t it? Do you remember 640 x 480 or 800 x 600 screen resolution? Well, today 1024 x 768 is really the lowest screen resolution you need to worry about. And almost all computer monitors display more colours than you could ever possibly use in your images.

Explore image optimisation
Add images to a Web page
Create image links
Create image links – thumbnails
Create an image map

Actually, there are a couple things you should know about Web images. Also, if you are uploading photos from your digital camera, then optimisation is important. So this chapter does begin with a brief discussion on image optimisation.
These days, there isn’t really all that much you need to know when optimising images for the Web. Remember the following five points and you’ll do fine.
1. For photographs, use the JPEG format.
2. For artwork, use the PNG format.
3. Try to avoid the GIF format and use PNG instead.
4. Read your image software’s Help! And, even more important, do not try to optimise the image too much.

Adding images to your Web page 59

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 60

5. Keep your image’s dimensions reasonable. Remember, your camera saves images as high resolution TIFF or JPEG files.
They are huge!

Important
Prior to Internet Explorer
7, some PNG features such as adaptive transparency were not fully supported. !

The three primary image formats on the Web today are the Joint
Photographic Experts Group format (JPEG), the Graphics
Interchange Format (GIF) and Portable Network Graphics format
(PNG). When saving photographs, use JPEG. For various reasons, the JPEG format is good for photographs. Unless creating an animated GIF, don’t use GIF format. Instead use the
PNG format. The PNG format is a more modern image format that has rich colour support, advanced compression schemes,
24-bit colour, adaptive transparency and several other features that make it a better choice than GIF.
Okay, so I know I just got finished writing that image optimisation isn’t so crucial these days. In general that’s true, but there is one complicating factor that causes me to still briefly discuss image optimisation: digital cameras. Digital cameras have made taking photos, uploading them to a computer, and sharing them on the Internet easier than ever before. But there’s just one problem with images from digital cameras. Typically, digital cameras share images as large, highresolution, TIFFs or JPEGs. These images are too large for displaying on the Internet. You must reduce the image’s file size and dimensions.
But this chapter isn’t just about image optimisation. In this chapter, you also learn how to add images to your Web page.
You use the tag to insert images to a Web page. This element has several attributes. In this chapter I cover the src attribute, the height and width attribute and, the alt attribute.

I largely ignore the deprecated align attribute. But I do briefly discuss it, as it is still in use, even though it is deprecated.

60

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 61

Exploring image optimisation This topic really isn’t as crucial as it used to be. Use PNG for artwork and JPEG for photographs. But if you want to upload your photos from your digital camera and add them to your web page, then this task is important. Digital cameras save large, high-resolution JPEG or TIFF files. You should optimise these images before adding them to your Web page.
You probably don’t have Adobe Photoshop. But if you have a
Mac, you should have Preview. Double click on the image and it should open in Preview. After loading the image, choose
Tools, Adjust Size …, and a dialogue box allowing you to reduce the image’s size appears. If you are using Windows, there is a good chance your camera came with image editing software that has a size reduction feature. And if your camera didn’t come with software, then there are ample shareware and open source software resources available for basic image editing on the web. The key feature is that it allows you to reduce the image dimensions. I don’t recommend tinkering with colour optimisation, lower-resolutions (unless changing from high to medium resolution for a JPEG) and other image file size reduction optimisations unless your website is for cable modem subscribers in some remote village somewhere – and even they probably have ISDN, monitors that display thousands of colours, and 1024 × 768 display resolution.

Task steps
1 Navigate to your images folder

from your digital camera and double-click on a photograph.
I’m assuming your computer opens it in either the default program for that file type or some type of ‘preview’ program. 2 For example, when I double-

click on an image it opens in
Apple Preview.
3 Whoa Nelly! My photograph’s

dimensions are 1600 × 1200 pixels, and size is 815kb. The photograph is so large, I can’t even see the whole photograph on my screen.
4 So, I go to my image

software’s image-size option and reduce the image to
640 × 480 and save it as a jpeg. Now the image is only
41.1 kb and will display nicely in a Web page.

Adding images to your Web page 61

4

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 62

Adding images to a Web page

For your information

i

If saving a JPEG, try changing the image’s quality from high to medium. This reduces the image’s file size with no loss in viewing quality. Important
If an image is saved without the correct .jpg, .gif, or .png extension then your computer will not recognise the file format!

62

!

If you aren’t at least slightly familiar with the tag by this chapter, then you haven’t been paying attention in Chapters
2 and 3. Just to add a little spice to the tasks, I added simple images to the examples in those chapter’s tasks. I did that using the image element. The image element uses the tag to insert images into Web pages. Note, what you’re really doing is providing your browser with a URL that points to the image’s file. The browser then retrieves the image from the location specified in the src attribute and renders the image in the specified location on the Web page.
Image elements have several attributes, I cover the alt, src and height and width attributes in this task. The alt attribute provides a short image description. The src attribute specifies the image’s location. Browsers use this attribute to retrieve the image. The height and width attribute specifies the image’s height and width to be displayed on the page. If the height and width do not match the image’s actual height and width, then the image is enlarged or reduced to match the given space. But note, the actual image file size in bytes remains the same, your browser simply scales the image to fit in the allotted size specified by the attributes.

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 63

After completing this task and viewing the results your browser should have displayed the first image as it was meant to be seen.
The second image should be stretched and displayed larger then it actually is. You should avoid doing this – images displayed at a larger size than saved almost always look awful. The third image should be smaller and not appear distorted. You can almost always reduce an image without it appearing awful, provided the image’s aspect ratio remains unchanged. The fourth image should look the most distorted of all. It illustrates two dangers of not using an image’s actual width and height. First, the image looks terrible when enlarged. Second, images have what’s called an aspect ratio. The freebsd.png has an aspect ratio of 1:1. But when you assign it a 20% height and a 100% width, you are assigning it an aspect ration of 1:5. This is not the image’s aspect ratio, and so it appears distorted.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Actual Size:
Bigger:
Smaller:
Percentage:

Adding images to a Web page
(cont.)

1 Obtain an image to use in this

example. Preferably a smaller one. You can use the BSD devil image used in this example if you have downloaded the completed examples. In the following instructions, I assume you use this image.
2 Add four tags to

your page and make all four reference the freebsd.png image file. (7, 10, 13, 16)
3 In the first image element,

assign it the image’s actual size of 72 pixels high and 72 pixels wide. (8)
4 Assign the second image

element a size of 200 pixels high by 200 pixels wide. (11)
5 Assign the third image

element a size of 22 pixels high by 22 pixels wide. (14)
6 Assign the fourth image

element a size of 20% high by
100% wide. (17)
7 If you didn’t add alt attributes

to each image while creating them, add alt attributes to each image element.
8 Save and view in your

browser.

Adding images to your Web page 63

4

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 64

Adding images to a Web page
(cont.)

Cross reference
See tasks_html/task_html_image_markup/image.html for completed example.

For your information
Another attribute you can add is a title: when a user moves their mouse over the image a Tooltip with the title’s text is displayed.
Tooltips are also referred to as ScreenTips or hover boxes, depending on the system. 64

i

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 65

How to display a custom icon in a browser (a favicon) Navigate to theocacao.html. After the page loads, notice the little icon before the URL in your browser’s address bar. Bookmark the site, and the same icon appears in your bookmark list.
Pretty cool. These are called favicons – favorites icons – in Web vernacular.

The reason favicons are not a task in this book is because you can’t see the results unless your page is on a Web server. Creating an icon and then assigning it a relative path for a locally served page (using the file:// protocol) just doesn’t work. On my computer, it dislays in
FireFox’s address bar, but not in the Bookmarks list when bookmarked. The icon doesn’t display at all in Explorer or Safari.

James’s Super-Cool
WebSite

Creating a favicon is easy. Find a small image that is 16 x 16 pixels (remember, icons are small). There are many open-source/free images on the Web you can use. For example,
Crystal Project and Vista Inspirate, from www.kdelook.org, both have 16 × 16 icons.
After obtaining the image, you save the image as a .ico file. Many image editing programs can save an image as an ico, but you can always go to www.favicon.cc’s favicon creation utility and create an icon online and download it.

Adding images to your Web page 65

4

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

Creating image links 1 Save template.html with a

different name.
2 Add six images to the page.

The finished example has six images you can use.
3 Add an anchor element

around all six images. Make each link to a different site.

30/1/09

10:42

Page 66

A common practice on the Web is using images for hyperlinks.
It’s easy, instead of wrapping text in tags, wrap the tag in them. There is one slight problem, Internet
Explorer and Firefox place a blue border around the image. This makes sense, the image is a hyperlink – your browser wants to notify the reader of that fact. But often, aesthetically, the border appears out of place. Removing the border is pretty easy. If you don’t mind using deprecated attributes you can specify that an image has no border.

But you really should use CSS instead. If you are using Safari, notice it does not add a border to image links unless you specify the image has a border.

4 Save and display in your

browser.

Cross reference
In the ‘Formatting hyperlinks – image links’ task in
Chapter 10 (see p. 184), you specify an image with no border using CSS.

Cross reference
Refer to tasks_html/task_html_image_links/ imagelink.html for completed example.
The results are straightforward: after completing the task you should see six images, each with a blue border indicating that each is a hyperlink.

66

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

30/1/09

10:42

Page 67

Fedora Linux
Redhat Linux
Free BSD
Open BSD
SUSE Linux
Ubuntu Linux

Creating image links (cont.)

Adding images to your Web page 67

4

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

Creating image links – thumbnails 1 Open and save the template

with a different name. Repeat, and name one page fullsize.html and the other thumbnail.html. 2 Open thumbnail.html and add

the freebsd_thumb.png to the page, make it an imagelink pointing to fullsize.html. In the hyperlink, be sure to add a target attribute and have it point to
_blank. (6, 7)
3 Save thumbnail.html and open

fullsize.html. Add the image freebsd.png to the page. (22)

10:42

Page 68

A common practice is displaying a small image and then, when the user clicks it, the browser loads a full-size image into the browser. For example, navigate to www.google.com, select images, type in a search term, and click the Search Images button. What returns is a page of thumbnail images. When you click on one of them, a frameset loads in your browser. The top frame shows the image’s thumbnail while the bottom loads the original page the image comes from. The thumbnail in the top frame is a link. Click on it, and your browser loads the original full-size image.

Cross reference
See tasks_html/task_html_image_thumbnails/ thumbnail.html for completed example.

After completing the test and viewing its results in your browser you should see the smaller image as an image link.
When you click on the thumbnail, a new browser window pops open, or a new tab is displayed, with the full-size image.

Important

4 Save and open

thumbnail.html in your browser. 68

In the previous task you made an image smaller by making its dimensions smaller (height and width).
When you do this using the image element’s height and width attributes, you don’t make the image’s size in bytes any smaller. The browser just scales the image; downloading a 500K image takes the same amount of time regardless of its height and width. Thumbnails, in contrast, allow you to display smaller images and if the user is really interested in seeing the full-size 500K image of your cute puppy dog, they can click on the thumbnail to download it.

!

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 69

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Mac OS X uses a
FreeBSD version as its base operating system? The user-friendly Mac is UNIX at its core! 17
18
19
20
21
22
23
24

Creating image links – thumbnails (cont.)

Adding images to your Web page 69

4

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

Creating an image map

1 This example assumes you

have downloaded this book’s examples. Navigate to the task_html_image_maps folder and get the clock.png graphic. It’s 128 × 128 pixels.

10:42

Page 70

Image maps contain an image with one or more clickable areas called hotspots. A hotspot is a location on an image that, when clicked, causes a function to execute. In a Web page, that function is usually navigating to another resource via a hyperlink. Each clickable area is a hyperlink to another resource.
That resource can be anything normally handled by hyperlinks.
Creating an image map involves three steps. First, determine the image’s dimensions in pixels. For example, the image used in this task – clock.png – is 128 x 128 pixels. Second, sketch the image on paper and draw the areas to turn into hotspots.
Determine the dimension of each hotspot. And third, add the information to the image in the Web page.

2 Save the template with a

Table 4.2 Tag covered in this task

different name.
3 Sketch the clock on a piece of

paper.

Tag

Function

Specifies an image map.

4 On the paper, divide the

graphic into four quadrants.
These are the four regions you will turn into hotspots.
5 On the paper, figure out the

coordinates moving counter clockwise. From (0,0) to
(64,64) – or 9 o’clock to
12 o’clock – is region one.
From (0,64) to (64,128) – or
9 o’clock to 6 o’clock – is region two. From (64,64) to
(128,128) – or 6 o’clock to
3 o’clock – is region three.
Finally, from (64,0) to
(128,64) – or 3 o’clock to
12 o’clock – is region four.
6 Now you’re ready to turn the

image into an image map. If you haven’t already, open template.html and save it under a different name.

70

Important
An image’s top left corner is the (0,0) coordinates. The Y axis is positive moving downward. The X axis is positive moving right.

!

M04_BRAN1529_01_SE_C04.QXD:BRILLIANT

30/1/09

10:42

Page 71

Creating an image map
(cont.)

Cross reference
See tasks_html/task_html_image_map/example_ imagemap.html for completed example.
Upon completing this task and loading the results in your browser the first thing you should notice if you’re using Firefox or Explorer is a big blue border around the image. Remember, once you learn CSS removing that border is easy. You could use the deprecated border attribute if you really wanted to, although I don’t recommend it. Move your cursor to different areas on the image and your browser’s status bar should display the URL the hotspot is linked to. Try clicking on the different hotspots; your browser should open a new window or tab - navigating to each area’s respective link.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Image Map Example

i

A hotspot can be shapes other than a rectangle. Valid shapes are point, rectangle, circle and polygon. Circles take three values in the coord attribute: the centre point and radius. A polygon can take any number of points that join into a shape.
For example, returning to the clock, you could define an circle of (64,64,20). This area would make a circular hotspot from the clock’s centre outwards 20 pixels.

Jargon buster
Aspect ratio – An image’s proportion expressed as width divided by height. For instance, a 100 pixel x
100 pixel image has a 1:1 aspect ratio. A 300 pixel x 100 pixel image has 3:1 aspect ratio.

72

M05_BRAN1529_01_SE_C05.QXD:BRILLIANT

30/1/09

14:31

Page 73

5

HTML tables
Introduction
You use HTML tables to present tabular data on a Web page.
You can also use tables for page layout. Tables allow data to be arranged into rows and columns of data cells. You can put just about anything in a table’s cells, including images, paragraphs and even other tables. This flexibility makes tables useful for page layout and presenting tabular data. In this chapter you learn how to add tables to your HTML documents.

What you’ll do
Create table rows and data cells
Add padding and spacing to table cells Add headings to tables
Add a caption to tables
Add frame attributes to tables

Cross reference

Specify column spans and row spans The task, ‘Creating a liquid layout using a table’, in
Chapter 13 covers using tables for page layout.

Specify a table’s header, body and footer

You define a table using the tags. The tags divide a table into rows. The tags further divide rows into data cells. Each row and column can also have a header cell. Header cells use the tags. You can also separate a table into its header, footer and body using the , , and tags. And you can assign the table a caption using the tags.

Add table dividing lines using rules HTML tables 73

M05_BRAN1529_01_SE_C05.QXD:BRILLIANT

30/1/09

10:43

Page 74

Figure 5.1 Table tags
Tag

Function

Specifies a table.

Specifies a table row.

Specifies table data cell.

Specifies a table header cell

Specifies table header rows.

Specifies table footer rows.

Specifies table body rows.

Specifies a table caption.

The table element has several important attributes. The border, cellpadding, cellspacing, frame, rules and width attributes all enable formatting of the way in which browsers display a table.
In this chapter you learn how to use these attributes.

For your information
Tables also have an align and bgcolour attribute, but they are deprecated and are not used in this chapter.

i

Table 5.2 Table attributes covered in this chapter
Function

Material£455
£987
Total = 
£1442

Specifying column spans and row spans
(cont.)

5

HTML tables 89

M05_BRAN1529_01_SE_C05.QXD:BRILLIANT

Specifying a table’s header, body and footer

30/1/09

10:43

Page 90

You can specify a table’s header, body and footer using the tags, tags and tags. The meanings of the three tags are as you might imagine: specifies the header, specifies the table’s body and specifies the the table’s footer.

Table 5.8 Table related tags covered in this task
Task steps
1 Open one of the previous

tables or create a new one.
2 Add the

tags between the opening tag and the table’s first tag. (14)
3 In the table footer, add a table

row. In the table row add a table cell with a colspan of three. Add some text to the cell. (14)
4 After the table footer add

tags.
Add a table row and insert a table data cell with a colspan of three. (20)
5 Save and display in your

browser.

90

Tag

Function

Specifies table header.

Specifies table body.

Specifies table footer.

Cross reference
See tasks_html/task_html_table_various/task_html_ grouping.html for completed example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Tables: Footers,
Table Body, and Column
Groups

Sorry I’m so ugly, but the author doesn’t want to waste your time by showing you deprecated HTML formatting tags when you can use CSS.

Illustrating a table footer. Column Rules, Footer, Body, and
Column Grouping

M05_BRAN1529_01_SE_C05.QXD:BRILLIANT

19
20
21
22
23
24
25
26
27
28
29
30
31
32

30/1/09

10:43

Page 91

A table header. £300£
200£200
£50£30
£200
£300£
200£200

Specifying a table’s header, body and footer
(cont.)

5

HTML tables 91

M05_BRAN1529_01_SE_C05.QXD:BRILLIANT

30/1/09

Adding table dividing lines using rules

Task steps
1 Open the HTML document

10:43

Page 92

Often you might wish to display borders between only some table rows or columns. HTML tables have a rules property that allows you to do just that. If you only wish to show lines between rows, you assign the value rows to the rules attribute.
To show only lines between columns, you assign the value cols. If you don’t want any lines, you specify none as the value.
If you want lines between columns and rows, you specify all for the rules attribute. You can also specify rules dividing a table’s major groupings (thead, tfoot and tbody elements) by assigning rules to the value groups.

from the previous task and save with a different name.
2 In the table’s opening tag, add

a rules attribute and assign its value as cols. (6)

Table 5.9 Table rules attribute

Similar Documents

Premium Essay

Hello World

...< Project scenario name > Software Requirements Specification Version < X.0> < team Name > < Scenario Name > Software Requirements Specification Version < X.0> Team Guide:( Faculty Guide’s Name ) Members:(Team members name) College Name: Department: State: / Page 1 < Project scenario name > Software Requirements Specification Version Revision History Date Version 1.0 2.0 Description Synopsis Synopsis Author / Page 2 < Project scenario name > Software Requirements Specification Version X.0 Table of Contents Description 1.0 Introduction 1.1 1.2 1.3 1.4 1.5 1.6 Purpose Scope Definition, Acronyms, and Abbreviations References Technologies to be used Overview Page No. 2.0 Overall Description 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 Product Perspective Software Interface Hardware Interface Product Function User Characteristics Constraints Architecture Design Use Case Model Description / Page 3 < Project scenario name > Software Requirements Specification Version X.0 2.9 Class Diagram ........................................................................ Sequence Diagram s ............................................................... 2.10 Database Design .................................................................... 2.11.1 2.11.2 ER Diagram ............................................................... Schema ...................................................................... 2.12...

Words: 738 - Pages: 3

Premium Essay

Hello World

...A "Hello, World!" program is a computer program that outputs "Hello, World!" (or some variant thereof) on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language. It is also used to verify that a language or system is operating correctly. Purpose This section does not cite any references or sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (April 2015) A "Hello, world!" program has become the traditional first program that many people learn. In general, it is simple enough so that people who have no experience with computer programming can easily understand it, especially with the guidance of a teacher or a written guide. Using this simple program as a basis, computer science principles or elements of a specific programming language can be explained to novice programmers. Experienced programmers learning new languages can also gain a lot of information about a given language's syntax and structure from a "Hello, world!" program. In addition, "Hello, world!" can be a useful sanity test to make sure that a language's compiler, development environment, and run-time environment are correctly installed. Configuring a complete programming toolchain from scratch to the point where even trivial programs can be compiled and run can involve...

Words: 337 - Pages: 2

Premium Essay

Hello World

..."Hello World" redirects here. For the Iamus (computer) composition, see Hello World! (composition). For the 2009 compilation album by Michael Jackson, see Hello World: The Motown Solo Collection. For the song by Lady Antebellum, see Hello World (song). A GUI "Hello World" program, written in Perl It is possible to execute unsigned code on Sony's PlayStation Portable. A light-programmable biofilm displaying the Hello World message CNC machining test in Perspex A "Hello world" program is a computer program that outputs "Hello, world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to verify that a language or system is operating correctly. In a device that does not display text, a simple program to produce a signal, such as turning on an LED, is often substituted for "Hello world" as the introductory program. Contents [hide] 1 Purpose 2 History 3 Variations 4 See also 5 References 6 External links [edit]Purpose A "Hello World" program has become the traditional first program that many people learn. In general, it is simple enough so that people who have no experience with computer programming can easily understand it, especially with the guidance of a teacher or a written guide. Using this simple program as a basis, computer science principles or elements of a specific programming...

Words: 863 - Pages: 4

Premium Essay

Hello

...hi For other uses, see Hello (disambiguation). "Hallo" redirects here. For other uses, see Hallo (disambiguation). Hello is a salutation or greeting in the English language. It is attested in writing as early as the 1860s.[1] Contents   [hide]  * 1 First use * 2 Etymology * 2.1 Telephone * 2.2 Hullo * 2.3 Hallo and hollo * 2.4 Cognates * 3 "Hello, World" computer program * 4 The Apple DOS HELLO program * 5 Perception of "Hello" in other nations * 6 See also * 7 References * 8 External links ------------------------------------------------- First use Hello, with that spelling, was used in publications as early as 1833. These include an 1833 American book called The Sketches and Eccentricities of Col. David Crockett, of West Tennessee,[2] which was reprinted that same year in The London Literary Gazette.[3] The word was extensively used in literature by the 1860s.[4] ------------------------------------------------- Etymology According to the Oxford English Dictionary, hello is an alteration of hallo, hollo,[5] which came from Old High German "halâ, holâ, emphatic imperative of halôn, holôn to fetch, used especially in hailing a ferryman."[6] It also connects the development of hello to the influence of an earlier form, holla, whose origin is in the French holà (roughly, 'whoa there!', from French là 'there').[7] As in addition to hello,halloo,[8] hallo, hollo, hullo and (rarely) hillo also exist as variants...

Words: 698 - Pages: 3

Free Essay

Hello World

...Hello world. This is the thing I say everytime I wake up in the morning to enjoy and acknowledge the beautiful things that have been endowed to me in my precious life. I have seen people complaining even about the pettiest problem and showing as if they are the greatest sufferer in the whole world. All such things adds up the already increasing pool of negative energy that we carry around with us increasing it bit by bit level by level and this thing is contagious as it keeps on growing and transmitting So acknowledge everyday what GOD has given you and live the fullest of your life to bring the best of you. Hello world. This is the thing I say everytime I wake up in the morning to enjoy and acknowledge the beautiful things that have been endowed to me in my precious life. I have seen people complaining even about the pettiest problem and showing as if they are the greatest sufferer in the whole world. All such things adds up the already increasing pool of negative energy that we carry around with us increasing it bit by bit level by level and this thing is contagious as it keeps on growing and transmitting So acknowledge everyday what GOD has given you and live the fullest of your life to bring the best of you. Hello world. This is the thing I say everytime I wake up in the morning to enjoy and acknowledge the beautiful things that have been endowed to me in my precious life. I have seen people complaining even about the pettiest problem and showing as if they are...

Words: 343 - Pages: 2

Free Essay

Hello World

...Hello World This is just a sample essay.   Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat...

Words: 1697 - Pages: 7

Free Essay

Hello World

...CS 106B: Programming Abstractions in C++ Course Syllabus Stanford University Autumn 2013 This is a tentative syllabus for CS 106B. All readings come from the Programming Abstractions in C++ textbook. Each unit is roughly 3-4 lectures in length. Near the end of each unit a corresponding homework assignment will be given. De pending on how quickly we finish material, we may end up spending more or less time on each topic. Readings are highly recommended but are not directly evaluated; for example, there are no in-class quizzes about readings. Unit 1 Topics Course Overview C++ Programming Language Basics Functions; Strings; Input/Output Streams Collections, Containers Abstract Data Types (ADTs) Stack/Queue, Vector, Grid, Map, Set, Lexicon Designing Classes Recursion Recursive Algorithms and Data Fractals Recursive Exhaustive Search Backtracking Sorting Algorithm Efficiency; Big-Oh Notation Arrays and Pointers Dynamic Memory Allocation Implementing Collection Classes Hashing Linked Lists Linked Data Structures Binary Trees; Binary Search Trees (BSTs) Graphs Advanced Topics Readings Chapters 1-4 Assignments HW1: Life 2 Chapters 5-6 HW2: Word Ladders, Random Writer 3 Chapters 7-8 HW3: Recursion 4 Chapters 9-10 HW4: Boggle 5 Chapters 11-12, 14 HW5: Priority Queue 6 Chapters 12, 14, 16 HW6: Huffman Encoding 7 Chapters 18-20 HW7: Trailblazer Please note that this is a preliminary rough schedule and is subject to change without...

Words: 268 - Pages: 2

Free Essay

Hello World

...Chapter Three Summary: Ender woke up to a father who was disappointed and Ender could tell he was. But before Ender headed to school an International fleet officer came to the house to have a talk with Ender. Colonial Graff came to inform that Ender nearly beat a kid too death, but wanted him to also inform them that Ender passed and was eligible to enter battle school. Ender was shocked at what has just happened because of the whole monitor incident. Enders parents were very angry with Colonial Graff for just not wanting Ender to needing him after what he has done. Colonial Graff told them it was part of the last test and that he has passed. He said that Ender didn’t just beat him, but he needed to so he can protect him self from harm. So Ender went with him because he felt that it was what he was born for. Reflection: This made me feel angry with Colonial Graff because not only did he convince Ender, but also he lied to him about what his family thinks of him. I think the outcome would have been different if Ender just stayed with his family and moved on too his abnormal life. If I were to predict what will happen next I would say Ender is going to the battle school were he will learn to become the next commander. Question/Answer: Would Colonial Graff really let Ender stay home instead of going to battle school? I believe that he wouldn’t because he said that he would even tell him the...

Words: 406 - Pages: 2

Free Essay

Hello World

...“Do not impose on others what you do not wish for yourself.” – Confucius Applying the Golden Rule - refusing to engage in intentional and avoidable harm - promoting the overall welfare of host country citizens - avoiding violation of host country norms Scenario: Company X in host country allows unsafe practices such as workers climbing high-rise structures without proper harnesses and safety lines or operation of loud machinery without hearing protection (ear plugs). By home country’s safety regulations, these practices are deemed unsafe and clearly violate the golden rule. Switching roles with the workers, you would not want to put your life on the line every time you climb structures to do your job. Or you would not want your hearing to be impaired after years of operating loud machinery without hearing protection. Therefore, there is a clear violation of the Golden Rule. Another scenario will be in the case of exploitation or slave labour. Goodin’s 5 conditions: 1) Imbalance of power between the exploited and the dominant 2) Exploited party needs the resources provided by dominant party to protect his vital interest 3) Dominant party exercises discretionary control over this vital resource 4) Only access to this resource is through the exploitive relationship 5) Resources provided by the exploited are used without adequate compensation By the Golden Rule, it is safe to assume that no one would want to be exploited or be enslaved and be stripped of any...

Words: 278 - Pages: 2

Free Essay

Hello World

...มาตรฐานสินค้าเกษตร มกษ. 4004-2555 THAI AGRICULTURAL STANDARD TAS 4004-2012 ข้าว RICE สานักงานมาตรฐานสินค้าเกษตรและอาหารแห่งชาติ กระทรวงเกษตรและสหกรณ์ ICS 67.080.10 ISBN 978-974-403-674-2 มาตรฐานสินค้าเกษตร มกษ. 4004-2555 THAI AGRICULTURAL STANDARD TAS 4004-2012 ข้าว RICE สานักงานมาตรฐานสินค้าเกษตรและอาหารแห่งชาติ กระทรวงเกษตรและสหกรณ์ 50 ถนนพหลโยธิน เขตจตุจักร กรุงเทพฯ 10900 โทรศัพท์ 0 2561 2277 โทรสาร 0 2561 3357 www.acfs.go.th ประกาศในราชกิจจานุเบกษา ฉบับประกาศและงานทั่วไป เล่ม 129 ตอนพิเศษ 173 ง วันที่ 16 พฤศจิกายน พุทธศักราช 2555 (2) คณะกรรมการวิชาการพิจารณามาตรฐานสินค้าเกษตร เรื่อง ข้าว 1. นางสาวงามชื่น คงเสรี 2. นายธีรยุทธ ว่องลีลาเศรษฐ์ กรมการค้าต่างประเทศ กระทรวงพาณิชย์ 3. นางสาวสุทัศนีย์ ราชเรืองระบิน กรมการค้าภายใน กระทรวงพาณิชย์ 4. นายไพฑูรย์ อุไรรงค์ กรมการข้าว 5. นายวิเศษศักดิ์ ศรีสุริยะธาดา กรมส่งเสริมการเกษตร 6. นางชื่นสุข เมธากุลวัฒน์ สานักงานคณะกรรมการคุ้มครองผู้บริโภค สานักนายกรัฐมนตรี 7. นางสาวอิงอร ปัญญากิจ สานักงานมาตรฐานสินค้าเกษตรและอาหารแห่งชาติ 8. นางสาวกัญญา เชื้อพันธุ์ สานักวิจัยและพัฒนาข้าว กรมการข้าว 9. รองศาสตราจารย์ประภา ศรีพิจิตต์ คณะเกษตร มหาวิทยาลัยเกษตรศาสตร์ 10. นายสุเมธ เหล่าโมราพร สภาหอการค้าแห่งประเทศไทย 11. นายประลอง ภิรมย์อยู่ สมาคมชาวนาไทย 12. นายวิชัย ศรีประเสริฐ สมาคมผู้ส่งออกข้าวไทย 13. นายชาญชัย รักษ์ธนานนท์ สมาคมโรงสีข้าวไทย 14. นายเลิศ บุญสด ศูนย์ข้าวชุมชนจังหวัดสุรินทร์ 15. นางมนทิชา บุญอาพล สานักกาหนดมาตรฐาน สานักงานมาตรฐานสินค้าเกษตรและอาหารแห่งชาติ ประธานกรรมการ กรรมการ กรรมการ กรรมการ กรรมการ...

Words: 853 - Pages: 4

Premium Essay

Hello World

...The main theme in the text ”The Thing around your Neck” must be that outstanding culture clash a lot of hope full immigrants in America are exposed to. Just from the very beginning we experience that the main character Akunna from Nigeria has very high thoughts of going to America. Her family is also very convinced that it is going to be a huge thing for her, they are expecting her to send them presents and they tell her; “In a month, you will have a big car. Soon, a big house. But don’t buy a gun like those Americans” (p. 57 l. 3-4) And this trip she won did turn into a huge thing, - but it resulted in an acknowledgement of not belonging to America and a home journey. The first thing Akunna realizes when she arrives at her uncle’s house is that black and white people do not have the same rights, because they for instance not aloud to use the same hairdresser. The uncle also tells that; “The trick was to understand America, to know that America was give -and- tak. You gave up a lot but you gained a lot too” (p. 58 l. 14-16) You have to put up a lot to obtain something, - maybe even less than you gave up. The uncle, who explains this, is a black man, so it shows that he has just accepted the conditions and the way it is. The inequality between blacks and whites is deep-rooted and universally accepted. When the uncle starts to abuse Akunna we learn that she is a strong person, - she gives up everything an leaves. The fact that Akunna has to work for less money than the other...

Words: 308 - Pages: 2

Free Essay

Hello World

...NAV = Market value of assets - liabilities Shares outstanding HPR(Funds) = Income Dist. +Capital Gain Dist. +Ending NAV-Beginning NAV)Beginning NAV Portfolio Turnover = ($ Sold & Repurchased)Average Daily Assets Tax Efficiency = Tax-Adjusted ReturnPre-Tax Return Average Holding Period = 12 months / (portfolio turnover/100) HPR = (Ending Price-Beginning Price+Cash Divi.)Beginning Price Arithmetic Mean = Simple Average = (R1 + R2 + …+ Rn) /n Geometric Mean = Time-weighted Average Return = 1+R1*…*1+Rn 1n-1 * Account for time value but ignore the size of cash flow * More volatility, the bigger the difference between AM and GM Always quote annual rates APR = Annual % Rate; EAR = Effective annual rate (Takes into account of compounding) EAR = 1+Rate per period 1n-1 1 stdev = 68.2%, 2 = 95.44, 3 = 99.74 Systematic risk – Market Risk, liquidity risk Unsystematic risk – Industry or company specific risk VAR = ε(Ri-R) 2(n-1), Expected Return = E (R ) = E Pi *Ri Coefficient of Variation = Risk Per Unit of Return = St. Dev/ R Stop Loss – Sell if price fall below a certain level Stop buy – Buy if the price rise above a limit Limit Buy – buy some number of shares if and when they may be obtained at or below a target price Limit sell – sell if and when the stock price rises above a specified limit Margin = P*Q-(Loan)P*Q = Equity/Value of Stock Short Margin = P*Q+E-(P1*Q)P1*Q Hedge Fund – Price once a day, active, costly...

Words: 263 - Pages: 2

Free Essay

Hello World

...Elyssa Venturini ARE 345- 601 9 February 2014 Europe- Tasca Brava For this particular region, I chose the restaurant based on a recommendation from my brother. I also have a neighbor who is from Madrid, and Tasca Brava being a authentic Spanish restaurant, I was excited to visit it. I believe you truly experience a restaurant in the evening, which is the time I went. The sun had already set and as you walked into the restaurant the lights were dimmed, with candles lit on each table. Since my brother recommended this restaurant, I suggested he come along with me and give me some pointers. The restaurant looks as if it was converted from a house into a business. We were greeted right as we walked in and seated right at the front of the restaurant. The night we chose, also happened to be First Friday which is held in downtown Raleigh the first Friday of each month, so the restaurant was a little busier than normal. The waitress then gave us the option of sparkling water or tap water. I chose to stick with tap water because that is my preference but I did notice and know from past knowledge that many Europeans drink sparkling or mineral water with their meals. I also noticed a very large wine and beer portion listed on the menu. After we were served our drinks, which my brother and I both just had tap water, the waitress left us to look over the menu and decide on what to order. As I was looking over the menu, I noticed that a lot of the dishes contained seafood. My neighbor...

Words: 689 - Pages: 3

Free Essay

Hello World

...Dell Precision Workstation T7600 Owner's Manual Regulatory Model: D02X Regulatory Type: D02X001 Notes, Cautions, and Warnings NOTE: A NOTE indicates important information that helps you make better use of your computer. CAUTION: A CAUTION indicates either potential damage to hardware or loss of data and tells you how to avoid the problem. WARNING: A WARNING indicates a potential for property damage, personal injury, or death. © 2013 Dell Inc. Trademarks used in this text: Dell™, the DELL logo, Dell Precision™, Precision ON™,ExpressCharge™, Latitude™, Latitude ON™, OptiPlex™, Vostro™, and Wi-Fi Catcher™ are trademarks of Dell Inc. Intel®, Pentium®, Xeon®, Core™, Atom™, Centrino®, and Celeron® are registered trademarks or trademarks of Intel Corporation in the U.S. and other countries. AMD® is a registered trademark and AMD Opteron™, AMD Phenom™, AMD Sempron™, AMD Athlon™, ATI Radeon™, and ATI FirePro™ are trademarks of Advanced Micro Devices, Inc. Microsoft®, Windows®, MS-DOS®, Windows Vista®, the Windows Vista start button, and Office Outlook® are either trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Blu-ray Disc™ is a trademark owned by the Blu-ray Disc Association (BDA) and licensed for use on discs and players. The Bluetooth® word mark is a registered trademark and owned by the Bluetooth® SIG, Inc. and any use of such mark by Dell Inc. is under license. Wi-Fi® is a registered trademark of Wireless...

Words: 10947 - Pages: 44

Free Essay

Hello World

...Alexis Taylor Livingston Ethics Lecture: “Put it in Writing: Planning is Not an Option” On March 8th, Mr. G. Lee Griffin spoke to the college of business, faculty, students, and the community at the annual ethics lecture put on by the College of Business. As always, the ethics lecture was interesting, but Mr. Griffin’s personality of honesty, humility, and sincerity made this lecture stand out among some of the others. Married for 54 years, it was obvious Mr. Griffin was a family man, led by his faith, which he said is what gave him the strength to do everything he accomplished throughout the years. He began the lecture by reviewing Louisiana’s fiscal mess, discussing the 900 million dollars’ worth of revenue needed by July 1st, and how this effects the state and higher education. He mentioned that some of the problems were the centralized version of government and archaic tax structure, but that the most detrimental problem was the lack of leadership and ethics in our state. During his career in the 80’s and 90’s, Mr. Griffin, along with a diverse group of other people, led Louisiana into initiatives that saved the state 2.1 billion dollars. Many of these initiatives were torn down by Jindal, leading us to the state of destruction we are currently in, as one of the worst states in the union and facing a huge budget and higher education crisis. However, he pointed out that it was also the people’s fault, as we haven’t rallied, petitioned, and “gotten angry” like we should...

Words: 623 - Pages: 3