0% found this document useful (0 votes)
29 views

The Tag - Example

The document provides examples of using different HTML tags: 1) The <script> tag is used to embed JavaScript code in an HTML page. It shows a function defined in the <head> that is called in the <body>. 2) The <style> tag in the <head> section embeds CSS styles to format page elements like paragraphs and first letters. 3) Comments between <!- - > tags can be added anywhere in the HTML and won't be displayed in the browser. 4) The <body> section contains the visible page content and occurs after the <head> section. 5) Text formatting tags like <b>, <i>, <u> modify

Uploaded by

Cristian PALMA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

The Tag - Example

The document provides examples of using different HTML tags: 1) The <script> tag is used to embed JavaScript code in an HTML page. It shows a function defined in the <head> that is called in the <body>. 2) The <style> tag in the <head> section embeds CSS styles to format page elements like paragraphs and first letters. 3) Comments between <!- - > tags can be added anywhere in the HTML and won't be displayed in the browser. 4) The <body> section contains the visible page content and occurs after the <head> section. 5) Text formatting tags like <b>, <i>, <u> modify

Uploaded by

Cristian PALMA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

The <script> Tag – Example

<!DOCTYPE HTML> scripts-example.html


<html>
<head>
<title>JavaScript Example</title>
<script type="text/javascript">
function sayHello() {
document.write("<p>Hello World!<\/p>");
}
</script>
</head>
<body>
<script type=
"text/javascript">
sayHello();
</script>
</body>
</html>
1
<head> Section: <style>
 The <style> element embeds formatting
information (CSS styles) into an HTML page
<html> style-example.html
<head>
<style type="text/css">
p { font-size: 12pt; line-height: 12pt; }
p:first-letter { font-size: 200%; }
span { text-transform: uppercase; }
</style>
</head>
<body>
<p>Styles demo.<br />
<span>Test uppercase</span>.
</p>
</body>
</html>
2
Comments: <!-- --> Tag
 Comments can exist anywhere between the
<html></html> tags
 Comments start with <!-- and end with -->

<!–- Telerik Logo (a JPG file) -->


<img src="logo.jpg" alt=“Telerik Logo">
<!–- Hyperlink to the web site -->
<a href="http://telerik.com/">Telerik</a>
<!–- Show the news table -->
<table class="newstable">
...

3
<body> Section: Introduction
 The <body> section describes the viewable
portion of the page
 Starts after the <head> </head> section

 Begins with <body> and ends with </body>

<html>
<head><title>Test page</title></head>
<body>
<!-- This is the Web page body -->
</body>
</html>

4
Text Formatting
 Text formatting tags modify the text between
the opening tag and the closing tag
 Ex. <b>Hello</b> makes “Hello” bold
<b></b> bold
<i></i> italicized
<u></u> underlined
<sup></sup> Samplesuperscript
<sub></sub> Samplesubscript
<strong></strong> strong
<em></em> emphasized
<pre></pre> Preformatted text
<blockquote></blockquote> Quoted text block
<del></del> Deleted text – strike through
5
Text Formatting – Example
text-formatting.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Notice</h1>
<p>This is a <em>sample</em> Web page.</p>
<p><pre>Next paragraph:
preformatted.</pre></p>
<h2>More Info</h2>
<p>Specifically, we’re using XHMTL 1.0 transitional.<br />
Next line.</p>
</body>
</html>

6
Text Formatting – Example (2)
text-formatting.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Notice</h1>
<p>This is a <em>sample</em> Web page.</p>
<p><pre>Next paragraph:
preformatted.</pre></p>
<h2>More Info</h2>
<p>Specifically, we’re using XHMTL 1.0 transitional.<br />
Next line.</p>
</body>
</html>

You might also like