As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

Similar documents
Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

CSC 121 Computers and Scientific Thinking

Html basics Course Outline

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab.

A HTML document has two sections 1) HEAD section and 2) BODY section A HTML file is saved with.html or.htm extension

A Balanced Introduction to Computer Science, 3/E

HTML and CSS COURSE SYLLABUS

Programmazione Web a.a. 2017/2018 HTML5

11. HTML5 and Future Web Application

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

HTML Images - The <img> Tag and the Src Attribute

Basics of Web Design, 3 rd Edition Instructor Materials Chapter 2 Test Bank

Hyper Text Markup Language HTML: A Tutorial

Chapter 5. Introduction to XHTML: Part 2

By Ryan Stevenson. Guidebook #2 HTML

Cascading Style Sheet

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

A Brief Introduction to HTML

Management Information Systems

introduction to XHTML

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1

Website Development with HTML5, CSS and Bootstrap

Summary 4/5. (contains info about the html)

HTML BEGINNING TAGS. HTML Structure <html> <head> <title> </title> </head> <body> Web page content </body> </html>

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

COPYRIGHTED MATERIAL. Contents. Introduction. Chapter 1: Structuring Documents for the Web 1

CSC Web Technologies, Spring HTML Review

HTML. HTML Evolution

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

HTML What is HTML Hyper Text Markup Language is a computer based language used to create WebPages.

Web Development & Design Foundations with HTML5 & CSS3 Instructor Materials Chapter 2 Test Bank

Creating Web Pages Using HTML

Index. CSS directive, # (octothorpe), intrapage links, 26

Certified HTML5 Developer VS-1029

Deccansoft Software Services

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS

Chapter 1 Self Test. LATIHAN BAB 1. tjetjeprb{at}gmail{dot}com. webdesign/favorites.html :// / / / that houses that information. structure?

Indian Institute of Technology Kharagpur. HTML Part III. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

1.264 Lecture 12. HTML Introduction to FrontPage

Web Technologies - by G. Sreenivasulu Handout - 1 UNIT - I

Introduction to using HTML to design webpages

CIS 228 (Spring, 2012) Final, 5/17/12

Lesson: 6 Database and DBMS an Introduction. Lesson: 7 HTML Advance and features. Types of Questions

Chapter 2 Creating and Editing a Web Page

HTML, beyond the basics

Tables & Lists. Organized Data. R. Scott Granneman. Jans Carton

CSC Web Programming. Introduction to HTML

Web Site Development with HTML/JavaScrip

Document Object Model. Overview

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Certified HTML Designer VS-1027

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

INTRODUCTION TO HTML5! HTML5 Page Structure!

Table-Based Web Pages

Fundamentals of Web Technologies. Agenda: HTML Links 5/22/2017. HTML Links - Hyperlinks HTML Lists

ITNP43: HTML Lecture 3

Markup Language SGML: Standard Generalized Markup Language. HyperText Markup Language (HTML) extensible Markup Language (XML) TeX LaTeX

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

Announcements. Paper due this Wednesday

Computer Programming. Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering IIT Bombay

Final Exam Study Guide

HTML TUTORIAL ONE. Understanding What XHTML is Not

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

CIS 228 (Fall, 2012) Exam 2, 11/20/12

First Name Last Name CS-081 March 23, 2010 Midterm Exam

HTML: The Basics & Block Elements

Web Publishing Basics I

c122jan2714.notebook January 27, 2014

WTAD Text Editors for HTML. Text Editors: Kate HTML. (HyperText Markup Language)

Introduction to Computer Science (I1100) Internet. Chapter 7

Learning Objectives. Review html Learn to write a basic webpage in html Understand what the basic building blocks of html are

Advanced Web Programming C2. Basic Web Technologies

1. The basic building block of an HTML document is called a(n) a. tag. b. element. c. attribute. d. container. Answer: b Page 5

Web Design 101. What is HTML? HTML Tags. Web Browsers. <!DOCTYPE html> <html> <body> <h1>my First Heading</h1> <p>my first paragraph.

WTAD. Unit -1 Introduction to HTML (HyperText Markup Language)

Web Development & Design Foundations with HTML5 & CSS3 Instructor Materials Chapter 2 Test Bank

Chapter 3 Style Sheets: CSS

Building Web Based Application using HTML

Brief Intro to HTML. CITS3403 Agile Web Development. 2018, Semester 1

Web Development & Design Foundations with XHTML. Chapter 2 Key Concepts

ICT IGCSE Practical Revision Presentation Web Authoring

The internet is a worldwide collection of networks that link millions of computers. These links allow the computers to share and send data.

NEW WEBMASTER HTML & CSS FOR BEGINNERS COURSE SYNOPSIS

Web Development and Design Foundations with HTML5 8th Edition

CSS: Lists, Tables and the Box Model

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0

Introduction to Computer Science (I1100) Internet. Chapter 7

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)

Table Basics. The structure of an table

Introduction to HTML & CSS. Instructor: Beck Johnson Week 2

Intro to html. --- define every element, attribute, and entity along with the rules for their use

HTML. Mohammed Alhessi M.Sc. Geomatics Engineering. Internet GIS Technologies كلية اآلداب - قسم الجغرافيا نظم المعلومات الجغرافية

HTML Syllabus Instructor: TBD

Chapter 2:- Introduction to XHTML. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

HTML HTML/XHTML HTML / XHTML HTML HTML: XHTML: (extensible HTML) Loose syntax Few syntactic rules: not enforced by HTML processors.

7300 Warden Avenue, Suite 503 Markham, Ontario Canada L3R 9Z6. Phone: Toll Free: Fax:

Creating Web Pages with SeaMonkey Composer

Transcription:

Extra notes - Client-side Design and Development Dr Nick Hayward HTML - Basics A brief introduction to some of the basics of HTML. Contents Intro <head> element add some metadata define a base address example usage <body> element linking or hyperlinking linking - example usage linking - extras <img> - adding images working with tables tables - example usage working with lists lists - example usage working with forms forms - example usage Intro As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application. <head> element The <head> element is an important, and useful, part of a HTML document's metadata. The <head> element allows us to set metadata for a HTML page, which can either be customised just for that page or replicated as a site-wide implementation. add some metadata Within the <head> section of our web page, we can add numerous additional elements. For example, in addition to CSS information, we may add similar links and code for JavaScript. To link to an external JavaScript file we use the <script> element with required attributes such as type and src. The specific required attributes vary from HTML4 to HTML5. For example, <!-- HTML4 and XHTML --> <script type="text/javascript" src="script.js"></script> <!-- HTML5 --> <script src="script.js"></script> So, in our example, we are now including a JavaScript file for use within our HTML page. This means that we can use

JavaScript functions, which will be available for use with defined IDs and classes in the page. i.e. our defined selectors within the DOM. We may also choose to add such JavaScript references to the foot of a given page instead of the more traditional <head> element. We can also set a title for our page, which will be shown as the page title in a browser tab or window heading. This is simply a <title> element with text added as the element content. define a base address We may also set a default base address for all relative URLs in links within our HTML. This means we could specify the base directory once in the <head> section, and then add the filename or image location relative to the base address, instead of having to write out the base each time as well. You can override this base address at any time in a link, simply by expressing the full, or absolute, URL. Also, you can only add one base address per page, and it must be listed in the <head> element. For example, <base href="/media/images/" target="_blank"> The <base> tag provides a base URL for all links in a document, which can be useful for a large number of links with the same base location, such as an image gallery. It's considered good practice to add this element at the top of the <head> element, so we may then reference it later in the <head> element, if necessary. However, you have to ensure that other links use the full URL, or they will similarly inherit this base URL. Within the <body of our HTML document, we can use it as follows, <img src="image.jpg"> <a href="http://www.flickr.com">flickr</a> Additional metadata for the web page can also be added to the <head> section. We can add author information, a description, keywords to help indexing, revision information, language information and so on. example usage <head> <meta charset="utf-8"> <title>sample...</title> <meta name="description" content="sample metadata"> <meta name="author" content="comp424"> <link href="style.css" rel="stylesheet"> <script src="script.js"></script> </head> <body> element The body element allows us to now start designing and adding some structure for rendering and presenting our web page. We could start outlining our new HTML document by adding some headings. In HTML, these are defined by default as <h1> to <h6>, with 1 the largest all the way to the smallest 6. Headings are meant to be used as headings, and not simply for bold &c. By default, a browser automatically adds a margin before and after each heading. This can then be customised with the app's CSS. We can then add a <p> element to the <body> to allow us to add some simple text within a paragraph. If we then wanted to add a line break, we could add the <br> element. Note that if we were writing strict XHTML, the tag should be <br /> to define it as a void element.

We could also divide sections of our paragraph using a simple <hr> element, which adds a horizontal line or rule to the rendered page. However, it's becoming less common to see such a division. It often implies a rendering division instead of a defined structural divide and break. HTML is also similar to many programming languages in allowing us to clearly and easily comment throughout our document. We can simply add a comment as follows, <!-- comment... --> linking or hyperlinking Linking, or hyperlinking, is a nearly ubiquitous action within web pages and web design. Even within a single page app there will normally be some semblance of links and internal anchors. So, linking within HTML can be considered in a number of different contexts. For example, 1. linking to an external site 2. linking to another page within the same site 3. linking different parts of the same page Within web design and HTML, it is standard to add links to text and images embedded within a page. To add any link we use the anchor element tag, which may be used to achieve any of the different contexts already outlined. So, to link to an external page we need to use the anchor element plus some additional attributes. The default attribute is named href. This is added to the anchor element, and its value should be set to the link required, as demonstrated in our examples. We can use this construction for internal links within our website, and external links to other pages and websites. However, it is better to set the value of the href attribute as relative to the root directory of the installed website or domain name for internal links. Link addresses may also be specified relative to directory depth, which follows the standard Unix practice for traversing directories. We can also add anchors and links for traversing within the same HTML document. To achieve this practice, we need to specify our anchor using a <name> attribute, or preferably <id> in XHTML, and then link to that anchor using the standard anchor element with href attribute. We can also reference anchors from other pages by affixing the name reference to the url for the page itself as a value within a standard 'href' attribute. linking - example usage Links in HTML may be specified as follows,

<!-- external link --> <a href="http://www.google.com/">google</a> <!-- email link --> <a href="mailto:name@email.com">email</a> <!-- internal page link --> <a href="another_page.html">another page</a> <!-- define internal anchor - using name attribute --> <a name="anchor">internal anchor</a> <!-- define internal anchor - using ID attribute --> <a id="anchor">anchor</a> <!-- internal anchor link --> <a href="#anchor">visit internal anchor</a> <!-- internal anchor link on another page --> <a href="/another_page.html#anchor">visit internal anchor</a> <!-- internal anchor link on a page on an external site --> <a href="https://www.test.com/test.html#anchor">visit internal anchor on external site</a> linking - extras We can also add further attributes to the anchor element including, and standard HTML global attributes such as class, id, lang, style, title... anchor element optional attributes such as target, href, name... We've already discussed the href and name attributes, but target is another useful attribute for links. The target attribute specifies where a link should be opened relative to the current viewed browser window. For example, _blank = open the link in a new window or tab (dependent upon new window settings in the browser preferences) _self = same frame as it was clicked (default option) (actual frames used for structuring) _parent = opens within the parent frameset of the current link regardless of frame location _top = opens the link in the same window as the current page If you do not intend to use frames then you should only really concern yourselves with _blank and _top. The others will still work regardless of frames, but you should be aware of the original intent. <img> - adding images By using the HTML element <img> we are able to add a link to an image, a placeholder of sorts, both relative and absolute, within our HTML page. The <img> element also requires attributes to function as commonly expected. The src attribute works like the href attribute in the anchor link element. It allows us to include the filename of the required image, and, where applicable, the location of that file. Our example would look for an image file called image.jpg at the same directory level as the current HTML page. If the image was located elsewhere, our src value would need to reflect this as well unless we had set a base URL for the page. We can also use some optional attributes with our <img> element.

These include, class (specifies css class for styling) id (unique reference id) alt (renders alternative text, defined by the developer, if the image is unable to be loaded) title (will show a tooltip message for the image, again specified by the developer) width & height allow a developer to specify a size for the space to hold an image. The image is resized to fit the given dimensions. If the image is not found, the alt text will be shown in the specified sized space. The dimensions of the sized space will be maintained within the html. We can also nest images within anchor links, thereby turning the image itself into a link. Images can also be used to create image maps, which allow us to designate coordinates within a given image where we may attach links and other actions. Basically, we are making designated areas of an image clickable or interactive with internal or external links. working with tables In HTML, tables allow us to group data in a similar fashion to a spreadsheet or database table. To add a table you need to start with the <table> element. There are then three main elements that act as children to the parent <table> element, allowing us to add column headers, table rows, and individual row cells. To add a row we use the <tr> element. Then we can add a column header using the <th> element. Finally, we can add our table cells, nested within table rows, using the table data <td> element. We can also add the usual styling considerations with CSS. So, we could set a border for our table, a different colour for odd rows, header colour and padding and so on. We can also add a caption to our table, which is normally set as the first child element of our table. We could add further headers as needed, as well. Columns and rows can span multiple cells using either the colspan or rowspan attribute respectively. e.g. `colspan="4"`` And, we can also nest other elements within a table, such as a link or image. tables - example usage <table> <caption>424 - basic test table</caption> <tr> <th>heading 1</th> <th>heading 2</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 2, cell 2</td> </tr> </table> working with lists We can also organise data using lists. In HTML, there are various types of lists available to us. These include, unordered list - <ul> ordered list - <ol> definition list - <dl>

An unordered list is basically the same as using a list of bullet points, with list items represented using the <li> element. The character used to display the bullet point can be customised using css, such as a circle, disc, square... The default symbol is normally a black circle. If we start nesting our unordered lists, then the default list type will now be displayed as a disc. If we nest another unordered list as well, the list type will show a square by default. The list type will then continue as a square for further nested lists. An ordered list works in the same fashion, but instead of using bullet points it marks each list item with a number, which increments by 1 per descending list item. You can also customise the list type for each list item. For example, we could change the number to a roman numeral, or letters, uppercase and lowercase... This can be styled in CSS using the list-style declaration. However, the default will be a numerical list. A definition list allows us to organise a series of items with associated definitions. We may add as many definitions as required, and also nest other html elements within our definition. lists - example usage unordered list <ul>, ordered list <ol>, definition list <dl> <ul> and <ol> contains list items <li> <ul> <li>...</li> </ul> <ol> <li></li> </ol> definition list uses <dt> for the item, and <dd> for the definition <dl> <dt>game 1</dt> <dd>our definition</dd> </dl> working with forms Adding forms to your HTML will often become a common requirement within your website. Forms are used as a way to capture data input by a user, which can then be processed and actioned by the server to return results. To add a form to our webpage, we start by using the <form> element. We now need to add a way for our user to input some data. So, we add an <input> element to our new form. There are various types of input fields and options available, which can be set using a value for the type attribute. Options include, for example text password radio button checkbox submit

forms - example usage <form> Text field: <input type="text" name="textfield" /> </form> References MDN HTML developer guide W3C HTML Attribute Syntax