Summary

This document is a tutorial on HTML, a markup language used to structure web pages. It covers essential concepts such as tags for formatting, headings, colors, inserting breaks, and adding horizontal rules.

Full Transcript

Introduction to HTML 1 Definitions ▪ W W W – World Wide Web. ▪ HTML – HyperText Markup Language – The Language of Web Pages on the World Wide Web. HTML is a text formatting language. ▪ URL – Uniform Resource Locator. ▪ Browser – A software program which is...

Introduction to HTML 1 Definitions ▪ W W W – World Wide Web. ▪ HTML – HyperText Markup Language – The Language of Web Pages on the World Wide Web. HTML is a text formatting language. ▪ URL – Uniform Resource Locator. ▪ Browser – A software program which is used to show web pages. 2 ▪ “Normal text” surrounded by bracketed tags that tell browsers how to display web pages ▪ Pages end with “.htm” or “.html” ▪ HTML Editor – A word processor that has been specialized to make the writing of HTML documents more effortless. 3 Tags ▪ Codes enclosed in brackets ▪ Usually paired My Web Page ▪ Not case sensitive = = 4 Creating a Basic Starting Document Al al-Bayt University This is what is displayed. 5 Creating a Basic Starting Document ▪ The HEAD of your document point to above window part. The TITLE of your document appears in the very top line of the user’s browser. If the user chooses to “Bookmark” your page or save as a “Favorite”; it is the TITLE that is added to the list. ▪ The text in your TITLE should be as descriptive as possible because this is what many search engines, on the internet, use for indexing your site. 6 Setting Document Properties ▪ Document properties are controlled by attributes of the BODY element. For example, there are color settings for the background color of the page, the document’s text and different states of links. 7 Main Colours 8 16 Basic Colors 9 Color Codes 1. WHITE 1. #FFFFFF 2. BLACK 2. #000000 3. RED 3. #FF0000 4. GREEN 4. #00FF00 5. BLUE 5. #0000FF 6. MAGENTA 6. #FF00FF 7. CYAN 7. #00FFFF 8. YELLOW 8. #FFFF00 9. AQUAMARINE 9. #70DB93 10. BAKER’S CHOCOLATE 10. #5C3317 11. VIOLET 11. #9F5F9F 12. BRASS 12. #B5A642 13. COPPER 13. #B87333 14. PINK 14. #FF6EC7 10 15. ORANGE 15. #FF7F00 Background Color ▪ It is very common to see web pages with their background color set to white or some other colors. ▪ To set your document’s background color, you need to edit the element by adding the BGCOLOR attribute. The following example will display a document with a white background color: 11 TEXT Color ▪ The TEXT attribute is used to control the color of all the normal text in the document. The default color for text is black. The TEXT attribute would be added as follows: In this example the document’s page color is white and the text would be red. 12 Using Image Background ▪ The BODY element also gives you ability of setting an image as the document’s background. ▪ An example of a background image’s HTML code is as follows: 13 Previewing Your Work ▪ Once you have created your basic starting document and set your document properties it is a good idea to save your file. ▪ To save a file, in NotePad, follow these steps: 1. Locate and click on the menu called “File”. 2. Select the option under File Menu labeled “Save As”. 3. In the “File Name” text box, type in the entire name of your file (including the extension name.html). 14 Edit, Save and View Cycle ▪ To preview Your Work, open a web browser and do the following: 1. Click on the menu labeled “File”. 2. Locate the menu option, “Open”. 15 Edit, Save and View Cycle 3. In the “Open” dialog box, click on the “Browse” button and locate your web document. 4. Click “OK” once you have selected your file. ▪ The web browser will load the same document but with the new revisions. This process is the Edit, Save and View Cycle. 16 Headings, Paragraphs, Breaks & Horizontal Rules In this chapter you will add headings to your page, insert paragraphs, add some breaks, and add horizontal rules. Objectives Upon completing this section, you should be able to 1. List and describe the different Heading elements. 2. Use Paragraphs to add text to a document. 3. Insert breaks where necessary. 4. Add a Horizontal Rule. 17 Headings, ▪ Inside the BODY element, heading elements H1 through H6 are generally used for major divisions of the document. Headings are permitted to appear in any order, but you will obtain the best results when your documents are displayed in a browser if you follow these guidelines: 1. H1: should be used as the highest level of heading, H2 as the next highest, and so forth. 2. You should not skip heading levels: e.g., an H3 should not appear after an H1, unless there is an H2 between them. 18 Headings, Example Page Heading 1 Heading 1 Heading 2 Heading 2 Heading 3 Heading 4 Heading 3 Heading 5 Heading 4 Heading 6 Heading 5 Heading 6 19 Paragraphs, ▪ Paragraphs allow you to add text to a document in such a way that it will automatically adjust the end of line to suite the window size of the browser in which it is being displayed. Each line of text will stretch the entire length of the window. 20 Paragraphs, Example Page Heading 1 Paragraph 1,…. Heading 1 Paragraph 1, …. Heading 2 Heading 2 Paragraph 2, …. Paragraph 2,…. Heading 3 Paragraph 3, …. Heading 3 Paragraph 3,…. Heading 4 Paragraph 4, …. Heading 4 Heading 5 Paragraph 4,…. Paragraph 5, …. Heading 6 Heading 5 Paragraph 6, …. Paragraph 5,…. Heading 6 Paragraph 6,…. 21 Break, ▪ Line breaks allow you to decide where the text will break on a line or continue to the end of the window. ▪ A is an empty Element, meaning that it may contain attributes but it does not contain content. ▪ The element does not have a closing tag. 22 Break, Example Page Heading 1 Heading 1 Paragraph 1,…. Paragraph 1, Line 2 Line 3 …. Line 2 Line 3 …. 23 Horizontal Rule, ▪ The element causes the browser to display a horizontal line (rule) in your document. ▪ does not use a closing tag,. 24 Horizontal Rule, Attribute Description Default Value Height of the rule in SIZE 2 pixels pixels Width of the rule in WIDTH pixels or percentage 100% of screen width Draw the rule with a Not set NOSHADE flat look instead of a 3D look (3D look) Aligns the line (Left, ALIGN Center Center, Right) Sets a color for the COLOR Not set rule (IE 3.0 or later) 25 Horizontal Rule, Example Page Heading 1 Heading 1 Paragraph 1,…. Paragraph 1, Line 2 Line 2 Line 3 ______________________ _____ Line 3 26 Character Formatting In this chapter you will learn how to enhance your page with Bold, Italics, and other character formatting options. Objectives Upon completing this section, you should be able to 1. Change the color and size of your text. 2. Use Common Character Formatting Elements. 3. Align your text. 4. Add special characters. 5. Use other character formatting elements. 27 Bold, Italic and other Character Formatting Elements ▪ Two sizes bigger ▪ The size attribute can be set as an absolute value from 1 to 7 or as a relative value using the “+” or “-” sign. Normal text size is 3 (from -2 to +4). ▪ Bold ▪ Italic ▪ Underline ▪ Color = “#RRGGBB” The COLOR attribute of the FONT element. E.g., this text has color ▪ Preformatted Text enclosed by PRE tags is displayed in a mono-spaced font. Spaces and line breaks are supported without additional elements or special characters. 28 Bold, Italic and other Character Formatting Elements ▪ Emphasis Browsers usually display this as italics. ▪ STRONG Browsers display this as bold. ▪ TELETYPE Text is displayed in a mono-spaced font. A typewriter text, e.g. fixed- width font. ▪ Citation represents a document citation (italics). For titles of books, films, etc.Typically displayed in italics(.A Beginner's Guide to HTML) 29 Bold, Italic and other Character Formatting Elements One One Size Larger - Normal – One Size Larger - Normal Size Smaller – Bold - italics - Underlined - One Size Colored Smaller Emphasized - Strong - Tele Bold - italics - Type Underlined - Colored Emphasized - Strong - Tele Type 30 Alignment ▪ Some elements have attributes for alignment (ALIGN) e.g. Headings, Paragraphs and Horizontal Rules. ▪ The Three alignment values are : LEFT, RIGHT, CENTER. ▪ Will center elements. 31 Alignment ▪ Inside a TABLE, alignment can be set for each individual cell. 32 Special Characters & Symbols ▪ These Characters are recognized in HTML as they begin with an ampersand and end with with a semi-colon e.g. &value; The value will either be an entity name or a standard ASCII character number. They are called escape sequences. ▪ The next table represents some of the more commonly used special characters. For a comprehensive listing, visit the W3C’s section on special characters at: http://www.w3.org/MarkUp/HTMLPlus/htmlplus_13.html 33 Special Characters & Symbols Special Entity Special Entity Character Name Character Name Ampersand &amp; & Greater-than &gt; > sign Asterisk &lowast; Less-than sign &lt; < ∗∗ Cent sign &cent; ¢ Non-breaking &nbsp; space Copyright &copy; © Quotation mark &quot; " Fraction one &frac14; Registration &reg; ® qtr ¼ mark Fraction one &frac12; Trademark sign &trade; 34 half ½ Special Characters & Symbols Additional escape sequences support accented characters, such as : &ouml; – a lowercase o with an umlaut: ö &ntilde; – a lowercase n with a tilde: ñ &Egrave; – an uppercase E with a grave accent: È NOTE: Unlike the rest of HTML, the escape sequences are case sensitive. You cannot, for instance, use &LT; instead of &lt;. 35 Additional Character Formatting Elements ▪ strike-through text DEL is used for STRIKE at the latest browsers ▪ places text in a big font ▪ places text in a small font ▪ places text in subscript position ▪ places text in superscript style position 36 Example strike-through text places text in a big font places text in a small font places text in subscript position Normal places text in superscript style position 37 Lists In this chapter you will learn how to create a variety of lists. Objectives Upon completing this section, you should be able to 1. Create an unordered list. 2. Create an ordered list. 3. Create a defined list. 4. Nest Lists. 38 List Elements ▪ HTML supplies several list elements. Most list elements are composed of one or more (List Item) elements. ▪ UL : Unordered List. Items in this list start with a list mark such as a bullet. Browsers will usually change the list mark in nested lists. List item … List item … List item … List item … 39 List Elements ▪ You have the choice of three bullet types: disc(default), circle, square. ▪ These are controlled in Netscape Navigator by the “TYPE” attribute for the element. List item … List item … List item … ▪ List item … ▪ List item … ▪ List item … 40 List Elements ▪ OL: Ordered List. Items in this list are numbered automatically by the browser. List item … List item … List item … 1. List item … 2. List item … 3. List item ▪ You have the choice of setting the TYPE Attribute to one of five numbering styles. 41 List Elements TYPE Numbering Styles 1 Arabic numbers 1,2,3, …… a Lower alpha a, b, c, …… A Upper alpha A, B, C, …… i Lower roman i, ii, iii, …… I Upper roman I, II, III, …… 42 List Elements ▪ You can specify a starting number for an ordered list. List item … List item … text …. List item … 43 List Elements i. List item … ii. List item … Text …. iii. List item … 44 List Elements ▪ DL: Definition List. This kind of list is different from the others. Each item in a DL consists of one or more Definition Terms (DT elements), followed by one or more Definition Description (DD elements). HTML Hyper Text Markup Language DOG A human’s best friend! HTML Hyper Text Markup Language DOG A human’s best friend! 45 Nesting Lists ▪ You can nest lists by inserting a UL, OL, etc., inside a list item (LI). EXample List item … List item … List item … List item … List item … List item … List item … List item … 46 What will be the output? SAFETY TIPS FOR CANOEISTS Be able to swim Wear a life jacket at all times Don't stand up or move around. If canoe tips, Hang on to the canoe Use the canoe for support and Swim to shore Don't overexert yourself Use a bow light at night 47 The output…. 48 SAFETY TIPS FOR CANOEISTS Be able to swim Wear a life jacket at all times Don't stand up or move around. If canoe tips, Hang on to the canoe Use the canoe for support What Be careful will Do not look around be the output? Swim to shore Don't overexert yourself Use a bow light at night 49 The output…. 50 Images In this chapter you will learn about images and how to place images in your pages. Objectives Upon completing this section, you should be able to 1. Add images to your pages. 51 Images ▪ This element defines a graphic image on the page. ▪ Image File (SRC:source): This value will be a URL (location of the image) E.g. http://www.domain.com/dir/file.ext or /dir/file.txt. ▪ Alternate Text (ALT): This is a text field that describes an image or acts as a label. It is displayed when they position the cursor over a graphic image. ▪ Alignment (ALIGN): This allows you to align the image on your page. 52 Images ▪ Width (WIDTH): is the width of the image in pixels. ▪ Height (HEIGHT): is the height of the image in pixels. ▪ Border (BORDER): is for a border around the image, specified in pixels. ▪ HSPACE: is for Horizontal Space on both sides of the image specified in pixels. A setting of 5 will put 5 pixels of invisible space on both sides of the image. ▪ VSPACE: is for Vertical Space on top and bottom of the image specified in pixels. A setting of 5 will put 5 pixels of invisible space above and bellow the image. 53 Some Examples on images 1) 2) 3) 5) < IMG SRC =" jordan.gif“ align="left"> blast blast blast blast blast 54 Anchors, URLs and Image Maps In this chapter you will learn about Uniform Resource Locator, and how to add them as Anchor or Links inside your web pages. Objectives Upon completing this section, you should be able to 1. Insert links into documents. 2. Define Link Types. 3. Define URL. 4. List some commonly used URLs. 5. Plan an Image Map. 55 HOW TO MAKE A LINK 1) The tags used to produce links are the and. The tells where the link should start and the indicates where the link ends. Everything between these two will work as a link. 2) The example below shows how to make the word Here work as a link to yahoo. Click here to go to yahoo. 56 Internal Links ▪ Internal Links : Links can also be created inside large documents to simplify navigation. Today’s world wants to be able to get the information quickly. Internal links can help you meet these goals. 1. Select some text at a place in the document that you would like to create a link to, then add an anchor to link to like this: The Name attribute of an anchor element specifies a location in the document that we link to shortly. All NAME attributes in a document must be unique. 2. Next select the text that you would like to create as a link to the location created above. Go To Book Mark 57 E-Mail (Electronic Mail) E.g. mailto:[email protected] ▪ The type of service is identified as the mail client program. This type of link will launch the users mail client. ▪ The recipient of the message is [email protected] Send me More Information 58 Image Maps ▪ Image maps are images, usually in gif format that have been divided into regions; clicking in a region of the image cause the web surfer to be connected to a new URL. Image maps are graphical form of creating links between pages. ▪ There are two type of image maps: Client side and server side Both types of image maps involve a listing of co-ordinates that define the mapping regions and which URLs those coordinates are associated with. This is known as the map file. 59 Area Shapes Used 60 Tables In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert a table. 2. Explain a table’s attributes. 3. Edit a table. 4. Add a table header. 61 Tables ▪ The element has four sub- elements: 1. Table Row. 2. Table Header. 3. Table Data. 4. Caption. ▪ The table row elements usually contain table header elements or table data elements. 62 Tables Column 1 header Column 2 header Row1, Col1 Row1, Col2 Row2, Col1 Row2, Col2 63 Tables Column 1 Header Column 2 Header Row1, Col1 Row1, Col2 Row2, Col1 Row2, Col2 64 Tables Attributes ▪ BGColor: Some browsers support background colors in a table. ▪ Width: you can specify the table width as an absolute number of pixels or a percentage of the document width. You can set the width for the table cells as well. ▪ Border: You can choose a numerical value for the border width, which specifies the border in pixels. ▪ CellSpacing: Cell Spacing represents the space between cells and is specified in pixels. 65 Table Attributes ▪ CellPadding: Cell Padding is the space between the cell border and the cell contents and is specified in pixels. ▪ Align: tables can have left, right, or center alignment. ▪ Background: Background Image, will be titled in IE3.0 and above. ▪ BorderColor, BorderColorDark. 66 Table Caption ▪ A table caption allows you to specify a line of text that will appear centered above or bellow the table. Label For My Table ▪ The Caption element has one attribute ALIGN that can be either TOP (Above the table) or BOTTOM (below the table). 67 Table Header ▪ Table Data cells are represented by the TD element. Cells can also be TH (Table Header) elements which results in the contents of the table header cells appearing centered and in bold text. 68 Table Data and Table Header Attributes ▪ Colspan: Specifies how many cell columns of the table this cell should span. ▪ Rowspan: Specifies how many cell rows of the table this cell should span. ▪ Align: cell data can have left, right, or center alignment. ▪ Valign: cell data can have top, middle, or bottom alignment. ▪ Width: you can specify the width as an absolute number of pixels or a percentage of the document width. ▪ Height: You can specify the height as an absolute number of pixels or a percentage of the document height. 69 Basic Table Code Spare Parts Stock NumberDescriptionList Price 3476-AB76mm Socket45.00 3478-AB78mm Socket 47.50 3480-AB80mm Socket50.00 70 Table Data and Table Header Attributes Column 1 Header Column 2 Header Row 1 Col 1 Row 2 Col 1 Row 2 Col2 Row 3 Col2 71 Table Data and Table Header Attributes Column 1 Header Column 2 Header Row 1 Col 1 Row 2 Col 2 Row 2 Col 1 Row 3 Col 2 72 Special Things to Note TH, TD and TR should always have end tags. Although the end tags are formally optional, many browsers will mess up the formatting of the table if you omit the end tags. In particular, you should always use end tags if you have a TABLE within a TABLE -- in this situation, the table parser gets hopelessly confused if you don't close your TH, TD and TR elements. A default TABLE has no borders By default, tables are drawn without border lines. You need the BORDER attribute to draw the lines. By default, a table is flush with the left margin TABLEs are plopped over on the left margin. If you want centered tables, You can either: place the table inside a DIV element with attribute ALIGN="center". Most current browsers also supports table alignment, using the ALIGN attribute. Allowed values are "left", "right", or "center", for example:. The values "left" and "right" float the table to the left or right of the page, with text flow allowed around the table. This is entirely equivalent to IMG alignment 73 What will be the output? Page Banner Nav LinksFeature Article Linked Ads News Column 1

Use Quizgecko on...
Browser
Browser