Unit2 - L2 - HTML Elements
Unit2 - L2 - HTML Elements
Unit2 - L2 - HTML Elements
Html Elements
• Most HTML elements are written with a start tag (or opening tag) and
an end tag (or closing tag), with content in between. Elements can
also contain attributes that defines its additional properties.
HTML Element Syntax Illustration
HTML Tags Vs Elements
• However, in common usage the terms HTML element and HTML tag
are interchangeable
Case Insensitivity in HTML Tags and Attributes
In HTML, tag and attribute names are not case-sensitive (but most
attribute values are case-sensitive). It means the tag <P>, and the tag
<p> defines the same thing in HTML which is a paragraph.
Empty HTML Elements
<hr>some content</hr> or
<br>some content</br>.
• Most HTML elements can contain any number of further elements (except empty
elements), which are, in turn, made up of tags, attributes, and content or other
elements.
• The following example shows some elements nested inside the <p> element
• Comments are usually added with the purpose of making the source
code easier to understand. It may help other developer (or you in the
future when you edit the source code) to understand what you were
trying to do with the HTML. Comments are not displayed in the
browser.
• An HTML comment begins with <!--, and ends with -->, as shown in the
example below:
<!-- This is an HTML comment -->
<!-- Hiding this image for testing <img
src="images/smiley.png" alt="Smiley"> -->
Physical Text formatting elements
Logical Text formatting elements
Difference between <strong> and <b> tag
Both <strong> and <b> tags render the enclosed text in a bold typeface
by default, but the <strong> tag indicates that its contents have strong
importance, whereas the <b> tag is simply used to draw the reader's
attention without conveying any special importance.
Difference between <em> and <i> tag
Similarly, both <em> and <i> tags render the enclosed text in italic type
by default, but the <em> tag indicates that its contents have stressed
emphasis compared to surrounding text, whereas the <i> tag is used for
marking up text that is set off from the normal text for readability
reasons, such as a technical term, an idiomatic phrase from another
language, a thought, etc.
Character Entities
Example
<HTML>
<HEAD>
<TITLE>Character Entities Example</TITLE>
</HEAD>
<BODY>
<H1 ALIGN="center">Big Company Inc.'s Tagging Products</H1>
<HR>
<P>Character entities like &copy; allow users to insert special characters like
©.</P>
<P>One entity that is both useful and abused is the nonbreaking space.</P>
<BR><BR>
Inserting spaces is easy with &nbsp;<BR>
Look: S P A
C E S.<BR>
<HR>
<ADDRESS>
Contents of this page © 1999 Big Company, Inc.<BR> The
<B>Wonder Tag</B> <P> ™ is a registered trademark
of Big Company, Inc.
</ADDRESS>
</BODY>
</HTML>