HTML Basics for Beginners

 

Tablo reader up chevron

HTML Basics

Welcome to HTML Basics. This workshop leads you

through the basics of Hyper Text Markup Language

(HTML). HTML is the building block for web pages. You

will learn to use HTML to author an HTML page

to display in a web browser.

Objectives:

By the end of this workshop, you will be able to:

ƒ

Use a text editor to author an HTML document.

ƒ

Be able to use basic tags to denote paragraphs, emphasis or special type.

ƒ

Create hyperlinks to other documents.

ƒ

Create an email link.

ƒ

Add images to your document.

ƒ

Use a table for layout.

ƒ

Apply colors to your HTML document.

Prerequisites:

You will need a text editor, such as Notepad and an Internet browser, such as Internet Explorer or

Netscape.

Q:

What is Notepad and where do I get it?

A:

Notepad is the default Windows text editor.

On most Windows systems, click your Start

button and choose Programs then Accessories

. It should be a little blue notebook.

Mac Users:

SimpleText is the default text editor on the Mac. In OSX use TextEdit and change

the following preferences: Select (in the preferences wind

ow) Plain text instead of Rich text and

then select Ignore rich text commands in HTML files. This is very important because if you don't

do this HTML codes probably won't work.

One thing you should avoid using is a word proce

ssor (like Microsoft Word) for authoring your HTML

documents.

What is an html File?

HTML is a format that tells a computer how to

display a web page. The documents themselves are

plain text files with special "tags" or codes th

at a web browser uses to interpret and display

information on your computer screen.

ƒ

HTML stands for Hyper Text Markup Language

ƒ

An HTML file is a text file containing small markup tags

ƒ

The markup tags tell the Web browser how to display the page

ƒ

An HTML file must have an htm or html file extension

Try It?

Open your text editor and type the following text:

<html>

<head>

<title>My First Webpage</title>

</head>

<body>

This is my first homepage. <b>This text is bold</b>

</body>

</html>

Save the file as

mypage.html

. Start your Internet browser. Select

Open

(or Open Page) in the

File

menu of your browser. A dialog box will appear. Select

Browse

(or Choose File) and locate the html

file you just created -

mypage.html

- select it and click

Open

. Now you should see an address in the

loads the rest of the page. Once the entire page is loads it can go back and fill in the images. Without

dimensions, when it runs into an image, the brow

ser has to pause loading the page, load the image,

then continue loading the page.

The chef image would then be:

<img src="graphics/chef.gif"

width="130" height="101"

alt="Smiling Happy Chef">

Open the file

mypage2.html

in your text editor and add code highlighted in bold:

<html>

<head>

<title>My First Webpage</title>

</head>

<body>

<h1 align="center">My First Web page</h1>

<p>Welcome to my first webpage. I am writing this

page using a text editor

and plain ol

d html.</p>

<p>By learning html, I'll be able to create web pages like a pro....<br>

which I am of course.</p>

<!-- Who would have guessed how easy this would be :) -->

<p><img src="graphics/chef.gif" width="130"

height="101" alt="Smiling Happy Chef"

align="center"></p>

<p align="center">This is my Chef</p>

</body>

</html>

Save your page as

mypage5.html

and view it in your browser. To see how your page should look visit

this web page:

http://profdevtrain.austincc.edu/html/mypage5.html

Tables

Tables are defined with the

<table>

tag. A table is divided into rows (with the

<tr>

tag), and each row

is divided into data cells (with the

<td>

tag). The letters td stands for table data, which is the content

of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables,

etc.

This Code

Would Display

<table>

<tr>

<td>row 1, cell 1</td>

<td>row 1, cell 2</td>

</tr>

<tr>

<td>row 2, cell 1</td>

<td>row 2, cell 2</td>

</tr>

</table>

row 1, cell 1

row 1, cell 2

row 2, cell 1

row 2, cell 2

Tables and the Border Attribute

To display a table with borders, you will use the border attribute.

This Code

Would Display

<table

border="1"

>

<tr>

<td>Row 1, cell 1</td>

<td>Row 1, cell 2</td>

</tr>

</table>

row 1, cell 1

row 1, cell 2

and....

This Code

Would Display

<table

border="5"

>

<tr>

<td>Row 1, cell 1</td>

<td>Row 1, cell 2</td>

</tr>

</table>

row 1, cell 1

row 1, cell 2

Open up your text editor. Type in your

<html>, <head>

and

<body>

tags. From here on I will only be

writing what goes between the

<body>

tags. Type in the following:

<table border="1">

<tr>

<td>Tables can be used to layout information</td>

<td>&nbsp; <img src="http://profdevtrain.austincc.edu/html/graphics/chef.gif">&nbsp;

</td>

</tr>

</table>

Save your page as

mytable1.html

and view it in your browser. To see how your page should look

visit this web page:

http://profdevtrain.austincc.edu/html/mytable1.html

Headings in a Table

Headings in a table are defined with the

<th>

tag.

This code

Would Display

<table border="1">

<tr>

<th>Heading</th>

<th>Another Heading</th>

</tr>

<tr>

<td>row 1, cell 1</td>

<td>row 1, cell 2</td>

</tr>

<tr>

<td>row 2, cell 1</td>

<td>row 2, cell 2</td>

</tr>

</table>

Heading

Another Heading

row 1, cell 1

row 1, cell 2

row 2, cell 1

row 2, cell 2

Cell Padding and Spacing

The

<table>

tag has two attributes known as cellspacin

g and cellpadding. Here is a table example

without these properties. Thes

e properties may be used separately or together.

This Code

Would Display

<table border="1">

<tr>

<td>some text</td>

<td>some text</td>

</tr>

<tr>

<td>some text</td>

<td>some text</td>

</tr>

</table>

some text

some text

some text

some text

Cellspacing is the pixel width between the individual data ce

lls in the table (The

thickness of the lines

making the table grid). The default

is zero. If the border is set at 0, the cellspacing lines will be

invisible.

This Code

Would Display

<table border="1"

cellspacing="5"

>

<tr>

<td>some text</td>

<td>some text</td>

</tr><tr>

<td>some text</td>

<td>some text</td>

</tr>

</table>

some text

some text

some text

some text

Cellpadding is the pixel space between the cell co

ntents and the cell border. The default for this

property is also zero. This feature is not used

often, but sometimes comes in handy when you have

your borders turned on and you want the contents to

be away from the border a bit for easy viewing.

Cellpadding is invisible, even with

the border property turned on. Ce

llpadding can be handled in a style

sheet.

This Code

Would Display

<table border="1"

cellpadding="10"

>

<tr>

<td>some text</td>

<td>some text</td>

</tr><tr>

<td>some text</td>

<td>some text</td>

</tr>

</table>

some text

some text

some text

some text

Table Tags

Tag

Description

<table>

Defines a table

<th>

Defines a table header

<tr>

Defines a table row

<td>

Defines a table cell

<caption>

Defines a table caption

<colgroup>

Defines groups of table columns

<col>

Defines the attribute values for one or more columns in a table

Table Size

Table Width

The width attribute can be used to define the width of

your table. It can be de

fined as a fixed width or

a relative width. A fixed

table width is one where the width of

the table is specified in pixels. For

example, this code,

<table width="550">

, will produce a table that is 550 pixels wide. A

relative table

width is specified as a percentage of the width

of the visitor's viewing

window. Hence this code,

<table

width="80%">

, will produce a table that occupies 80 percent of the screen.

This table width is 250 pixels

This table width is 50%

There are arguments in favor of giving your tables a relative width because such table widths yield

pages that work regardless of the visitor's screen resolution. For example, a table width of 100% will

always span the entire

width of the browser window whether

the visitor has a 800x600 display or a

1024x768 display (etc). Your visitor

never needs to scroll horizontally

to read your page, something

that is regarded by most peop

le as being very annoying.

HTML Layout - Using Tables

One very common practice with HTML, is to

use HTML tables to format the layout of an

HTML page.

A part of this page is formatted with two

columns. As you can see on this page, there

is a left column and a right column.

This text is displayed in the left column.

An HTML <table> is used to divide a part of

this Web page into two columns.

The trick is to use a table without borders,

and maybe a little extra cell-padding.

No matter how much text you add to this

page, it will stay inside its column borders.

Try It Out!

Let's put everything you've learned together to crea

te a simple page. Open your text editor and type

the following text:

<html>

<head>

<title>My First Web Page </title>

</head>

<body>

<table width="90%" cellpadding="5" cellspacing="0">

<tr bgcolor="#EDDD9E">

<td width="200" valign="top"><img src="graphics/contact.gif" width="100"

height="100"></td>

<td valign="top"><h1 align="right">Janet Doeson</h1>

<h3 align="right">Technical Specialist</h3></td>

</tr>

<tr>

<td width="200">

<h3>Menu</h3>

<ul>

<li><a href="home.html">Home</a></li>

<li><a href="faq.html">FAQ</a></li>

<li><a href="contact.html">Contact</a></li>

<li><a href="http://www.austincc.edu">Links</a></li>

</ul></td>

<td valign="top"><h2 align="center">Welcome!</h2>

<p>Welcome to my first webpage. I created this webpage without the assistance of a

webpage editor. Just my little text editor and a keen understanding of html.</p>

<p>Look around. Notice I'm able to use paragraphs, lists and headings. You may not

be able to tell, but the layout is done with a table. I'm very clever. </p>

<blockquote>

<p>I always wanted to be somebody, but now I realize I should have been more

specific.</p>

<cite>Lily Tomlin </cite></blockquote></td>

</tr>

</table>

<hr width="90%" align="left">

<address>

Janet Doeson<br>

Technical Specialist<br>

512.555.5555

</address>

<p>Contact me at <a href="mailto:jdoeson@acme.com">jdoeson@acme.com</a></p>

</body>

</html>

Save your page as

my

ta

ble2.html

and view it in your browser. To see how your page should look

visit this web page:

http://profdevtrain.austincc.edu/html/mytable2.html

I have indented some of the HTML code in the

above example. Indenting the code can make

your

HTML document easier to read.

Create Your Own Page

It’s time to create your own page.

Use your text editor to create a page which contains the following:

the required HTML

pag

e codes

link to another web

pa

ge

an email lin

k

a picture/gr

aphic

a list

of information

Save the

file as

xyht

ml_bas

ics.html

where xy is your initials.

3iLogics | Web & Mobile App Development, Digital Marketing Company

Our Creative Custom Solution and IT Services with Quality

Digital Marketing Agency USA & Internet marketing company - 3iLogics

Innovative work Portfolio of Development Designing

Frequently Asked Questions - 3ilogics

Leading Offshore Outsourcing IT Services Company

Careers | Job Vacancy at 3ilogics | IT & Development Jobs

Company Policy and Strategy : A Brief Overview | 3iLogics

Contact Us | 3iLogics USA, Singapore & India Office Address

3iLogics | Web & Mobile App Development, Digital Marketing Company

Hire Angularjs Development company in USA for Web Application

Hire React JS Developers | React JS Development Company USA

Hire Node JS Developers | Node JS Development Company USA

Web Development with ASP .Net Development Company USA, UK

Php Framework Yii Development Company | Hire Yii Developers

CakePHP Development Company USA-UK | 11+ years Experience

Codeigniter Development Company | PHP framework for Web Apps

Java Apps Softwares Development Company | J2EE Services

Custom WordPress Theme Design & Development Company USA

Professional Web Application & Web Development Company USA

Shopify Development Company USA | Shopify Web Design Services

Magento Development Company | Hire Custom theme Developers USA

Hire WooCommerce Website Development Company Services USA

eCommerce Website Development Service Company USA, UK

Hire IOS App Developer for iPhone Application Development

Android App Development Company in USA | Request Quote Now

Phonegap / Cordova App Development Company at Best Price

Ionic Mobile App Development Company | Hybrid App Developers

Best Mobile Application Development company in USA, UK & India

HTML5 Website Design and App Development Company | 3iLogics

Responsive Web Design Agency for eCommerce Website & Apps

Creative Graphic Designing Company USA | Ad logo Designs

Most trusted Web Designing Company USA | Responsive Designs

Custom Web & Mobile application development Service Company

Sitemap Page - 3ilogics A IT Company

1 Search Engine Optimization | Digital Marketing Agency USA

Career Form | Fill Form with attached Resume - 3iLogics

 

 

 

For More help you can Visit : Web Designing Development Company | SEO Agency USA

.

Comment Log in or Join Tablo to comment on this chapter...
~

You might like Digital Prem's other books...