DOC PREVIEW
Penn CIT 594 - HTML

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

HTMLWeb pages are HTMLExample of HTMLWhy do we care?HTML FilesHTML TagsStructure of an HTML documentText in HTMLWhitespaceListsAttributesTablesExample tableEntitiesApplets in HTMLApplets with parametersThe rest of HTMLThe EndJan 14, 2019HTML2Web pages are HTMLHTML stands for HyperText Markup LanguageWeb pages are plain text files, written in HTMLBrowsers display web pages by interpreting the HTML languageHTML pages may have other languages embedded in themCSS -- Cascading Style SheetsJavaScript -- a programming language vaguely like Java3Example of HTML<!DOCTYPE HTML PUBLIC "-//IETF//DTD W3 HTML 2.0//EN"><html> <head> <title>factorial</title> </head> <body bgcolor="#FFFFFF"> <h1>factorial</h1> <strong>Definition:</strong> The factorial of an integer n &#8805; 0, written n!, is n &times; n-1 &times; ... &times; 2 &times; 1. In particular, 0! = 1. </body></html>4Why do we care?Javadoc comments are written in HTMLIf you know a little HTML, you can write much better-looking commentsApplets are normally embedded in a web pageYou need to know enough HTML to construct a web page with an applet in itYou do not need to know HTML to run an applet from an IDEHTML is the language of the World Wide WebJava is an excellent language for web programming5HTML FilesAn HTML file is a plain 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.html is preferred.htm extensions are used by servers on very old operating systems that can only handle “8+3” names (eight characters, dot, three characters)An HTML file can be created using a simple text editorFormatted text, such as Microsoft Word’s .doc files, cannot be used in HTML files6HTML TagsHTML tags are used to mark up HTML elementsHTML tags are surrounded by angle brackets, < and >Most HTML tags come in pairs, like <b> and </b>The tags in a pair are the start tag and the end tagThe text between the start and end tags is the element contentThe tags act as containers (they contain the element content), and should be properly nestedA few tags, such as <br> (line break) are not nested and have no end tagHTML tags are not case sensitive; <b> means the same as <B>Lowercase tags are preferable7Structure of an HTML documentAn HTML document is contained within <html> tagsIt consists of a <head> and a <body>, in that orderThe <head> typically contains a <title>, which is used as the title of the browser windowAlmost all other content goes in the <body> Hence, a fairly minimal HTMLdocument looks like this: <html> <head> <title>My Title</title> </head> <body> Hello, World! </body></html>8Text in HTMLAnything in the body of an HTML document, unless marked otherwise, is textTo make text italic, surround it with <i> and </i> tagsTo make text boldface, surround it with <b> and </b> tagsYou can put headers in your document with <h1>, <h2>, <h3>, <h4>, <h5>, or <h6> tags (and the corresponding end tag, </h1> through </h6>)<h1> is quite large; <h6> is very smallEach header goes on a line by itself9WhitespaceWhitespace is any non-printing characters (space, tab, newline, and a few others)HTML treats all whitespace as word separators, and automatically flows text from one line to the next, depending on the width of the pageTo group text into paragraphs, with a blank line between paragraphs, enclose each paragraph in <p> and </p> tagsTo force HTML to use whitespace exactly as you wrote it, enclose your text in <pre> and </pre> tags (“pre” stands for “preformatted”)<pre> also uses a monospace font<pre> is handy for displaying programs10ListsTwo of the kinds of lists in HTML are ordered, <ol> to </ol>, and unordered, <ul> to </ul>Ordered lists typically use numbers: 1, 2, 3, ...Unordered lists typically use bullets (•)The elements of a list (either kind) are surrounded by <li> and </li>Example: The four main food groups are:<ul> <li>Sugar</li> <li>Chips</li> <li>Caffeine</li> <li>Chocolate</li></ul>11AttributesSome markup tags may contain attributes of the form name="value" to provide additional informationExample: To have an ordered list with letters A, B, C, ... instead of numbers, use <ol type="A"> to </ol>For lowercase letters, use type="a"For Roman numerals, use type="I"For lowercase Roman numerals, use type="i"In this example, type is an attributeIf a tag has more than one attribute, they can be in any order12TablesTables are used to organize information in two dimensions (rows and columns)A <table> contains one or more table rows, <tr>Each table row contains one or more table data cells, <td>, or table header cells, <th>The difference between <td> and <th> cells is just formatting--text in <th> cells is boldface and centeredEach table row should contain the same number of table cellsTo put borders around every cell, add the attribute border="1" to the <table> start tag13Example table <table border="1"> <tr> <th>Name</th> <th>Phone</th> </tr> <tr> <td>Dick</td> <td>555-1234</td> </tr> <tr> <td>Jane</td> <td>555-2345</td> </tr> <tr> <td>Sally</td> <td>555-3456</td> </tr></table>14EntitiesCertain characters, such as <, have special meaning in HTMLTo put these characters into HTML without any special meaning, we have to use entitiesHere are some of the most common entities:&lt; represents <&gt; represents >&amp; represents &&apos; represents '&quot; represents "&nbsp; represents a “nonbreaking space”--one that HTML does not treat as whitespaceHence, to display if (x < 0) return "negative";you need to write if (x &lt; 0) return &quot;negative&quot;;15Applets in HTMLTo put an applet into an HTML page, you use the <applet> tag, which has three required attributes, code (the class file) and width and height (in pixels)Example:<applet code="MyApplet.class" width=150 height=100> </applet>If your applet contains several classes, you should jar them up; in this case you also need the archive attribute:<applet code="MyApplet.class" archive="MyApplet.jar" width=150 height=100></applet>16Applets with parametersYou can pass parameters to your applet from your HTML page:<applet code="MyApplet.class" width=150 height=100>


View Full Document

Penn CIT 594 - HTML

Documents in this Course
Trees

Trees

17 pages

Searching

Searching

24 pages

Pruning

Pruning

11 pages

Arrays

Arrays

17 pages

Stacks

Stacks

30 pages

Recursion

Recursion

25 pages

Hashing

Hashing

24 pages

Recursion

Recursion

24 pages

Graphs

Graphs

25 pages

Storage

Storage

37 pages

Trees

Trees

21 pages

Arrays

Arrays

24 pages

Hashing

Hashing

24 pages

Recursion

Recursion

25 pages

Graphs

Graphs

23 pages

Graphs

Graphs

25 pages

Stacks

Stacks

25 pages

Recursion

Recursion

25 pages

Quicksort

Quicksort

21 pages

Quicksort

Quicksort

21 pages

Graphs

Graphs

25 pages

Recursion

Recursion

25 pages

Searching

Searching

24 pages

Counting

Counting

20 pages

Recursion

Recursion

24 pages

Pruning

Pruning

11 pages

Graphs

Graphs

25 pages

Load more
Download HTML
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view HTML and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view HTML 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?