0% found this document useful (0 votes)
40 views5 pages

HTML Tags and Formatting Examples

The document discusses various HTML tags and their usage. It provides examples of common text formatting tags like <p>, <b>, <i>, headings tags <h1> to <h6>, and layout structure tags like <body> and <html>. It also demonstrates how to insert images, tables, hyperlinks, and control line breaks. Tags like <a>, <img>, <table> and their attributes are explained along with sample code snippets.

Uploaded by

Abhay Petkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views5 pages

HTML Tags and Formatting Examples

The document discusses various HTML tags and their usage. It provides examples of common text formatting tags like <p>, <b>, <i>, headings tags <h1> to <h6>, and layout structure tags like <body> and <html>. It also demonstrates how to insert images, tables, hyperlinks, and control line breaks. Tags like <a>, <img>, <table> and their attributes are explained along with sample code snippets.

Uploaded by

Abhay Petkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

What are Tags? Explain with html codes.

<tag> content </tag>

How to create Paragraphs in HTML Page? Write the codes


Explanation
How many types of heading does an HTML contain?
<h1> to <h6>
Describe HTML layout structure with sample code.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
How to control the line breaks and spaces with the <pre> tag? Explain with examples.
!DOCTYPE html>
<html>
<body>

<p>The pre tag preserves both spaces and line breaks:</p>

<pre>
I love myself
I am masterpiece
</pre>

</body>
</html>
<p> My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the
ocean.</p>
Consider the above paragraph lines and apply the proper style formatting tag to set the font
size to 100 px, font family to verdana, text alignment to center, text color to blue.

<p style= "font-size:100%; font-family:verdana;text-align:center;color:blue;" >


My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the
ocean.</p>
Create the navigation tab for the given items using HTML as follows:
About, Advantages and Disadvantages, Types of Cyber security & Quiz and create the
href attribute for all list.
<li><a href="#about">About</a></li>
<li><a href="#Adv">Advantages and Disadvantages</a></li>
<li><a href="#Types">Types of Cyber Security</a></li>
<li><a href="#quiz">Quiz</a></li>
1. <p> Engineering is a discipline dedicated to problem solving. </p>
2. <p> Our built environment and infrastructure, the devices we use to communicate, the
processes that manufacture our medicines, have all been designed, assembled or managed by an
engineer.</p>
3. <p> Find solutions to some of the world's most complex challenges.</p>
4. <p> Find solutions to some of the world's most complex challenges problems </p>

Apply the correct formatting tag to above paragraph


1. Apply proper tag to mark the text to bold given in point 1
2. Apply proper tag to mark the text to italic given in point 2
3. Apply proper tag to highlight the text given in point 3.
4. Apply proper tag to strikeout the given text given in point 4.
<p><b>This text is bold.</b></p>
<p><i>This text is italic.</i></p>
<p> <mark> Find solutions to some of the world's most complex challenges </mark>.</p>
<p>Find solutions to some of the world's most complex <del>challenges</del> problems</p>
How many tags can be used to separate a section of texts? Explain with example.
Explanation: <br> tag , <p> tag , <pre> tag
How to make a picture of a background image of a web page? Explain with codes to resize the
width and height of images.
<!DOCTYPE html>
<html>
<body>

<h2>Background Image</h2>

<p>A background image for a div element : </p>

<div style="background-image: url(‘I:\[Link]');">

You can specify background images<br>


for any visible HTML element.<br>
</div>

What are the various formatting tags in HTML? Explain with examples
<b>
<i>
<u>
<big>
<small>
<sub>
<sup>
<del>
<strong>
<mark>
<ins>
How to use the figure tag in HTML? Explain with codes.
<p>Taj Mahal </p>
<figure>
<img src="htmlpages/images/[Link]" alt="Taj Mahal"/>
</figure>
Difference between link tag <link> and anchor tag <a>? Show with example codes.
Refer class 1 HTML notes
How to create a hyperlink in HTML? Write sample code for inserting hyperlink in HTML page.
<!DOCTYPE html>
<html>
<body>
<h2>The href Attribute</h2>
<p>HTML links are defined with the a tag. The link address is specified in the href
attribute:</p>
<a href="[Link] My College Website</a>
</body>
</html>

Which HTML tag is used to display the data in the tabular form? Write sample code for
inserting the table in HTML page. (2*3 matrix)
<!DOCTYPE html>
<html>
<style>
table, th, td {border:1px solid blue;}
</style>
<body>
<h2>A basic HTML table</h2>
<table style="width:80%">
<tr>
<th>Company</th>
<th>Country</th>
</tr>
<tr>
<td> TCS</td>
<td>India</td>
</tr>
<tr>
<td> wipro</td>
<td>singapore</td> </tr>
</table>
</body>
</html>

Company Contact Country

TCS RAHUL INDIA

WIPRO TANMAY SINGAPORE

Common questions

Powered by AI

The <a> tag is used to create hyperlinks, allowing users to navigate from one page to another or jump to specific sections within a page. It uses the href attribute to specify the destination URL. The <link> tag, on the other hand, is used to link external resources such as stylesheets and does not render content clickable like the <a> tag. It is placed in the <head> section of an HTML document to provide a relationship between the document and the linked resource .

Inline CSS styles specific HTML elements directly within the style attribute in the tag. It is advantageous for quick and localized styling but less maintainable for larger projects. For example, in styling a paragraph with font size, family, and color, inline CSS is specified directly within the <p> tag. This is less efficient than external or internal CSS for consistent styling across multiple elements and files, as it can lead to duplications and more difficult maintenance .

An HTML layout can be constructed using a basic structure consisting of a document type declaration, followed by <html>, <head>, and <body> tags. Within the <body>, elements such as <h1> for headings and <p> for paragraphs are used to organize content. This foundational structure allows for the layering of more complex styles and scripts, essential for interactive and responsive web design .

To create a background image for an HTML element, the CSS property background-image is used within a style attribute or stylesheet. Its size can be controlled using the background-size property, specifying pixel or percentage values for width and height. For instance, setting a background for a <div> element would involve specifying a URL for the image within background-image and controlling dimensions with background-size .

The <pre> tag in HTML preserves both spaces and line breaks by rendering text exactly as it appears in the code. This is especially useful for formatting code snippets or poems where the exact arrangement of text is important. For instance, using <pre> tags around text will maintain the spacing and formatting rather than having the browser collapse multiple spaces into a single space .

HTML tables are created using the <table> tag, with rows defined by <tr>, headers by <th>, and data cells by <td>. A simple 2x3 matrix can be constructed with a <table> element that includes two <tr> elements, each containing three <td> elements, with optional <th> for headers. This structure is essential for displaying tabular data effectively, as demonstrated in a basic table with companies and countries .

HTML tags define the structure and contents of a web page by denoting elements such as headings, paragraphs, links, and more. They are crucial in web development as they organize content and provide meaning, enabling browsers to display web pages correctly. For example, <h1> to <h6> tags define headings, establishing a hierarchy, while <p> tags define paragraphs to structure text content .

The <figure> tag in HTML is used to group media elements like images or illustrations with optional captions provided using the <figcaption> tag. It provides semantic meaning by associating media content with a caption, improving accessibility and SEO. Unlike standalone image tags, <figure> allows for supplementary information to be closely coupled with images. For instance, using a <figure> tag allows a descriptive caption alongside an image of the Taj Mahal .

HTML provides six heading tags, ranging from <h1> to <h6>, which are used to define headings with decreasing importance. <h1> is typically used for the main title or primary heading with the most significant font size, and <h6> for the least important heading with the smallest font size. Structuring documents with these heading tags helps create a logical flow and hierarchy, which is essential for both user experience and accessibility .

The <b> tag bolds text but provides no semantic meaning, used purely for visual emphasis. The <i> tag italicizes text, often used for foreign words or technical terms, providing a slight semantic distinction. The <mark> tag highlights text, emphasizing content relevant to the user’s current task, and carries semantic meaning by indicating that the marked text is particularly significant .

You might also like