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

Week 11 Basic Tags and Commands in HTML

The document discusses basic, intermediate and advanced HTML tags and commands. It provides code examples for common tags like headings, paragraphs, images, links, lists and tables. It also covers formatting text, inserting addresses and displaying other webpages in iframes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Week 11 Basic Tags and Commands in HTML

The document discusses basic, intermediate and advanced HTML tags and commands. It provides code examples for common tags like headings, paragraphs, images, links, lists and tables. It also covers formatting text, inserting addresses and displaying other webpages in iframes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

WEEK #10

BASIC HTML TAGS/COMMANDS


Prepared by: John Marvin P. Villacorte
Basic HTML Commands
The basic commands are as follows:

1. Write a sample HTML document syntax?


Sample HTML document will have HTML elements which are building

blocks of web pages, and some of the HTML elements are <html>

which is a root element, <meta> which will have meta

information,<title> which contains a title of the document and <body>

which contains data of the document.

Code:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Page Title</title>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
Output:

2. Explain about HTML Headings?


HTML headings are HTML elements which are defined with tags <h1> to

<h6> where <h1> defines the most important tag and <h6> defines the

less important tag.

Sample HTML code with headings as below:

<h1> This is heading1 </h1>


<h2> This is heading2 </h2>
<h3> This is heading3 </h3>
<h4> This is heading4 </h4>

Output:
3. Explain about HTML element paragraph?
HTML paragraph is a HTML element which will be defined using tag <p>

and sample code as below:

<p> This is a paragraph </p>


lt;p> This is another paragraph </p>

Output is:

4. How to define HTML images element in HTML


document?
HTML images is an HTML element and defined with a tag <img>, and

we need to mention attributes such as src of the image, alt means

alternative text, width and height of the image to display and sample

code is

Code:

<img src=”img_w3schools.jpg” alt=”w3schools”

style=”width:120px;height:150px”>

Output:

5. Explain how lists are defined in an HTML document?


HTML lists is a HTML element and defined using tags <ul> or <ol>

where <ul> is unordered list and <ol> is ordered list

Code:
<ul>
<li> Coffee</li>
<li> Tea </li>
<li> Milk </li>
</ul>

Output:

6. How to create a table in an HTML document?


HTML table is a HTML element and it can be defined using tag <table>

and rows with tag <tr> and cells with tag <td> and code as below:

Code:

<table>
<tr>
<th>Firstname</th>
<th> Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
</table>

Output:

7. How to mention a link in the HTML document?


HTML links are HTML elements, and they can be defined using the tag

<a> and the sample code is below:

Code:

<a href=”https://www.w3schools.com”>This is a link </a>

Output:
8. Why to use the style attribute in the HTML
document?
HTML attribute style can be used with a combination of any HTML

elements such as <p> and the sample code is as below:

Code:

<p style=”color:red”> I am a paragraph </p>

Output:

9. What is the significance of the lang attribute in an


HTML document?
In HTML, using the lang attribute, we can declare the language of the

document using the <html> tag and language are defined using lang

attribute, and sample code is as below:

Code:

<!DOCTYPE html>
<html lang=”en-US”>
<body>
...
...
</body>
</html>

Output:

10. How to format the HTML elements in the HTML


document?
In HTML, we can use formatting elements to format the HTML document

and we can define special elements for text with special meaning. HTML

elements like <b> for bold, <i> for italic

Code:

<b> This text is bold </b>

Output:
Intermediate HTML Commands
The intermediate commands are as follows:

1. How to highlight some text in the HTML document?


In HTML, we can highlight some text in HTML document using element

<mark> so that it highlight the text enclosed in <mark> element and the

sample code is as below:

<html><body>
<h2> html <mark> Marked </mark> formtting </h2>
</body></html>

2. How to delete some text in an HTML document?


In HTML, we can delete some text using <del> element so that the text

which is enclosed between this element is deleted, and the sample code

is as below:

<html><body>

<p> My favorite color is <del> Navy blue </del> Red


</p>

</body></html>

3. How to define the superscripted text in the HTML


document?
In HTML, we can define the text as superscripted using element <sup> in

the HTML document so that text enclosed in <sup> element will be

superscripted, and the sample code is as below:

<html><body>
<p> This is <sup> superscripted </sup> text </p>

4. How to define an abbreviation in the HTML


document?
In HTML, we can define abbreviation by using HTML element <abbr> in

the HTML document, which will give useful information to browsers, and

the sample code is as below:

<html><body>
<p> The <abbr title=”World Health Organization” >WHO </abbr>
was founded in 1948 </p>
</body></html>
5. How to mention the address in the HTML document?
In HTML, we can mention the address in HTML document using HTML

element <address> which defines contact information or address related

to article or document and displays in italic and the sample code as

below:

<html><body>
<address>
Written by Srinivas <br>
dasu.com <br>
Pincode : 500084, Hyderabad <br>
India
</address>
</body></html>

Advanced HTML Commands


The advanced commands are as follows:

1. How to display a webpage inside a webpage in an


HTML document?
In HTML, we can display a webpage inside a webpage using HTML iframe

and is defined using the tag <iframe> and src attribute specifies the URL

of the webpage and sample code is as below:

<html><body>
<iframe src=”demo.html” height=”300” width=”300” > </iframe>
</body></html>

2. How to target to different target using an iframe in


an HTML document?
In HTML, we can use the target frame as a link using the iframe tag in the

HTML document, and the target attribute to the link must refer to the

name attribute of iframe and sample code is as below:

<html><body>
<iframe src=”demo.html” name=”iframe1”> </iframe>
<p> <a href=”www.google.com” target=”iframe1”> Google.co.in
</a> </p>
</body></html>

Tips and Tricks to Use HTML Commands


• Make your visitors allow change text color or background by

adding extra code.

• Add metadata while writing an HTML document.

• It’s good to hide some fields where we don’t want a user to edit

those fields.

• Always add a horizontal line to break long sections so the website

will look good.

Source: https://www.educba.com/html-commands/

You might also like