Docsity

HTML And CSS - Design And Build Websites, Manuais, Projetos, Pesquisas de Engenharia Elétrica

Pré-visualização parcial do texto

Baixe HTML And CSS - Design And Build Websites e outras Manuais, Projetos, Pesquisas em PDF para Engenharia Elétrica, somente na Docsity!

Published by John Wiley & Sons, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com

©2011 by John Wiley & Sons, Inc., Indianapolis, Indiana ISBN: 978-1-118-00818- Manufactured in the United States of America Published simultaneously in Canada 10 9 8 7 6 5 4 3 2 1

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, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748- 6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or website may provide or recommendations it may make. Further, readers should be aware that Internet websites listed in this work may have changed or disappeared between when this work was written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.

Library of Congress Control Number: 2011932082

Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

HTML & CSS

DeSign anD buiLD WebSiTeS

For John Wiley & Sons, Inc.

ExECUTIvE EDIToR Carol Long

MARkETINg MANAgER Ashley Zurcher

PRoDUCTIoN MANAgER Tim Tate

PRoDUCTIoN EDIToR Daniel Scribner

vICE PRESIDENT AND ExECUTIvE gRoUP PUBLISHER Richard Swadley

vICE PRESIDENT AND ExECUTIvE PUBLISHER Barry Pruett

ASSoCIATE PUBLISHER Jim Minatel

PRoDUCTIoN CooRDINAToR, CovER katie Crocker

AUTHoR Jon Duckett

CovER DESIgNER Emme Stone

DESIgN AND LAyoUT Jon Duckett Emme Stone

TECHNICAL EDIToR Chris Mills

TECHNICAL REvIEWERS Andy Stone Angela Shimell Donna Watson Martin Callanan Rob Jacoby Tony Berry

PHoTogRAPHy John Stewardson johnstewardson.com

ADDITIoNAL PHoTogRAPHy Hesperian Joe Robertson flickr.com/photos/mindfire Jules Clancy thestonesoup.com kylie gusset gusset.net Michael Stillwell beebo.org

CreDiTS

Introduction

Chapter 1: Structure

Chapter 2: Text

Chapter 3: Lists

Chapter 4: Links

Chapter 5: Images

Chapter 6: Tables

Chapter 7: Forms

Chapter 8: Extra Markup

Chapter 9: Flash, Video & Audio

Chapter 10: Introducing CSS

Chapter 11: Color

Chapter 12: Text

Chapter 13: Boxes

Chapter 14: Lists, Tables & Forms

Chapter 15: Layout

Chapter 16: Images

Chapter 17: HTML5 Layout

Chapter 18: Process & Design

Chapter 19: Practical Information

Index

ConTenTS

3 INTRODUCTION

Firstly, thank you for picking up this

book. It has been written with two very

different types of people in mind:

● Those who want to learn how to design and build websites from scratch

● Anyone who has a website (that may be built using a content management system, blogging software, or an e-commerce platform) and wants more control over the appearance of their pages

The only things you need in order to use this book are a computer with a web browser and a text editor (such as Notepad, which comes with Windows, or TextEdit, which comes with Macs).

INTRODUCTION 4

Introduction pages come at the beginning of each chapter. They introduce the key topics you will learn about.

Reference pages introduce key pieces of HTML & CSS code. The HTML code is shown in blue and CSS code is shown in pink.

Background pages appear on white; they explain the context of the topics covered that are discussed in each chapter.

Diagram and infographics pages are shown on a dark background. They provide a simple, visual reference to topics discussed.

Example pages put together the topics you have learned and demonstrate how they can be applied in each.

Summary pages come at the end of each chapter. They remind you of the key topics that were covered in each chapter.

INTRODUCTION 6

1: htML

We will spend the first chapter looking at how HTML is used to create web pages. You will see that you start by writing down the words you want to appear on your page. You then add tags or elements to the words so that the browser knows what is a heading, where a paragraph begins and ends, and so on.

The rest of this section introduces the tags you have at your disposal to create web pages, grouped into chapters on: text, lists, links, images, tables, forms, video audio and flash, and miscellaneous elements.

I should warn you that the examples in the first nine chapters are not exciting to look at, yet they are the foundation of every web page. The following chapters on CSS will show you how to make your pages look a lot more interesting.

2: css We start this section with a chapter that explains how CSS uses rules to enable you to control the styling and layout of web pages. We then go on to look at the wide variety of CSS properties you can use in your CSS rules. These properties generally fall into one of two categories:

Presentation: How to control things like the color of text, the fonts you want to use and the size of those fonts, how to add background colors to pages (or parts of a page), and how to add background images.

Layout: How to control where the different elements are positioned on the screen. You will also learn several techniques that professionals use to make their pages more attractive.

3: PractIcaL We end up with some helpful information that will assist you in building better websites.

We look at some new tags that will be introduced in HTML5 to help describe the structure of your pages. HTML5 is the latest version of HTML (still under development at the time of writing). Before learning about these elements, you need a good grasp of how CSS is used to control the design of web pages. There is a chapter that talks you through a design process that you might like to follow when creating a new website.

Finally, we end up looking at topics that will help you once you have built your site, such as putting it on the web, search engine optimisation (SEO) and using analytics software to track who comes to your site and what they are looking at.

In order to teach you about creating web pages,

this book is divided into three sections:

the structure of

thIs Book

7 INTRODUCTION

Browsers

People access websites using software called a web browser. Popular examples include Firefox, Internet Explorer, Safari, Chrome, and Opera.

In order to view a web page, users might type a web address into their browser, follow a link from another site, or use a bookmark.

Software manufacturers regularly release new versions of browsers with new features and supporting new additions to languages. It is important, however, to remember that many computer owners will not be running the latest versions of these browsers. Therefore you cannot rely on all visitors to your site being able to use the latest functionality offered in all browsers.

You will learn how to tell which browsers visitors use to access your website in Chapter 19.

weB servers

When you ask your browser for a web page, the request is sent across the Internet to a special computer known as a web server which hosts the website.

Web servers are special computers that are constantly connected to the Internet, and are optimized to send web pages out to people who request them.

Some big companies run their own web servers, but it is more common to use the services of a web hosting company who charge a fee to host your site.

devIces

People are accessing websites on an increasing range of devices including desktop computers, laptops, tablets, and mobile phones. It is important to remember that various devices have different screen sizes and some have faster connections to the web than others.

screen readers

Screen readers are programs that read out the contents of a computer screen to a user. They are commonly used by people with visual impairments.

In the same way that many countries have legislations that require public buildings to be accessible to those with disabilities, many laws have also been passed that require websites be accessible to those with disabilities.

Throughout this book you will see several references to screen readers. These notes will help ensure that the sites you create are accessible to people who use such software.

It is interesting to note that technologies similar to those employed by screen readers are also being used in other areas where people are unable read a screen, such as when they are driving or jogging.

Before we look at the code used to build

websites it is important to consider the

different ways in which people access the web

and clarify some terminology.

how PeoPLe

access the weB

9 INTRODUCTION

On this page you can see examples that demonstrate how the web server that hosts the website you are visiting can be anywhere in the world. It is the DNS servers that tell your browser how to find the website.

● A user in Barcelona visits sony.jp in Tokyo ● A user in New York visits google.com in San Francisco ● A user in Stockholm visits qantas.com.au in Sydney ● A user in Vancouver visits airindia.in in Bangalore

On the right you can see what happens when a web user in England wants to view the website of the Louvre art gallery in France which is located at www.louvre.fr. Firstly, the browser in Cambridge contacts a DNS server in London. The DNS server then tells the browser the location of the web server hosting the site in Paris.

When you visit a website, the web server

hosting that site could be anywhere in the

world. In order for you to find the location of

the web server, your browser will first connect

to a Domain Name System (DNS) server.

how the weB works

PARIS

LONDON

Cambridge

The unique number that the DNS server returns to your computer allows your browser to contact the web server that hosts the website you requested. A web server is a computer that is constantly connected to the web, and is set up especially to send web pages to users.

The web server then sends the page you requested back to your web browser.

When you connect to the web, you do so via an Internet Service Provider (ISP). You type a domain name or web address into your browser to visit a site; for example: google.com , bbc.co.uk , microsoft.com.

Your computer contacts a network of servers called Domain Name System (DNS) servers. These act like phone books; they tell your computer the IP address associated with the requested domain name. An IP address is a number of up to 12 digits separated by periods / full stops. Every device connected to the web has a unique IP address; it is like the phone number for that computer.

X Understanding structure

X Learning about markup

X Tags and elements

Structure

13 STRUCTURE

We come across all kinds of documents

every day of our lives. Newspapers,

insurance forms, shop catalogues... the

list goes on.

Many web pages act like electronic versions of these documents. For example, newspapers show the same stories in print as they do on websites; you can apply for insurance over the web; and stores have online catalogs and e-commerce facilities.

In all kinds of documents, structure is very important in helping readers to understand the messages you are trying to convey and to navigate around the document. So, in order to learn how to write web pages, it is very important to understand how to structure documents. In this chapter you will: ● See how HTML describes the structure of a web page ● Learn how tags or elements are added to your document ● Write your first web page