HTML Notes

mobiprep (6).png

HTML

mobiprep (6).png

HTML Tags and Elements

mobiprep (6).png

Attributes and Hyperlinks

mobiprep (6).png

Headings and Lists

mobiprep (6).png

Class and id attributes

mobiprep (6).png

Semantic Elements

mobiprep (6).png

Inline and Block-Level Elements

mobiprep (6).png

Div and Span

mobiprep (6).png

img

mobiprep (6).png

Tables

mobiprep (6).png

Forms

Heading

Q

1

What are the HTML Tags which are used to separate the contents of the webpage?

LRM_EXPORT_207556595493866_20190724_1939

Ans

<html>
<hr>
"Hello"
<hr>Tag:
The <hr> tag defines a thematic break in an HTML page (e.g. a shift of topic).
The <hr> element is most often displayed as horizontal rule that is used to separate content (or define a change) in an HTML page.
</html>
<section>Tag: Section tag defines the section of documents such as chapters, headers, footers or any other sections. The section tag divides the content into section and subsections.

LRM_EXPORT_207556595493866_20190724_1939

Q

2

Mention some of the basic HTML Tags.

LRM_EXPORT_207556595493866_20190724_1939

Ans

Basic html Tags are as follows:
1. <html> …</html> — The root element. All web pages start with the html element. It’s also called the root element because it’s at the root of the tree of elements that make up a web page.

2.<head> …< /head> — The document head. The head element contains information about the web page, as opposed to the web page content itself.

3. <title> … </title> — The page title. The title element contains the title of the page. The title is displayed in the browser’s title bar (the bar at the top of the browser window), as well as in bookmarks, search engine results, and many other places.

4. <body> … </body> — The page’s content. The body element appears after the head element in the page. It should contain all the content of your web page: text, images, and so on. All web pages have 1 single body element, with the exception of frameset pages, which contain frame elements instead.

5. <h1> … </h1> — A section heading. Headings let you break up your page content into readable chunks. They work much like headings and subheadings in a book or a report.

6. <p> … </p> — A paragraph. The p element lets you create paragraphs of text. Most browsers displayparagraphs with a vertical gap between each paragraph, nicely breaking up the text.

7. <a>; … </a> — A link. One of the most important elements in a web page, the a element lets you create links to other content. The content can be either on your own site or on another site.

8. <img> — An image. The img element lets you insert images into your web pages. To insert an image, you first upload the image to your web server, then use an &lt;img&gt; tag to reference the uploaded image filename.

9. <div> … </div> — A block-level container for content. The div element is a generic container that you can use to add more structure to your page content. For example, you might group several paragraphs or headings that serve a similar purpose together inside a div element.

10. <span> … <span> — An inline container for content. The span element is similar to div in that it’s used to add structure to your content.

LRM_EXPORT_207556595493866_20190724_1939

Q

3

Explain DOCTYPE tag in detail.

LRM_EXPORT_207556595493866_20190724_1939

Ans

HTML <!DOCTYPE> tag is used to inform the browser about the version of HTML used in the document. It is called as the document type declaration (DTD).

Technically <!DOCTYPE > is not a tag/element, it just an instruction to the browser about the document type. It is a null element which does not contain the closing tag, and must not include any content within it. The doctype declaration differs between HTML versions. The HTML 5 doctype declaration is given below.

Syntax:<!DOCTYPE html>

LRM_EXPORT_207556595493866_20190724_1939

Q

4

Explain Span Tag in HTML with an example.

LRM_EXPORT_207556595493866_20190724_1939

Ans

The <span> tag is an inline container used to mark up a part of a text, or a part of a document.The <span> tag is easily styled by CSS or manipulated with JavaScript using the class or id attribute. The <span> tag is much like the &lt;div&gt; element, but <div> is a block-level element and <span> is an inline element.

Example : <p>My mother has <span style="color:blue" blue</span> eyes.</p>

LRM_EXPORT_207556595493866_20190724_1939

Q

5

What is the use of iframe tag in HTML?

LRM_EXPORT_207556595493866_20190724_1939

Ans

1. An iFrame is a frame within a frame.
2. It is a component of an HTML element that allows you to embed documents, videos, and interactive media within a page.
3. Thus, one can display a secondary webpage on your main page.
4. The iFrame element allows you to include a piece of content from other sources.

LRM_EXPORT_207556595493866_20190724_1939

Q

6

Whch tag is used to create Scrollable text or image in HTML?

LRM_EXPORT_207556595493866_20190724_1939

Ans

<marquee> tag is used to create a scrollable text in html.

LRM_EXPORT_207556595493866_20190724_1939

Q

7

Mention the HTML tags which do not require an End Tag.

LRM_EXPORT_207556595493866_20190724_1939

Ans

<area>: Used for the area inside of an image map.

<base>: The base URL for all relative URLs in a document. There can be no more than one of these per document and it must be in the head of the page.

<br>: A line break, often used in text content to create a single line break instead of a paragraph. It should not be used to create visual separation on a page by stacking up many <br> tags, because that function is a visual need and therefore the domain of CSS instead of HTML.

<col>: Specifies column properties for each column within a <colgroup> element.

<command>: Specifies a command that a visitor can invoke.

<embed>: Used with external applications and interactive content for integration.

<hr>: A horizontal rule, which is a straight line on a page. In many cases, CSS borders create separator lines instead of this HTML element.

<img>: One of the workhorse elements of HTML, this is the image tag. It is used to add graphic images to a webpage.

<input>: A form element that is used to capture information from visitors. There are a number of valid input types, from the common &quot;text&quot; input that has been used in forms for years, to some new input types that are part of HTML5.

<keygen>: This tag creates a key-pair generator field that is used for forms.

<link>: Not to be confused with the "hyperlink" or anchor (<a>) tag, this link is to set linkage between a document and an external resource. Use it to link to an external CSS file, for example.

<meta>: Meta tags are "information about content." They are found in the head of a document and used to convey page information to the browser. There are many different meta tags that you can use on a webpage.

<param>: Used to define parameters for plugins.

<source>: This tag allows you to specify alternative file paths for media on your page, including videos or images or audio files.

<track>: This tag sets a track to be used with a media file, a video, or audio, which are often added with the <video> or <audio> tags.

<wbr>: This stands for Word Break Opportunity. It specifies where in a block of text it would be acceptable to add a line break.

LRM_EXPORT_207556595493866_20190724_1939

Q

8

What are the basic HTML Elements?

LRM_EXPORT_207556595493866_20190724_1939

Ans

LRM_EXPORT_207556595493866_20190724_1939

Q

9

Explain Nested HTML elements with example.

LRM_EXPORT_207556595493866_20190724_1939

Ans

HTML elements can be nested (this means that elements can contain other elements).
The following example contains four HTML elements (<html>, <body>, <h1> and <p>):

Example :
<!DOCTYPE html>
<html>
<body>
<h1>My First Headin</h1>
<p>My first paragraph.</p>
</body>
</html>
The <html> element is the root element and it defines the whole HTML document.It has a start tag <html> and an end tag </html>.Then, inside the <html> element there is a <body> element:

The <body> element defines the document's body. It has a start tag <body> and an end tag </body>.Then, inside the <body> element there are two other elements: <h1> and <p>: The <h1> element defines a heading.It has a start tag <h1> and an end tag </h1> The <p> element defines a paragraph.It has a start tag <p> and an end tag </p>

LRM_EXPORT_207556595493866_20190724_1939

Q

10

Define Empty Elements in HTML Give examples.

LRM_EXPORT_207556595493866_20190724_1939

Ans

An empty element is an element from HTML, SVG, or MathML that cannot have any child nodes (i.e., nested elements or text nodes).

The HTML, SVG, and MathML specifications define very precisely what each element can contain. Many combinations have no semantic meaning, for example an <audio> element nested inside an <hr> element.

In HTML, using a closing tag on an empty element is usually invalid. For example, <input type="text"></input> is invalid HTML.

The empty elements in HTML are as follows:
<area>
<base>
<br>
<col>
<embed>
<hr>
<img>
<input>
<keygen>(HTML 5.2 Draft removed)
<link>
<meta>
<param>
<source>
<track>
<wbr>

LRM_EXPORT_207556595493866_20190724_1939