learning a new language: html

29
Learning a New Language: HTML Spring 2013 ITD Workshop

Upload: amiel

Post on 14-Feb-2016

27 views

Category:

Documents


0 download

DESCRIPTION

Learning a New Language: HTML. Spring 2013 ITD Workshop. Purpose + Learning objectives. This is an introduction to creating static webpages. Since libraries are increasingly moving toward web content, web content management is a skill that is useful and will make you more marketable. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Learning a New Language: HTML

Learning a New Language: HTMLSpring 2013 ITD Workshop

Page 2: Learning a New Language: HTML

PURPOSE + LEARNING OBJECTIVESThis is an introduction to creating static webpages. Since libraries are increasingly moving toward web content, web content management is a skill that is useful and will make you more marketable.

What you will (hopefully) learn:- What HTML and CSS are- Some important terminology- Coding standards- To read and edit basic HTML code, such as web site

templates

Page 3: Learning a New Language: HTML

SOME THINGS YOU WILL NEED1. A code editor

- For Macintosh:o Text Wrangler

- For Microsoft Windows:o Notepad++

- Any simple-text editor will work (e.g., TextEdit, Notepad)

2. A place to put your web page files on the Internet- I: Drive- Google Sites, Wix, Weeble- Web hosting service provider with domain name

You can also view HTML webpage files locally in your favorite web browser.

Page 4: Learning a New Language: HTML

WHAT IS HTML?HTML = HyperText Markup Language

Tim Berners-Lee, the cool British computer science who created the World Wide Web, was the pioneer of HTML. It became standardized in November 1995 as HTML 2.0.

World Wide Web Consortium (W3C) is the international standards organization for the World Wide Web. W3C maintains the standards for HTML, CSS, XML, among many other languages.

HTML is not a scripting language.

Page 5: Learning a New Language: HTML

HTML AS MARKUP LANGUAGEHTML is written in elements, which are specific to the language itself, and each element typically has three components:

• Tags are enclosed in angle brackets – start tag / end tag• Attributes may be included in the start tag• Content is always placed in between the two tags

<tag attribute=“value”>content</tag>

Empty elements (i.e., elements without content) do not have an end tag and follow this form

<tag attribute=“value” />

Page 6: Learning a New Language: HTML

HELLO_WORLD.HTML<!DOCTYPE html>

<html>

<head>

<title>Hello HTML World</title>

</head>

<body>

<p>Hello world!</p>

</body>

</html>

Page 7: Learning a New Language: HTML

HELLO_WORLD.HTML

Page 8: Learning a New Language: HTML

HEADING TAGSHeading tags are used for titles and subtitles within the content of the webpage. The font size gets smaller as the numbers get bigger.

<body>

<h1>Headings</h1>

<h2>are</h2>

<h3>great</h3>

<h4>for</h4>

<h5>titles</h5>

<h6>and subtitles</h6>

</body>

Page 9: Learning a New Language: HTML

HEADING TAGSWhat is wrong with this picture?

Page 10: Learning a New Language: HTML

HEADING TAGSAll tags come in pairs!

Page 11: Learning a New Language: HTML

TEXTFORMATTING TAGS

<body>

<p><strong>Bold text</strong></p>

<p><em>Emphasized text</em></p>

<p><i>Italic text</i></p>

<p><u>Underlined text</u></p>

<p><del>Struckthrough</del></p>

<p><sup>Superscript</sup></p>

<p><sub>Subscript</sub></p>

</body>

These are some of the commonest text formatting tags that add emphasis to your content.

Page 12: Learning a New Language: HTML

USEFUL ATTRIBUTES

<body>

<h2 align=“left”>Left</h2>

<h2 align=“center”>Centered</h2>

<h2 align=“right”>Right</h2>

</body>

Align attribute allows you to align your content left, right or center. The default is always left. CSS is making this attribute less popular.

Page 13: Learning a New Language: HTML

USEFUL ATTRIBUTESThe title attribute adds a tiny text pop-up to any HTML element. Search engines use this attribute to catalog your webpage as well as increase your search ranking. This attribute is most often used with images.

<body> <h1 title=“Hi!”>Big Title Heading Tag</h1></body>

Page 14: Learning a New Language: HTML

HYPERTEXT REFERENCE (HREF)A hypertext reference (href) is a link tag that directs a user to a valid URL.

<body> <h3>This is a hyperlink:</h3> <br /> <a href=“http://www.nytimes.com/”>NY Times</a></body>

Page 15: Learning a New Language: HTML

HYPERTEXT REFERENCE (HREF)There are five different kinds of URLs you can use in the href attribute:

<a href=“http://www.uiuc.edu”>UIUC</a>

<a href=“../internal/index.html”>Homepage</a>

<a href=“#top”>Go to top</a>

<a href=“mailto:[email protected]?subject=“I need help”>GSLIS Help Desk</a>

<a href=“http://www.uiuc.edu/some_file.zip”>Download this file</a>

Page 16: Learning a New Language: HTML

COMMENTSComments are a way for you to make notes in your HTML code. They are never shown in the web browser. You can also comment out existing code instead of deleting it.

<body> <!–- This is a comment. It is not displayed. --> <p>This text is shown in the web browser.</p></body>

<body> <!–- This comment is temporarily removing this code.

<p>This text is shown in the web browser.</p> --></body>

Page 17: Learning a New Language: HTML

IMAGESAlmost every website uses images, and a website without images is pretty boring.

<body> <p>What is the plural of TARDIS?</p> <img src=“tardis.jpg” /></body>

<body> <a href=“../internal/some_file.html”> <img src=“tardis.jpg” /> </a></body>

Images as link/anchor:

The <img> tag does not have “content”. It is an empty element.

Page 18: Learning a New Language: HTML

IMAGE SOURCE URLSThe source of your images may be either global or local. But it is good practice to make them all local.

src=“tardis.jpg”

src=“imgs/tardis.jpg”

src=“../tardis.jpg”

src=“../imgs/tardis.jpg”

src=“http://www.uiuc.edu/tardis.jpg”

Image is located in the same directory

Image is located in the imgs directory

Image is located “up” a directory

Image is located “up” a directory in another directory called imgs

Image is located at a specific URL elsewhere; this is known as a “global” location

ExplanationSrc Attribute Code

Page 19: Learning a New Language: HTML

ATTRIBUTES OF THE <IMG> TAG

<img src=“tardis.jpg” width=“220” height=“293” />

You can specify the exact width and height of the image.

Two things to note about specifying the dimensions of an image:

• Always use the same ratio of width to height• Always scale downward – bigger images scale down nicely, but

smaller images will become pixelated if you make them much bigger

The alt (alternative) attribute allows you to display alternate text if the image does not load for some reason.

<img src=“tardis.jpg” alt=“The TARDIS” />

Page 20: Learning a New Language: HTML

UNORDERED LISTSThere are different types of lists in HTML.

The unordered list is named so because its items are not numbered. Its items are displayed with bullet points.

<body> <h3>Today’s Task List</h3> <ul> <li>LIS501 homework</li> <li>LIS506 assignment</li> <li>Exercise</li> <li>Do the cleaning</li> </ul></body>

Page 21: Learning a New Language: HTML

ORDERED LISTSThe items of an ordered list are numbered.

<body> <h3>Goals</h3> <ol> <li>Finish school</li> <li>Get a job</li> <li>Make money</li> <li>Get own place</li> </ol></body>

Page 22: Learning a New Language: HTML

LIST ATTRIBUTESFor unordered lists, you can specify which type of bullet point you would like by using the type attribute in the ul tag.

<ul type=“circle”> […] </ul><ul type=“square”> […] </ul><ul type=“disc”> […] </ul>

For ordered lists, you can pick a starting number other than 1 by using the start attribute.

<ol start=“3”> […] </ol>

If you want something other than numbers in the ordered list, you can choose among a few other options like alphabetical or roman numerals.

<ol type=“a”> […] </ol> <ol type=“i”> […] </ol>

<ol type=“A”> […] </ol> <ol type=“I”> […] </ol>

Page 23: Learning a New Language: HTML

TABLES

Note: Do not use tables to structure the entire content of your webpage. This practice is now considered old fashioned.

The HTML element table is composed of rows and columns. This element is a container element, which means it can contain other elements.

<table border=“1”> <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>

Page 24: Learning a New Language: HTML

<DIV> ELEMENTThe <div> element is nothing more than a container. Web developers now use <div> elements to arrange content on webpages instead of <table> elements.

This will become important to you once you’ve learned more CSS.

<div id=“someDIV” name=“someDIV” title=“DIV Element”> <!-- any HTML element can go in here --></div>

<div> elements can be nested in one another.

Page 25: Learning a New Language: HTML

HTML WEB FORM ELEMENTSWeb forms, which are those parts of a webpage where users enter some input, are created in HTML but require some scripting language to interpret the user’s input.

Some examples of web forms:

Credential authentication (e.g., a login screen)

Search functionality on webpages

Web applications

This is outside of the scope of this workshop. Web forms are a more advanced feature of HTML that are only necessary when using a scripting language like PHP.

Page 26: Learning a New Language: HTML

HTML VS. XHTMLXHTML = Extensible HyperText Markup Language

Until version 5.0, HTML was based on Standard Generalized Markup Language (SGML) standards.

XHTML, which is replacing HTML, is based on the Extensible Markup Language (XML) standards.

What this means for you:• Tags remain the same as in HTML 5.0• There are stricter rules in the coding

• Everything must be lowercase• All tags are closed and nested

• There are other more technical differences, too.

Page 27: Learning a New Language: HTML

WHAT IS CSS?CSS = Cascading Style Sheet

CSS files are separate from HTML files, but they are “included in” the HTML file.

It is best practice to use CSS for all formatting in your HTML files. This is the current trend….

Some HTML tags are becoming depreciated because of CSS. A few examples:

- <font>

- Lists: <ul>, <il>, …

- <table> as used for main content structure

- Align attribute and other formatting attributes

Page 28: Learning a New Language: HTML

THE CSS WORKSHOPThe Instructional Technology & Design (ITD) Office occasionally offers a workshop on CSS.

Some other helpful resources:- W3C Tutorials

http://www.w3schools.com/css

- Lynda Tutorials

http://go.illinois.edu/lynda

Page 29: Learning a New Language: HTML

QUESTIONS, COMMENTS, CONCERNS…

Thank you for attending our workshop!

Contact GSLIS Help Desk:[email protected]

Information on this presentationAdam Mann: [email protected]

Steven Smidl : [email protected]

Feedback is always appreciated!http://go.illinois.edu/itdfeedback