SOFTWARE86 Saturday, 2018-12-15, 8:51 AM
Site menu
Login form
Shopping Cart
Your shopping cart is empty
AdTwirl.com - Mobile Advertising Network
Main » 2013 » October » 28 » How Web Pages Work Adding images&graphics
3:20 PM
How Web Pages Work Adding images&graphics

Adding Images and Graphics

Place any digital image on your page using the following tag:

<img src="name of picture file.extension">

Images on Web pages are either GIF files (pronounced "jiff") or JPG files (pronounced "jay- peg"). Any image will contain one of those extensions, so if you have an image called "logo," it will be labeled either "logo.gif" or "logo.jpg."

Be sure to store the images and graphics that you will be displaying on your Web page in the same folder or directory that you have your "html" file stored into. Otherwise, your computer will have trouble finding the picture you want displayed. Also, be sure to type the picture name exactly how it is saved into that folder -- file names are case sensitive.

Justification

By default, your text and images are left-justified when displayed in your browser, meaning that text and graphics automatically line-up on the left margin. If you want to "center" any portion of your page instead, you can use the following tag:

<center>

You can end the centering with the corresponding closing tag:

</center>

You can also code "divisions," anything from a word to a line of text to an entire page, to be justified a certain way.

Start your division with the division alignment tag, including the justification you wish the text or images to take on (i.e. right, left, center):

Example: <div align="center">

End the division justification alignment with the tag:

</div>

With the information you have just learned in this article, you can begin to create very interesting and eye-catching Web pages. Try creating a Web page or two using the tools and tags we just discussed. If you're eager to have the world view your masterpiece, then skip to the article "Getting Your Page Online" to learn how to publish your new Web page.

THE BIG LIST

Check out of HTML Tags It's a printable, one-page reference to all of the HTML tags presented in this article -- in one easy place and in PDF format for easy printing!

Creating Tables

Currently, one of the most widely used HTML tools for creating artfully arranged Web pages is the table. By mastering tables, you are no longer just "creating" a page, you are "designing" one.

The variety of tables at your disposal is extensive, ranging from a simple box to very complex design layouts. In this article we will discuss table basics, as well as a few tricks and hints for you to experiment with in your quest to design an exciting page that people will love to visit.

Again, as with all information you would like displayed in the browser window, make sure your table is between the <body> and </body> tags in your HTML document. Begin your table with the following tag:

<table>

Each horizontal row in a table begins with the tag:

<tr>

And, each piece of data within the row begins with the tag:

<td>

Consider the following table diagram:

A1  A2

B1  B2

C1 C2

Here we have three rows and two columns.

To code the skeleton of this diagram, the following tags are used in the following order:

<table>    starts the table

<tr>       starts the first row

<td>      starts the first "cell" of data (A1)

</td>    closes the A1 cell

<td>      starts the second cell (A2)

</td>    closes the A2 cell

</tr>     closes the first row

<tr>       starts the second row

<td>      starts the first cell of data in the second row (B1)

</td>    closes the B1 cell

<td>      starts the B2 cell

</td>    closes the B2 cell

</tr>     closes the second row

<tr>       starts the third row

<td>      starts the first cell of data in the third row (C1)

</td>    closes the C1 cell

<td>      starts the C2 cell

</td>    closes the C2 cell

</tr>     closes the third row

</table>  closes the table

Many designers like to indent portions of their tables to make the coding easier to read. An example of this is shown below.

Now we will add data and a border to the skeleton table. A border is the outline of a table. The border tag (border="value") is placed within the initial table tag. You can specify how thick you would like the outline to appear by assigning a particular value (we will assign a value of "1"). It's a good idea to experiment with different values to find out what they look like displayed in the browser. If you do not want a border to show, assign a "0" value.

(Note: Even if you are not planning to have a border appear around your table, it is always best to start with a visible border, at least until you work out any "bugs" that may be affecting the way your table is displayed.)

Type (or cut and paste) the following code and data into your HTML document:

<table border=1> 
<tr><td>A1 </td> 
<td>A2</td> </tr> 
<tr><td>B1 </td> 
<td>B2</td> </tr> 
<tr><td>C1 </td> 
<td>C2</td> </tr> 
</table> 

The table displayed in your browser should look a lot like the diagram shown earlier.

There are many attributes you can assign to a table. What follows is a discussion of the tags that will allow you to format your table in lots of creative ways.

In the next section we'll find out how to change the background color of the table.

Changing the Table Background Color

Change the color of entire table background by using the "bgcolor" tag within the initial "table" tag:

Example: <table bgcolor="yellow">

A colored background can also be assigned to a row or a cell within a table. Just add bgcolor="color" to either the <tr> or <td> tag to color that specific portion of the table.

Example: <tr bgcolor="yellow">

Table Size

The width and height of rows and columns in a table will expand automatically to fit the length of data and/or the space of the browser window. To specify a width and height, include either pixels or percentage values within the starting "table" tag:

Example: <table width=300 height=400>

Width and height can also be specified for an individual data cell, as opposed to the table as a whole. To do this, add width="value" to the <tr> or <td> tag in question.

Again, it's a good idea to simply experiment with pixel and percentage values to find out what they look like in a browser.

Cellpadding

The "cellpadding" tag specifies (in pixels) the amount of space between the edges of each cell and the data inside each cell. Use it within the starting "table" tag:

Example 1: <table border=1 cellpadding=5>

Example 2: <table border=1 cellpadding=15>

Cellspacing

The "cellspacing" tag specifies (in pixels) the amount of space between each cell. Use it within the "table" tag:

Example 1: <table border=1 cellspacing=5>

Example 2: <table border=1 cellspacing=15>

Table Headings

To create a bold and centered "heading" for a column or row within a table, use the <th> tag in place of a <td> tag in the coding for your first row.

Example:

<table border=1>
<tr><th>Column 1</th> 
<th>Column 2</th></tr> 
<tr><td>A</td> 
<td>B</td></tr> 
<tr><td>C</td> 
<td>D</td></tr> 
</table>

In the next section, we'll look at alignment and cell padding.

RESOURCES

  • The HowStuffWorks Big List of HTML Tags - A printable, one-page reference guide that contains all of the common HTML tags on one easy sheet

Alignment and Cell Padding

By default, all cell contents within a table (with the exception of table headings) align vertically centered and left justified. To make the contents of a cell align a different way, apply the following tags within the <td>, <th> or <tr> tags:

For horizontal alignment, values can be left, right, or center:

Example: <tr align="center">

For vertical alignment, values can be top, bottom, or middle:

Example: <td valign="top">

You can also arrange the alignment of your entire table, to decide where it appears on the page. By inserting the tags <align="right"> or <align="left"> within the initial "table" tag, text will wrap around your table wherever it is located. Or, if you would like your table to stand alone without any wrap around text, use "division alignment" tags before and after your entire table.

Cell Spanning

"Spanning" occurs when one cell spans two or more other cells in the table.

For column spanning, the tag <colspan=value> is placed within the <td> tag where it applies. Here is a code example:

<table border=1> 
<tr><td colspan=2>This cell spans over two columns </td> 
<td>This cell spans over one column </td> </tr> 
<tr align="center"> <td>A </td> <td>B </td> <td>C </td> </tr> 
</table>

For row spanning, the tag <rowspan=value> is placed within the <td> tag where it applies. For example:

<table border=1> 
<tr><td rowspan=2>This cell spans over two rows </td> 
<td>A</td><td>B</td></tr><tr><td>C</td><td>D</td> 
</tr> </table>

You can also apply many of the attributes we learned in the last chapter within your table, such as font size, type and color, inserting an image, making a list and adding a link. Just add the appropriate tag to the particular cell you would like to format, right after that cell's tag.

Experiment and practice with the variety of tools and tags you learned in this article. The creative possibilities are endless when it comes to using tables on a Web page. Stack images and borderless colored boxes to create seamless designs, or nest borderless tables within borderless tables, some with color, some without, to create eye-catching layouts. Web page design limits expand with a little imagination, creativity and the use of tables.

THE BIG LIST!

Check out The Big List of HTML Tags. It's a printable, one-page reference to all of the HTML tags presented in this article -- in one easy place and in PDF format for easy printing!

Creating Frames

Some Web designers use frames on their pages, for design purposes and to make a site more user friendly. Frames make it easier to navigate a site without losing your place, so to speak. You know that frames have been used when a portion of a Web page remains stationary and another portion of the same page changes when a link is clicked. To check out a Web page with frames, visit The Birch Aquarium.

In The Birch Aquarium page, the top and the very bottom of the page remain constant, while the middle portion changes according to the chosen link. This page is separated into three frames, meaning that three different HTML documents are being displayed at one time. You can choose how many sections you would like your page divided into, in what manner they will be divided and what HTML documents you want to include within each frame.

First, it is important to plan your page well. Consider the layout in terms of rows and columns. How many horizontal sections, or rows, do you want to display? How many vertical sections, or columns? How much room, either pixel or percentage wise, do you estimate each section will need?

The Frameset DocumentA frameset document is an HTML document that instructs the browser to arrange the Web page content in a particular way. In a frameset document, a "frameset" tag replaces the "body" tag.

You will begin the frameset document in the usual HTML format:

<html><head><title>Title</title></head>

Next, insert the "frameset" tag:

Example: <frameset rows="20%, 80%">

This tag indicates that the page will be divided into two sections, a top and a bottom, as indicated by the two values within the tag. If three rows were needed, you would include three values:

Example: <frameset rows="10%, 50%, 40%">

The number values tell the browser the amount of space, in the browser window, that each section is to occupy. You can use percentage values or pixel values. An "*" can also be used in place of a value, indicating that a particular section can use whatever space is available on the browser window:

Example: <frameset rows="100, *, 50">

This tag states that the page will be divided into three rows. The first (top) frame will occupy 100 pixels of space, the bottom frame will occupy 50 pixels of space and the middle frame will occupy whatever space is left in the browser window.

If your page is to be divided into columns, use the frameset tag for columns along with the number values:

Example: <frameset cols="200, *">

This tag tells the browser to divide the page into two columns. The left column will occupy 200 pixels of space. The right column will occupy whatever space remains in the browser window.

You can also combine frameset rows and frameset columns to create quite complicated layouts. The "nesting" of frameset documents is discussed later in this article.

Adding the Frame Source

If you have not done so already, go ahead and create the HTML documents that will occupy each frame on your page. You can use the HTML documents you created in the previous chapters.

Now you will add to your frameset document the "frame src" tags which will tell the browser which HTML documents to place in each frame:

Example:

<html><head><title>Frameset Test</title></head> <frameset cols="200,*"> 

<frame src="links.htm"> <frame src="information.htm"> </frameset> </html> 

This example shows a frameset document which will divide a Web page into two columns, or frames. In the left frame, 200 pixels of space will display the document "links.htm." The rest of the page, the right column, will display the document "information.htm." You can also see the tags used to close a frameset document:

</frameset>

</html>

Naming Your Frames

Usually, a Web page contains frames in order to show, or link to, additional information located within the same site. The site The Birch Aquarium is an example of frames being used to link to information within the same site. The menu bar of links pulls information into the middle frame of the Web page when a link is clicked, without disturbing the outer frames of the page.

In order to let the browser know which frame to place the linked information into, you must "name" your frames. If you do not specify which frame is to receive the new information, the menu frame of links will be replaced with the linked information itself, destroying the look and purpose of your framed page.

To name a frame, just place a "name" tag within the "frame src" tag in your frameset document. You can give each frame any name you choose.

Example:

<frame src="links.htm" name="menu">

<frame src="information.htm" name="info">

After you name a frame, you can specify which frame you would like the linked information to be placed into by adding the "target" tag, followed by the name of the frame.

Example: <a href="http://www.howstuffworks.com/company.htm" target="info"> Company Information </a>

This tells the browser to display the linked information into the frame named "info."

Saving and Viewing Your Document

Like regular HTML documents, frameset documents are saved with either .htm or .html extensions. Be sure to keep the frameset file in the same folder as the HTML documents that will appear in its frames.

When you open your frameset document in your browser, you should be able to see a divided screen with a separate HTML document within each frame.

In the next section we'll find out how to remove the scroll bars and borders.

Simple page with "nested" frames

Removing Scroll Bars and Borders

If you prefer a "clean" look to your page, free of any scrollbars and borders, you can specify this with tags placed within your "frame src" tag.

Remove scrollbars by adding the tag "scrolling=no."

Example: <frame src="links.htm" scrolling=no>

Remove borders by adding the tag "frameborder=0."

Example: <frame src="links.htm" frameborder=0>

You can also specify the margin width and height of each frame by adding the tags "marginwidth=value" and "marginheight=value." You can make the margins any pixel value you wish. Again, insert these tags within the "frame src" tag.

Multiple Frames

A variety of rows and columns of frames can be combined, creating frameset documents set within other frameset documents. The organization of tags necessary to achieve this effect can be quite complex. See the image at the top of the page for an example of a simple page with "nested" frames.

The frameset document created for this layout is:

<html><head><title>Frame Test</title></head> <frameset rows="20%, 80%"> 

<frameset cols="70%, 30%"> <frame src="logo.htm"> <frame src="address.htm">

</frameset> <frameset cols="85%, 15%> <frame src="info.htm">

<frame src="links.htm"> </frameset> </frameset> <html> 

Broken down, this is what each row of "frame" tags indicates:

<frameset rows="20%, 80%">

There are two rows within this document. The top row occupies 20 percent of the available vertical space. The bottom row occupies 80 percent. In effect, these values specify the height of each row.

<frameset cols="70%, 30%">

There are two columns within the first row. The left column occupies 70 percent of the available horizontal space and the right column occupies 30 percent. In effect, these values specify the width of each column.

<frame src="logo.htm">

The HTM document "logo" will appear in the first column of the first row.

<frame src="address.htm">

The HTM document "address" will appear in the second column of the first row.

</frameset>

The first column frameset is complete.

<frameset cols="85%, 15%>

There are two columns within the second row. The left column occupies 85 percent of the available horizontal space. The right column occupies 15 percent.

<frame src="info.htm">

The HTM document "info" will appear in the first column of the second row.

<frame src="links.htm">

The HTM document "links" will appear in the second column of the second row.

</frameset>

The second column frameset is complete.

</frameset>

The entire frameset is complete.

Frames are a great tool you can use to make your Web page even more eye-catching and dynamic. They allow you to maintain certain aspects of your page even as a user clicks on a link to another part of your site, or to another site entirely. To continue building the Web page of your dreams, check out the next section on images.

THE BIG LIST

Check out The Big List of HTML Tags. It's a printable, one-page reference to all of the HTML tags presented in this article -- in one easy place and in PDF format for easy printing!

Views: 2931 | Added by: jarvis | Tags: Adding Images and Graphics Place an | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
Calendar
«  October 2013  »
SuMoTuWeThFrSa
  12345
6789101112
13141516171819
20212223242526
2728293031
Entries archive
Our poll
Rate my site
Total of answers: 10
Statistics

Total online: 1
Guests: 1
Users: 0
Protected by Copyscape Duplicate Content Detection Tool DMCA.com
Copyright SOFTWARE86 © 2018
Website builderuCoz