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

Give a short note on HTML Attributes.

LRM_EXPORT_207556595493866_20190724_1939

Ans

1.HTML attributes are special words which provide additional information about the elements or attributes are the modifier of the HTML element.
2. Each element or tag can have attributes, which defines the behaviour of that element.
3. Attributes should always be applied with start tag.
4. The Attribute should always be applied with its name and value pair.
5. The Attributes name and values are case sensitive, and it is recommended by W3C that it should be written in Lowercase only.
6. You can add multiple attributes in one HTML element, but need to give space between two attributes.

Syntax
<element attribute_name="value">content</element>

LRM_EXPORT_207556595493866_20190724_1939

Q

2

Why do we need Attributes in HTML?

LRM_EXPORT_207556595493866_20190724_1939

Ans

An attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such. For clarity,attributes should more correctly be considered metadata.

LRM_EXPORT_207556595493866_20190724_1939

Q

3

Can attributes be modified dynamically?

LRM_EXPORT_207556595493866_20190724_1939

Ans

we can modify it by using JavaScript

syntax
document.getElementByTagName("tag name").setAttribute("attribute name", "value");

LRM_EXPORT_207556595493866_20190724_1939

Q

4

Give a short note on the title and lang attributes in HTML

LRM_EXPORT_207556595493866_20190724_1939

Ans

The title attribute is used as text tooltip in most of the browsers. It display its text when user move the cursor over a link or any text. You can use it with any text or link to show the description about that link or text. In our example, we are taking this with paragraph tag and heading tag.

Example
With <h1> tag:
<h1 title="This is heading tag">Example of title attribute</h1>

LRM_EXPORT_207556595493866_20190724_1939

Q

5

Define Hyperlinks.

LRM_EXPORT_207556595493866_20190724_1939

Ans

A hyperlink is an element in an HTML document that links to either another portion of the document or to another document altogether. On webpages, hyperlinks are usually colored purple or blue and are sometimes underlined.

The href attribute is the main attribute of <a> anchor tag. This attribute gives the link address which is specified in that link. The href attribute provides the hyperlink, and if it is blank, then it will remain in same page.

Example
With link address:
<a href="https://www.javatpoint.com/html-anchor">This is a link</a>

LRM_EXPORT_207556595493866_20190724_1939