8375 1 HTML5 Lesson1 Sampler1
8375 1 HTML5 Lesson1 Sampler1
HTML5 Application
Development Fundamentals
COURSEWARE 8375‑1 EXAM 98‑375
y
nl
O
n
io
at
lu
va
E
r
Fo
Microsoft® Technology Associate Series
Lesson 1:
y
Understanding Core Concepts
nl
Lesson Objectives
O
In this lesson, you will learn about the requirements for creating a basic HTML web page including the DOCTYPE
declaration, Character Encoding, and the basic structure of the html, head, and body tags. In addition, the
correct syntax of elements and attributes are explored using the online W3Schools.com reference for HTML
n
tags and attributes including new HTML5 tags and deprecated tags. Finally, you will learn about the W3C
organization and the transition that is currently taking place from HTML 4.01 specification to HTML 5. JavaScript
io
and CSS were also explained because the MTA 98-375 HTML5 Application Development Fundamentals exam
focuses on web applications that are capable of running on touch-enabled screens using HTML5, JavaScript,
and CSS. Upon completion of this lesson, you should be able to:
create the basic structure and elements needed for an HTML5 page
at
understand how to use an online reference to find available tags and attributes
understand how to nest elements
understand that the MTA 98-375 exam will cover HTML5, JavaScript, and CSS
lu
understand that there are many HTML editors and developer tools that can be used to develop HTML5
applications
create tags and attributes using the correct syntax
va
use the DOCTYPE declaration for HTML5
use a meta tag to specify the type of character encoding that will be used
use entities to display content that includes special characters
E
y
HTML5 is the latest standard for Hypertext Markup Language (HTML) that is used in web design and
development. HTML is the markup language used to construct web pages and should not be confused with
nl
programming languages like Visual Basic, Java, C++, C# and many others. HTML by itself does not have the
ability to perform complex calculations and make decisions based on user input. JavaScript has become the
standard language used to accomplish complex calculations and make decisions but still uses HTML to
O
display and format the input and output. The previous version of HTML, which is HTML 4.01, has been around
since 1999 and was set as a standard by an international community called the World Wide Web Consortium
or W3C.
n
Although HTML5 is HTML, it has been developed by the W3C to work directly with CSS3 and JavaScript to
allow developers and designers the ability to create web applications that will also work on touch-enabled
devices and easily adapt to smaller screens. In addition HTML5, CSS3, and JavaScript are all considered
io
platform-independent technologies and therefore can run regardless of the operating system as long as the
operating system has a web browser. For example, Windows 8 and Windows Phone 8 have the Internet
Explorer browser, Mac OS and iPhone have the Safari browser, Linux OS has the Firefox browser and Android
at
phones have the Google Chrome browser. Each of these browsers is capable of running HTML5, CSS3, and
JavaScript. However, browsers also have versions, so as long as the browser being used is the newest version
then most HTML5 and CSS3 features will be supported. The reason that some features are not supported is
due to the fact that the W3C has not completely finalized HTML5 specifications but plans to release a stable
lu
HTML5 version by the end of 2014. If you would like to know how well your browser supports HTML5 you
can visit html5test.com which gives a score and shows supported and unsupported features. The
html5readiness.com website has a visual representation of supported HTML5 and CSS3 features by browser
va
and also shows how the browsers have adapted each year. Finally, the caniuse.com website provides a matrix
that includes almost all desktop and mobile browsers and can be filtered by browser type or category and
also shows past, current and future browser support by browser version.
E
r
Fo
y
HTML5 including frequently asked
questions. This work is attributed to
the W3C.
nl
O
CSS and CSS3
n
Cascading Style Sheets (CSS) is used with HTML to separate style from content and currently the W3C latest
standard is CSS3. The W3C created the CSS standard so that styling could be separated from content and
therefore would allow designers and developers the ability to modify styles across the entire site in a much
io
more efficient way. For example CSS rules are created that allow elements of the same type, name, or class
to be styled as needed across several web pages at once. CSS is used for many things some of which are
styling text fonts and colors, styling content, and layout out of pages. The new CSS3 standard has added the
at
ability to adapt and readjust layouts from a desktop screen to a much smaller mobile interface without having
to recode or perform many complex calculations to adjust the layout. In addition CSS3, has added several
new modules for working with text effects, transformations, animations, rounded corners, gradients, borders,
backgrounds, images and more.
lu
Just like HTML5, CSS3 is still under development by the W3C but most current browsers still support CSS3
features. The CSS3 standard is also backwards-compatible with earlier versions of CSS so there is no need to
va
that can perform complex calculations, make decisions based on conditional statements, and respond to
events and user input. The W3C chose JavaScript because it is a language that is platform-independent and
can execute as long as there is a web browser. So you might be asking yourself “What is the difference
between JavaScript and Java?” Java is a full Object Oriented Programming language that must be compiled
r
into machine language with a development tool like Visual Studio before it can execute. JavaScript was
Fo
created based on the Java language, but is primarily intended to run or execute from within the client’s web
browser and therefore JavaScript is a much smaller and less complex programming language. In addition,
the JavaScript code that is executed by a browser is considered client-side processing which differs from other
web based programming languages like PHP and ASP.NET that are considered server-side processing and
require a web server to execute.
y
construction of a web page which is often referred to as an HTML document. HTML markup tags are often
referred to as just HTML tags and almost always are used in pairs meaning that there will be a start tag and
nl
end tag. The tag name is enclosed in angle brackets and the start tag differs from the end tag in that the
end tag also includes a forward slash immediately before the tag name. For example, take a look at the
sample code below that shows the basic tag syntax and syntax for the paragraph tag element.
O
Basic Tag Syntax: <tagname>
Content Goes Here!
</tagname>
n
This is where the Paragraph text is placed
</p>
io
The basic tag syntax that is used consists of start tags and end tags like the example above and the tag name
that is enclosed in angle brackets must be the same in the start and end tags. The tag name is not case
sensitive and may be either upper or lower case, but most developers and editors will use all lower case
letters for tag names. Although most tags will have start and end tags there are some tags that only require
at
a single tag called empty tags. For example, the break tag is used to move content down the HTML document
one line. Since the break tag is just used to move the content down one line there is no need for an end tag
because we do not have to put content inside of the break tag as it will just move any content following the
lu
Notice that the empty tag consists of the tag name wrapped in angle brackets, but the tag name is also
followed by a space and forward slash indicating that the empty tag will not have an end tag. The <hr> tag
called the horizontal row and the <img> image tag are examples of two other empty tags that are commonly
r
y
Empty Tag Elements:
Break Element: <br />
nl
Horizontal Row Element: <hr />
HTML tags can also be nested inside of each other. In the example code below you will see that there is a
paragraph that contains text and the word Content is bold and the word Paragraph has been italicized.
O
Nesting Elements:
<p>This <b>Content</b> is also part of the <i>Paragraph</i> Element</p>
When nesting tags you must close the inner tags before closing the outer tags that will create a sandwich
n
effect with the tags and their content. Remember that the space between tags, indents, or breaking down to
the next line will not affect the display of your web page so therefore when nesting tags you should put inner
io
nested tags on the next line and indent them so that it is visually easier to read the code. For example, the
following two sections of code will produce the same results in the browser, but as you can see the spaced
and indented code is much easier to read. Spaces and indents in your markup also make it easier to tell which
elements are nested inside of other elements allowing the developer to identify if tags were properly nested
at
and closed in the correct order.
<html>
<head>
<title>
Title in Browser Tab
</title>
</head>
E
<body>
This will be the text displayed on the web page!
</body>
</html>
r
Fo
Deprecated Elements
As new standards are released from the W3C there are also elements that will no longer be supported by the
W3C standards and therefore browsers will eventually stop displaying deprecated elements. For example, the
W3C has deprecated the <font> tag that was used for coloring and styling fonts, because they recommend
the styling of text should be done using CSS. Although the W3C has deprecated an element it doesn’t
necessarily mean that the element will not display by the browser. Many current browsers still recognize
y
deprecated tags, but eventually they will not display and therefore it is recommended that you no longer use
deprecated tags in your markup. The process of a browser reading and displaying an HTML tag is called
nl
rendering. Since there are so many browser types you can imagine that some browsers may render or display
the HTML markup in a different way and is based on how the development team interpreted the HTML
markup when creating the browser software.
O
Exercise 1-1: Explore the HTML Tag Reference Online
1. Open a web browser on your computer and type in the following URL to your address bar.
http://www.w3schools.com/tags/default.asp
n
2. Notice that the HTML Reference is also labeled HTML5 Compliant and therefore you know that you are
looking at a current and updated list.
3.
io
Scroll down the list and notice that all tags and tag descriptions in red are labeled as “Not supported in
HTML5. Use … instead”. These tags are considered deprecated tags.
at
4. Also notice that the HTML5 logo is next to the tag name indicating that the tag is new to HTML5 and
therefore you should check for support of that tag to ensure that the browsers that you recommend to
use for your site currently support that tag.
lu
Attributes
Objective 1.1 Understand the platform fundamentals
E
should be immediately followed by an equals and the value of the attribute wrapped in double quotes like
Fo
Attribute Syntax
<tagname attribute_name=”value of attribute”>
Content
</tagname>
Each HTML element has a list of attributes that can only be used by that specific element, but there is also a
list of global attributes that apply to all HTML elements. Just like HTML tags, HTML attributes and their values
are not case sensitive but the W3C recommends using lowercase for all HTML tags, attributes, and their
values. Look at the paragraph below and notice that the attribute named id is placed in the paragraph start
tag followed by a space. Also immediately following the attribute is the equals sign with the value
top_paragraph wrapped in quotes.
<p id=”top_paragraph”>This is the content of the paragraph</p>
y
Common Global Attributes
nl
HTML
Description
Attributes
O
Specifies a unique identifier that the element will be referenced by in JavaScript, CSS, and
id
the HTML document. Note: New in HTML5, all elements can have an id attribute.
Specifies a class that the element will be referenced by in JavaScript, CSS, and the HTML
document. The class attribute is similar to a group that the element belongs to and
n
class multiple elements can be assigned to the same class. Classes are most often used to style
several elements by assigning the style properties once to the class rather than multiple
style
io
times if you were to assign the style to the id attribute.
The style attribute is a way of embedding CSS style properties inside of the HTML
element. This is most often done to override styles that are set globally to the HTML
at
document or to a class that the element belongs to.
HTML5 Description
Attributes
The contenteditable attribute specifies if the element is editable directly by the user
va
through the browser. This attribute accepts the two values of true and false. For
contenteditable
example, if you set the contenteditable attribute to true for the paragraph element
then the content in the paragraph will be made editable by the user.
The spellcheck attribute specifies if the element can be checked by the browser for
E
spelling and grammar. The spellcheck attribute can only be set in the text value of
spellcheck
input tags except passwords, the content text of a <textarea> element, and elements
like a paragraph that have the contenteditable attribute set to true.
r
The hidden attribute can be used to remove an element from displaying until the
hidden
hidden attribute is taken away from the element through JavaScript.
Fo
The draggable attribute is used to specify if the element can be dragged for the
draggable purpose of drag and drop. This attribute accepts the three values of true, false, and
auto. If set to auto the property will be set to the browsers default setting.
2. Scroll down the alphabetical list and find the <img> tag that is used to define an image. Click the tag
y
name and you will be taken to the image tag reference page.
nl
3. Scroll down the image tag reference page to the Attributes section where you will find a table of
attributes that are used with the attribute name, potential values, and a description of the attribute.
Notice in the description for the align attribute for the image tag the first sentence of text explains that
O
the align attribute is not supported in HTML5 and that it was deprecated in the HTML 4.01 standard.
4. If you would like to learn more about a specific attribute or see a working example of the tag and the
attribute being used click on the attribute name and a page will load showing additional information for
the specific attribute that was clicked on.
n
5. After you are finished exploring attributes use your web browser to navigate to the following link to
explore a list of global attributes that can be used with any HTML element.
io
http://www.w3schools.com/tags/ref_standardattributes.asp
Once the page loads you should see the heading near the top of the page indicating that you are on the
at
HTML Global Attributes page.
lu
va
6. Scroll down the page and you will find a table with a list of Global Attributes.
E
Notice that there are no global attributes that have been deprecated, but there are several new global
attributes with the HTML5 logo by the attribute name indicating that the attribute is new to the
HTML5 specification.
r
Just like the element attributes table notice that you can click on the attribute name if you would like to
Fo
learn more about a specific attribute or see a working example of the attribute.
The DOCTYPE
The <!DOCTYPE> declaration tag is used by the browser to identify what type of document specifications
y
the browser should use to render the HTML markup. This is similar to how operating systems use file
extensions on a file name to identify what kind of program will be used to open the file. Compare the HTML
nl
4.01 declarations to the HTML5 declaration below and notice that the HTML5 declaration is much simpler.
O
"http://www.w3.org/TR/html4/loose.dtd">
n
The character encoding for an HTML document specifies the standard used to define special characters and
how the browser should render and interpret those characters. The character encoding is set in the <meta>
HTML5 Character
Encoding
io
tag which should be nested inside of the head tag.
There are certain characters that have special meaning in HTML markup that do not allow you to put them
directly in the HTML markup. For example, if you use the > greater than or < less than characters in your
lu
HTML content the browser may have a hard time displaying that character since the greater than and less
than signs are used in start and end tags. Entities are used to provide an alternate way to display HTML
characters. The following table contains some of the most commonly used entities. The entity name or the
va
entity number can be used in your HTML markup to display the characters that are in the Result column of
the table below.
By specifying the type of Character Encoding that the HTML document is using you will help to ensure that
the browser displaying your page will display entities correctly.
y
element will not be used to display content on the page. The head element is used for the meta tag to
provide a reference to the Character Encoding that will be used, the title that will be displayed in the browser
nl
tab, links to JavaScript files or CSS files, and much more. You will see just how important the head element is
in the upcoming lessons.
O
n
io
Figure 1.2: Basic Empty HTML5 document
1. Navigate to the location of the Student Files folder and locate the Ex1_3.txt student exercise file and
open it with Notepad.
va
2. Select and delete the words between the start and end <title> tag.
3. Type: My First HTML5 Web Page between the start and end <title> tags.
4. Place your cursor at the end of the start body tag and press ENTER to move the cursor down one line.
5. Press the TAB key to indent one tab space from the body tags and type: <h1>First Heading</h1>.
E
Compare your syntax to the markup below and make sure that they are the same.
r
Fo
7. In the Save As dialog box change the Save as type to All Files as shown below.
y
nl
O
n
8. Now add the file extension .html to the File name. The File name should now be EX1_3.html.
Notice that the new HTML5 file has your computers default web browser icon showing on the HTML file
indicating that it will open with your default browser.
lu
11. Double click the html file and it will open with your default web browser.
va
Notice that on the page you can see the heading 1 text, and in the top of the window you can see the
E
y
Notepad++ include line numbers for debugging, syntax highlighting and folding, multi-document tab view
to work with several files at once, and column mode editing that allows you to edit multiple lines of code at
nl
once. Many developers choose to use Notepad++ because it’s free and also is considered platform
independent meaning that it is not tailored to one platform such as Windows, Mac or Linux. Figure 1.3 below
shows the Notepad++ interface. To download Notepad++, or to learn more about it, visit their website at
O
notepad-plus-plus.org.
n
io
at
lu
Visual Studio is the all in one developer tool that can be used with teams of developers that are collaborating
on a variety of development projects. Visual Studio is not limited to web and HTML5 development, but some
of the projects include .Net Windows software, ASP.NET Web applications, HTML5 touch enabled applications
and more. Visual Studio also integrates with many other Microsoft products including Microsoft’s SQL Server
and allows the developer to interact with Microsoft SQL Server without having to use another software
E
development tool. Microsoft DreamSpark is not an HTML editor, it’s a program offered by Microsoft that
supports technical education by providing access to Microsoft software for learning, teaching and research
purposes. As a student, you can get access to Visual Studio and other Microsoft software packages for free.
r
Although DreamSpark is free for students, schools that would like to gain access to additional Microsoft
software packages that are above and beyond the free student access can pay a small subscription fee giving
Fo
teachers and students access to the additional software. To sign-up or learn more about DreamSpark visit
http://www.dreamspark.com.
y
tag the auto-completion feature will automatically create an end tag after creating the start tag. This helps
speed up the process when creating HTML markup and also helps to avoid syntax errors. In addition, the
nl
intellisense feature will automatically offer attributes and their values when you are inside of a start tag and
hit the space bar. The intellisense feature also helps improve the speed of development and helps reduce
syntax errors.
O
Visual Studio Express also has a built in WYSIWYG designer that allows the developer to see and work with
the visual environment rather than just with the code. Note that developers should be careful using WYSIWYG
designers because they will create code based on what you change or move in the designer and often will
not produce the code that you expect. However a great feature that is used with the designer is to help locate
n
elements and locations in your HTML markup. For example you may have an HTML document with 200 lines
of markup and therefore it’s somewhat hard to find elements within those lines of markup, but the WYSIWYG
io
designer will allow you to click on the element or content in the designer and then when you change to the
code view your cursor will be placed at the exact location in the HTML markup designer. To download or
learn more about Visual Studio Web Developer Express visit http://www.asp.net/vwd.
at
Exercise 1.4: Explore Visual Studio Express 2013 for Web
1. Using your web browser navigate to the following website:
http://www.asp.net/visual-studio/overview/2013/
lu
2. Click the arrow to the right of Visual Studio 2013 in the left pane, then click on the first video in the list
titled Visual Studio 2013 Web Editor Features - Browser Link. This will take you to the following URL:
va
http://www.asp.net/visual-studio/overview/2013/visual-studio-2013-web-editor-features-browser-link
3. View the following videos that are listed on the left side of the page as in the screenshot below.
Visual Studio 2013 Web Editor Features – Browser Link
Visual Studio 2013 Web Editor Features – CSS
E
y
nl
O
n
io
Note: Step 4 requires administrative permissions on the Windows Operating System and therefore most
likely will not work if you are at school or any other managed network.
4. If you would like to download and install Visual Studio Express 2013 for Web go to the Microsoft
at
Download Center using the URL below. Download the software and read the System Requirements
before starting the installation. Finally use the Install Instructions to install Visual Studio Express 2013 for
Web.
http://www.microsoft.com/en-us/download/details.aspx?id=40747
lu
Note: Alternatively, if the above URL does not take you to the download page for VS Express 2013 for Web
then visit the Microsoft Download Center and search for “Microsoft Visual Studio Express 2013 for Web”.
http://www.microsoft.com/en-us/download
va
Adobe Dreamweaver
Although Visual Studio and Visual Studio Express 2013 for Web are great development tools, some
developers feel that they are tailored towards Microsoft technologies and therefore they choose tools such
E
as Adobe Dreamweaver and Notepad++ as their developer tool of choice. Adobe Dreamweaver is a
developer’s tool that has many great features that are similar to Visual Studio Express 2013 for Web but
Adobe Dreamweaver is not free. To learn more about Adobe Dreamweaver visit
r
http://www.adobe.com/products/dreamweaver.html.
Fo
Lesson Summary
In this lesson, you learned the requirements for creating a basic HTML web page including the DOCTYPE
declaration, Character Encoding, and the basic structure of the html, head, and body tags. In addition, the
correct syntax of elements and attributes were covered and explored using the online W3Schools.com reference
for HTML tags and attributes including new HTML5 tags and deprecated tags. Finally, you learned about the
W3C organization and the transition that is currently taking place from HTML 4.01 specification to HTML5.
y
JavaScript and CSS were also explained because the MTA 98-375 HTML5 Application Development
Fundamentals exam focuses on web applications that are capable of running on touch-enabled screens using
nl
HTML5, JavaScript, and CSS. Upon completion of this lesson, you are now able to:
create the basic structure and elements needed for an HTML5 page
understand how to use an online reference to find available tags and attributes
O
understand how to nest elements
understand that the MTA 98-375 exam will cover HTML5, JavaScript, and CSS
understand that there are many HTML editors and developer tools that can be used to develop HTML5
n
applications
create tags and attributes using the correct syntax
io
use the DOCTYPE declaration for HTML5
use a meta tag to specify the type of character encoding that will be used
at
use entities to display content that includes special characters
have a basic understanding of what HTML5, CSS, and JavaScript can be used for
Review Questions
lu
1. The MTA 98-375 HTML5 Application Development Fundamentals exam covers HTML5, CSS, and
____________________ scripting language.
va
3. HTML tags and elements are often referred to as the same thing but the element includes the start and
end tags as well as all content between the two tags.
E
a. True b. False
6. Tags that have been deprecated will not display in the web browser.
Fo
a. True b. False
MMM
7. Which technology is used to style the content of a web page?
Go online for Additional
a. HTML5 c. CSS Review and Activities
b. JavaScript d. PHP
9. By declaring the HTML5 DOCTYPE the web browser will only render HTML5 tags and will not render any
HTML 4.01 or earlier tags.
a. True b. False
y
10. HTML elements, attributes, and their values are all case sensitive?
nl
a. True b. False
11. A simple text editor like Notepad can be used to develop HTML5 touch-enabled web applications with
HTML5, JavaScript, and CSS3?
O
a. True b. False
12. Character Encoding is specified in the meta tag with the __________________ attribute?
13. If you would like to include special characters that the browser can’t display in the page content you
n
must use ________________ specified by name or number in the HTML markup?
14. Adding spaces, indents, and line breaks to your HTML markup is recommended so that you can visually
True b.
io
read and understand the markup much easier?
a. False
at
15. Which web programming language will NOT process server-side on the web server, but will process in
the web browser client-side?
a. ASP.NET c. PHP
b. JavaScript d. Cold Fusion
lu
va
E
r
Fo