CS3220 Web and Internet Programming HTML and XML Basics

Slides:



Advertisements
Similar presentations
Web Development & Design Foundations with XHTML
Advertisements

HTML: HyperText Markup Language Hello World Welcome to the world!
Teppo Räisänen LIIKE/OAMK 2010
A really fairly simple guide to: mobile browser-based application development (part 1) Chris Greenhalgh G54UBI / Chris Greenhalgh
 2003 Prentice Hall, Inc. All rights reserved. Chapter 4 - Introduction to XHTML: Part 1 Outline 4.1 Introduction 4.2 Editing XHTML 4.3 First XHTML Example.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
 2004 Prentice Hall, Inc. All rights reserved. Introduction to XHTML: Part 1.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 4 - Introduction to XHTML: Part 1 Outline 4.1 Introduction 4.2 Editing XHTML 4.3 First XHTML Example.
Chapter 2 Introduction to HTML5 Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Chapter 14 Introduction to HTML
Basics of HTML Shashanka Rao. Learning Objectives 1. HTML Overview 2. Head, Body, Title and Meta Elements 3.Heading, Paragraph Elements and Special Characters.
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
1 Outline 3.1 Introduction 3.2 Editing HTML 3.3 First HTML Example 3.4 W3C HTML Validation Service 3.5 Headers 3.6 Linking 3.7 Images 3.8 Special Characters.
ULI101 – XHTML Basics (Part II) What is Markup Language? XHTML vs. HTML General XHTML Rules Block Level XHTML Tags XHTML Validation.
HTML HTML stands for "Hyper Text Mark-up Language“. Technically, HTML is not a programming language, but rather a markup language. Used to create web pages.
HTML (HyperText Markup Language)
HTML history, Tags, Element. HTML: HyperText Markup Language Hello World Welcome to the world!
1 HTML intro The development of HTMLThe development of HTML The transition from HTML to XHTMLThe transition from HTML to XHTML XHTML syntax, tags, and.
CS134 Web Design & Development Creating a Basic Web Page Exerted from Mehmud Abliz slides.
HTML Hyper-Text Markup Language or tags. HTML is a “tag” language Open and close tags Tags identified with angle brackets Basic format content (shorthand.
INTRODUCTION. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
HTML: Hyptertext Markup Language Doman’s Sections.
Ali Alshowaish. What is HTML? HTML stands for Hyper Text Markup Language Specifically created to make World Wide Web pages Web authoring software language.
Introduction to HTML Xiangming Mu 9/23/ Learning Objectives Understand basic HTML tags and their attributes Learn to create a simple HTML page.
Web Development & Design Foundations with XHTML Chapter 2 HTML/XHTML Basics.
HTML – Organizing Page Content. HTML Images img tag Required attribute: src
WEB DESIGN AND PROGRAMMING Introduction to XHTML.
HTML – Organizing Page Content. HTML Images img tag Required attribute: src
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 2 Key Concepts 1 Copyright © Terry Felke-Morris.
Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.
XP Review 1 New Perspectives on JavaScript, Comprehensive1 Introducing HTML and XHTML Creating Web Pages with HTML.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
INT222 – Internet Fundamentals
Tutorial #1 Using HTML to Create Web Pages. HTML, XHTML, and CSS HTML – HyperText Markup Language The tags the browser uses to define the content of the.
TNPW1 Ing. Jiří Štěpánek.  Tags  Marks for elements ▪ Pair ▪ Start and end tag ( Paragraph text ) ▪ Single ▪ Only start tag, according to XHTML 1.0.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 1 Using HTML to Create Web Pages.
The Internet Day 4, 9/8/11 Getting on the Internet
HTML Structure & syntax
Basic concepts of web design
Introduction to HTML5.
HTML CS 4640 Programming Languages for Web Applications
HTML Basics.
Section 4.1 Section 4.2 Format HTML tags Identify HTML guidelines
CGS 3066: Lecture 2 Web Development and HTML5
CIS 228 The Internet 9/20/11 XHTML 1.0.
Creating a Well-Formed Valid Document
Web Development & Design Foundations with HTML5 8th Edition
LAB Work 01 MBA 61062: E-Commerce
HTML: HyperText Markup Language
CGS 3066: Web Programming and Design Spring 2016
Chapter 1: Introduction to XHTML (part 1)
Chapter 4 - Introduction to XHTML: Part 1
COMPUTING FUNDAMENTALS
Basic HTML Document Structure
HTML5 Level I Session II Chapter 3 - How to Use HTML to Structure a Web Page
CGS 3066: Lecture 2 Web Development and HTML5
HTML ELEMENTS Ms. Olifer.
Introduction to HTML- Basics
Introduction to HTML.
CS3220 Web and Internet Programming HTML and XML Basics
WWW/HTML Basics.
WWW/HTML Basics CS 4173.
Lesson 2: HTML5 Coding.
Digging in a little deeper
HTML CS 4640 Programming Languages for Web Applications
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

CS3220 Web and Internet Programming HTML and XML Basics Chengyu Sun California State University, Los Angeles

HTML HyperText Markup Language, the language for creating web pages <head><title>CS3220</title></head> <body> <h2>Welcome to CS3220!</h2> </body> </html>

XML Extensible Markup Language, the general-purposed language to describe structured data <user> <name>Chengyu Sun</name> <office>ET A317</office> <phone>(323) 343-6697</phone> </user>

A Brief History of HTML and XML Early markup languages (1960s to 1980s) TeX/LaTex (1978) SGML (early 1980s) HTML (1991) XML (1998) HTML 4.01 (1999) XHTML 1.0 (2000) HTML 5 (2014)

A LaTex Example http://spot.colorado.edu/~sitelic/samplecode/latex/ASimpleTemplate.html

An XML Example Declaration Tag and attribute Element and content <?xml version="1.0" encoding="UTF-8"?> <user type=“faculty”> <name>Chengyu Sun</name> <office>ET A317</office> <phone ext=“6697” /> </user> Declaration Tag and attribute Element and content Opening (start) tag and closing (end) tag Empty element

NOT Well-Formed XML <?xml version="1.0" encoding="UTF-8"?> <users> <user type=“faculty”> <name>Chengyu Sun</Name> <office>ET A317</office> <phone ext=“6697”> </user> <name>Raj Pamula</name> <office>E&T A324</office> </users>

How About Well-formedness of HTML? HTML (not XHTML) is more forgiving Tag and attribute names are case-insensitive Some tags are self closing, e.g. <meta> and <br> Some closing tags are optional, e.g. <p>, and even <html>, <head>, <body>

Validity and Namespace of XML Issues of being a general-purposed markup language How can we decide a particular tag/attribute is valid? How can we avoid name conflicts, i.e. different people/applications/specification using the same tag name for different purposes?

Specify XML Grammar – DTD Document Type Definition DTD Example - http://www.w3schools.com/xml/xml_dtd_examples.asp

Reference DTD in XML … Reference a “private” DTD (DTD intended for use by a single author or a group of authors) <!DOCTYPE root_element SYSTEM "DTD_location"> Reference a “public” DTD <!DOCTYPE root_element PUBLIC "DTD_name" "DTD_location">

… Reference DTD in XML Example <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE user SYSTEM “mydtd.dtd”> <user type=“faculty”> <name>Chengyu Sun</name> <office>ET A317</office> <phone ext=“6697” /> </user> More at http://xmlwriter.net/xml_guide/doctype_declaration.shtml

Specify XML Grammar – XML Schema XML Schema Definition (XSD) Support data types Allow more detailed constraints Use XML syntax XSD Example - http://www.w3schools.com/xml/schema_intro.asp

XML Schema Example: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” id="WebApp_ID" version="3.0"> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> …. </web-app>

XML Namespace Each XML namespace is identified by a URI (Uniform Resource Identifier) Difference between URI and URL?? A namespace can be referenced as xmlns:prefix="URI”, and the elements/attributes defined in the namespace can then be used as prefix:element or prefix:attribute xmlns=“URI” defines a default namespace for which the prefix can be omitted

Developing Web Pages Create HTML pages Validate HTML pages Upload HTML pages to a server

HTML Editors Text editors, e.g. Notepad WYSIWYG editors, e.g. CKEditor in CSNS Text editors for developers, e.g. Notepad++ and Atom; IDEs like Eclipse and Visual Studio Professional tools for web designers like Adobe Dreamweaver

Use Eclipse to Create HTML Pages Create a Static Web Project Create HTML files in the WebContent folder Locate the HTML files on disk View the HTML files in a browser

Structure of an HTML Page DOCTYPE Declaration <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>CS3220</title> </head> <body> <h2>CS3220</h2> </body> </html> Head Section <html> Root Element Body Section

DOCTYPE Declaration Indicates which version of HTML/XHTML the document uses Common DOCTYPE declarations HTML 4.01 Strict HTML 4.01 Transitional XHTML 1.0 Strict XHTML 1.0 Transitional HTML5

<head> Section Contain elements that provide information about the web page rather than the content of the page <title> - title for the browser tab <meta> - metadata about the page <link> - mostly used for style sheets <script> - for JavaScript

Character Set and Encoding Character set is, well, a set of characters, e.g. Unicode Encoding is the way how characters are represented in a computer as a sequence of 0’s and 1’s, e.g. UTF-8 Change default HTML encoding in Eclipse

<body> Section Contain elements that will be displayed in the browser window

Headings and Paragraphs <h1>, <h2>, …, <h6> <p> A block element always starts on a new line and can contain other elements

Other Commonly Used Block Elements … <pre> - preformatted text, i.e. whitespaces and line breaks are preserved <blockquote> <div> - a general-purposed block element used to structure a page into logical divisions that can be formatted, positioned, and/or processed.

… Other Commonly Used Block Elements <ul> - unordered list <ol> - ordered list <li> - list item

Common Inline Elements <i> - italic, <b> - bold, <u> - underlined <em> - emphasized <strong> - strongly emphasized <code> - for computer code <span> - a general-purposed inline element (like an inline version of <div>) <br> - line break

Anchor <a> Creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL. <a href=“http://www.calstatela.edu”>CSULA</a> URL

Absolute and Relative URLs Absolute URL http://www.calstatela.edu/logo.gif Relative URL logo.gif img/logo.gif /logo.gif /img/logo.gif ./logo.gif ../logo.gif ../img/log.gif

Link to Locations within a Page <a href=“#section1”>Introduction</a> <a href=“#section2”>HTML Basics</a> … <h2 id=“section1”>Introduction</h2> <p>…</p> <h2 id=“section2”>HTML Basics</h2>

Some Core Attributes Attributes that are common to all HTML elements id: a unique identifier for the element title: additional information about the element class: CSS class style: inline CSS style More at https://www.w3.org/TR/2012/WD-html-markup-20121011/global-attributes.html

Other Uses of <a> Email link <a href="mailto:csun@calstatela.edu">Email Me</a> Phone link <a href=“tel:+1-323-343-6697">Call me</a>

Image <img> Attributes src: URL to the image alt: alternate text if the image cannot be displayed height and width in pixels JPEG, GIF, and PNG images are supported by most browsers Clickable image??

HTML Special Characters (HTML Entities) White space:   <: < >: > &: & More at http://www.w3schools.com/html/html_entities.asp

XML/HTML Comments <!-- This is a single-line comment. --> <!-- This is a multi-line comment. --> The syntax for comments is the same for both XML and HTML

HTML Validators Automatic validation in HTML editor, e.g. Eclipse Customize the Problems view in Eclipse Browser plugins like HTML Validator and Validity Usually do not validate local files Online validator - https://validator.w3.org/

File Transfer Tools Usually need to support SFTP (Secure File Transfer Protocol) and/or SCP (Secure Copy) FileZilla Client - https://filezilla-project.org/ WinSCP - https://winscp.net/eng/download.php

Use of CS3 Server CS3 Server Information - http://csns.calstatela.edu/wiki/content/cysun/course_materials/cs3 See the [Apache/PHP] section