Sunteți pe pagina 1din 18

1) What is HTML?

HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text
formatting language which is used to create and display pages on the Web. More details...

2) What are Tags?

HTML tags are composed of three things: opening tag, content and ending tag. Some tags are unclosed
tags.

HTML documents are made of two things:

o content, and

o tags

Content is placed between tags to display data on the web page. More details...

3) Do all HTML tags have end tag?

No. There are some HTML tags that don't need a closing tag. For example: <image> tag, <br> tag. More
details...

4) What are some common lists that are used when designing a page?

There are many common lists which are used to design a page. You can choose any or a combination of
the following list types:

o Ordered list

o Unordered list

o Menu list

o Directory list

o Definition list

More details...

5) What is the difference between HTML elements and tags?

HTML elements communicate to the browser to render text. When the elements are surrounded by
brackets <>, they form HTML tags. Most of the time, tags come in pair and surround content.
6) What is semantic HTML?

Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of
the content. For example: In semantic HTML <b> </b> tag is not used for bold statement as well as <i>
</i> tag is used for italic. Instead of these we use <strong></strong> and <em></em> tags.

7) What is image map?

Image map facilitates you link many different web pages using a single image. You can define shapes in
images that you want to make part of an image mapping.

8) How to insert a copyright symbol on a browser page?

can insert a copyright symbol by using &copy; or &#169; in an HTML file.

9) How do you keep list elements straight in an HTML file?

You can keep the list elements straight by using indents.

10) Does a hyperlink only apply to text?

No, you can use hyperlinks on text and images both. More details...

11) What is a style sheet?

A style sheet is used to build a consistent, transportable, and well designed style template. You can add
these templates on several different web pages.

12) Can you create a multi colored text on a web page?

Yes. To create a multicolor text on a web page you can use <font color ="color"> </font> for the specific
texts you want to color.

13) Is it possible to change the color of the bullet?

The color of the bullet is always the color of the first text of the list. So, if you want to change the color of
the bullet, you must change the color of the text.
14) What is a marquee?

Marquee is used to put the scrolling text on a web page. You should put the text which you want to scroll
within the <marquee>......</marquee> tag. More details...

15) How many tags can be used to separate section of texts?

There are three tags used to separate the texts. i.e. usually <br> tag is used to separate line of texts.
Other tags are<p> tag and <blockquote> tag.

16) How to make a picture a background image of a web page?

To make a picture a background image on a web page, you should put the following tag code after the
</head> tag.

1. <body background = "image.gif">

Here, replace the "image.gif" with the name of your image file which you want to display on your web
page.

17) What are empty elements?

HTML elements with no content are called empty elements. For example: <br>, <hr> etc.

18) What is the use of span tag? Give one example.

The span tag is used for following things:

o For adding color on text

o For adding background on text

o Highlight any color text etc.

Example:

1. <p>

2. <span style="color:#ffffff;">

3. In this page we use span.

4. </span>

5. </p>
19) What is the use of iframe tag?

An iframe is used to display a web page within a web page.

Syntax:

1. <iframe src="URL"></iframe>

Example:

1. <iframe src="demo_iframe.html" width="200px" height="200px"></iframe>

Target to a link:

1. <iframe src="http://www.javatpoint.com" name="iframe_a"></iframe>

HTML5 Interview Questions

Let's see a list of top HTML5 interview questions and answers.

20) What is canvas in HTML5?

Canvas is an HTML area which is used to draw graphics. More details...

21) What is SVG?

HTML SVG is used to describe the two dimensional vector and vector/raster graphics. More details...

22) What are the different new form element types in HTML 5?

Following is a list of 10 important new elements in HTML 5:

o Color

o Date

o Datetime-local

o Email

o Time

o Url

o Range
o Telephone

o Number

o Search

23) Is there any need to change the web browsers to support HTML5?

No. Almost all browsers (updated versions) support HTML 5. For example: Chrome, Firefox, Opera, Safari,
IE etc.

24) Which video formats are supported by HTML5?

HTML 5 supports three types of video format:

o mp4

o webm

o ogg

More details...

25) Is audio tag supported in HTML 5?

Yes. It is used to add sound or music files on the web page. More details...

26) What is the difference between progress and meter tag?

The progress tag is used to represent the progress of the task only while the meter tag is used to measure
data within a given range. More details...

27) What is the use of figure tag in HTML 5?

The figure tag is used to add a photo in the document on the web page. More details...

28) What is button tag?

The button tag is used in HTML 5. It is used to create a clickable button within HTML form on the web
page. It is generally used to create a "submit" or "reset" button. More details...
29) What does details and summary tag?

The details tag is used to specify some additional details on the web page. It can be viewed or hidden on
demand. The summary tag is used with details tag. More details...

30) What is datalist tag?

The HTML 5 datalist tag provides an auto complete feature on form element. It facilitates users to choose
the predefined options. More details...

31) How tags are migrated from HTML4 to HTML5?

No. Typical HTML4 Typical HTML5

1) <div id="header"> <header>

2) <div id="menu"> <nav>

3) <div id="content"> <section>

4) <div id="post"> <article>

5) <div id="footer"> <footer>

Header and Footer Example

HTML 4 Header and Footer:

1. <div id="header">

2. <h1>Monday Times</h1>

3. </div>

4. .

5. .

6. .

7. <div id="footer">

8. <p>&copy; JavaTpoint. All rights reserved.</p>

9. </div>
HTML 5 Header and Footer:

1. <header>

2. <h1>Monday Times</h1>

3. </header>

4. .

5. .

6. .

7. <footer>

8. <p>© JavaTpoint. All rights reserved.</p>

9. </footer>

Menu Example

HTML 4 Menu:

1. <div id="menu">

2. <ul>

3. <li>News</li>

4. <li>Sports</li>

5. <li>Weather</li>

6. </ul>

7. </div>

HTML 5 Menu:

1. <nav>

2. <ul>

3. <li>News</li>

4. <li>Sports</li>

5. <li>Weather</li>

6. </ul>

7. </nav>

32) If I do not put <!DOCTYPE html> will HTML 5 work?

No, browser will not be able to identify that it is a HTML document and HTML 5 tags will not function
properly.
33) What is the use of required attribute in HTML5?

It forces user to fill text on textfield or textarea before submitting form. It is used for form validation.

Example:

1. Name: <input type="text" name="name" required>

34) What are the new <input> types for form validation in HTML5?

The new input types for form validation are email, url, number, tel and date.

Example:

1. <input type="email">



Tutorials Point

What is CSS?
Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the
process of making web pages presentable.
What are advantages of using CSS?
Following are the advantages of using CSS −

• CSS saves time − You can write CSS once and then reuse same sheet in multiple HTML pages.
You can define a style for each HTML element and apply it to as many Web pages as you want.

• Pages load faster − If you are using CSS, you do not need to write HTML tag attributes every
time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag. So less code
means faster download times.

• Easy maintenance − To make a global change, simply change the style, and all elements in all
the web pages will be updated automatically.

• Superior styles to HTML − CSS has a much wider array of attributes than HTML, so you can
give a far better look to your HTML page in comparison to HTML attributes.

• Multiple Device Compatibility − Style sheets allow content to be optimized for more than one
type of device. By using the same HTML document, different versions of a website can be
presented for handheld devices such as PDAs and cell phones or for printing.
• Global web standards − Now HTML attributes are being deprecated and it is being
recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to make
them compatible to future browsers.

• Offline Browsing − CSS can store web applications locally with the help of an offline
catche.Using of this, we can view offline websites.The cache also ensures faster loading and
better overall performance of the website.

• Platform Independence − The Script offer consistent platform independence and can support
latest browsers as well.
What are the components of a CSS Style?
A style rule is made of three parts −

• Selector − A selector is an HTML tag at which a style will be applied. This could be any tag like
<h1> or <table> etc.

• Property − A property is a type of attribute of HTML tag. Put simply, all the HTML attributes
are converted into CSS properties. They could be color, border etc.

• Value − Values are assigned to properties. For example, color property can have value either red
or #F1F1F1 etc.
What is type selector?
Type selector quite simply matches the name of an element type. To give a color to all level 1 headings −

h1 { color: #36CFFF; }

What is universal selector?


Rather than selecting elements of a specific type, the universal selector quite simply matches the name of
any element type −

* { color: #000000; }

This rule renders the content of every element in our document in black.
What is Descendant Selector?
Suppose you want to apply a style rule to a particular element only when it lies inside a particular element.
As given in the following example, style rule will apply to <em> element only when it lies inside <ul>
tag.

ul em { color: #000000; }
What is class selector?
You can define style rules based on the class attribute of the elements. All the elements having that class
will be formatted according to the defined rule.

.black { color: #000000; }

This rule renders the content in black for every element with class attribute set to black in our document.
Can you make a class selector particular to an element type?
You can make it a bit more particular. For example −

h1.black { color: #000000; }

This rule renders the content in black for only <h1> elements with class attribute set to black.
What is id selector?
You can define style rules based on the id attribute of the elements. All the elements having that id will be
formatted according to the defined rule.

#black { color: #000000; }

This rule renders the content in black for every element with id attribute set to black in our document.

Can you make a id selector particular to an element type?


ou can make it a bit more particular. For example −

h1#black { color: #000000; }

This rule renders the content in black for only <h1> elements with id attribute set to black.
What is a child selector?
Consider the following example −

body > p { color: #000000; }

This rule will render all the paragraphs in black if they are direct child of <body> element. Other
paragraphs put inside other elements like <div> or <td> would not have any effect of this rule.
What is an attribute selector?
You can also apply styles to HTML elements with particular attributes. The style rule below will match all
the input elements having a type attribute with a value of text −

input[type = "text"]{ color: #000000; }


The advantage to this method is that the <input type = "submit" /> element is unaffected, and the color
applied only to the desired text fields.
How to select all paragraph elements with a lang attribute?
p[lang] : Selects all paragraph elements with a lang attribute.
How to select all paragraph elements whose lang attribute has a value of exactly "fr"?
p[lang="fr"] - Selects all paragraph elements whose lang attribute has a value of exactly "fr".
How to select all paragraph elements whose lang attribute contains the word "fr"?
p[lang~="fr"] - Selects all paragraph elements whose lang attribute contains the word "fr".
How to select all paragraph elements whose lang attribute contains values that are exactly "en", or begin
with "en-"?
p[lang|="en"] - Selects all paragraph elements whose lang attribute contains values that are exactly "en",
or begin with "en-".
What are the various ways of using CSS in an HTML page?
There are four ways to associate styles with your HTML document. Most commonly used methods are
inline CSS and External CSS.

• Embedded CSS − The <style> Element: You can put your CSS rules into an HTML document
using the <style> element.

• Inline CSS − The style Attribute: You can use style attribute of any HTML element to define
style rules.

• External CSS − The <link> Element: The <link> element can be used to include an external
stylesheet file in your HTML document.

• Imported CSS − @import Rule: @import is used to import an external stylesheet in a manner
similar to the <link> element.
How CSS style overriding works?
Following is the rule to override any Style Sheet Rule −

• Any inline style sheet takes highest priority. So, it will override any rule defined in
<style>...</style> tags or rules defined in any external style sheet file.

• Any rule defined in <style>...</style> tags will override rules defined in any external style sheet
file.

• Any rule defined in external style sheet file takes lowest priority, and rules defined in this file will
be applied only when above two rules are not applicable.
What is the purpose of % measurement unit?
% - Defines a measurement as a percentage relative to another value, typically an enclosing element.
p {font-size: 16pt; line-height: 125%;}

What is the purpose of cm measurement unit?


cm − Defines a measurement in centimeters.

div {margin-bottom: 2cm;}

What is the purpose of em measurement unit?


em − A relative measurement for the height of a font in em spaces. Because an em unit is equivalent to the
size of a given font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt.

p {letter-spacing: 7em;}

What is the purpose of ex measurement unit?


ex − This value defines a measurement relative to a font's x-height. The x-height is determined by the
height of the font's lowercase letter.

p {font-size: 24pt; line-height: 3ex;}

What is the purpose of in measurement unit?


in − Defines a measurement in inches.

p {word-spacing: .15in;}

What is the purpose of mm measurement unit?


mm − Defines a measurement in millimeters.

p {word-spacing: 15mm;}

What is the purpose of pc measurement unit?


pc − Defines a measurement in picas. A pica is equivalent to 12 points; thus, there are 6 picas per inch.

p {font-size: 20pc;}

What is the purpose of pt measurement unit?


pt − Defines a measurement in points. A point is defined as 1/72nd of an inch.

body {font-size: 18pt;}

What is the purpose of px measurement unit?


px − Defines a measurement in screen pixels.

p {padding: 25px;}

What is the purpose of vh measurement unit?


vh − 1% of viewport height.

h2 { font-size: 3.0vh; }

What is the purpose of vw measurement unit?


vw − 1% of viewport width.

h1 { font-size: 5.9vw; }

What is the purpose of vmin measurement unit?


vmin 1vw or 1vh, whichever is smaller.

p { font-size: 2vmin;}

In how many formats can you specify a CSS color?


You can specify your color values in various formats. Following table lists all the possible formats −

Format Syntax Example

Hex Code #RRGGBB p{color:#FF0000;}

Short Hex Code #RGB p{color:#6A7;}

RGB % rgb(rrr%,ggg%,bbb%) p{color:rgb(50%,50%,50%);}

RGB Absolute rgb(rrr,ggg,bbb) p{color:rgb(0,0,255);}

keyword aqua, black, etc. p{color:teal;}

There is the list of 216 colors which are supposed to be most safe and computer independent colors. These
colors vary from hexa code 000000 to FFFFFF. These colors are safe to use because they ensure that all
computers would display the colors correctly when running a 256 color palette.
Which property is used to set the background color of an element?
The background-color property is used to set the background color of an element.
Which property is used to set the background image of an element?
The background-image property is used to set the background image of an element.
Which property is used to control the repetition of an image in the background?
The background-repeat property is used to control the repetition of an image in the background.
Which property is used to control the position of an image in the background?
The background-position property is used to control the position of an image in the background.

Which property is used to control the scrolling of an image in the background?


The background-attachment property is used to control the scrolling of an image in the background.
Which property is used as a shorthand to specify a number of other background properties?
The background property is used as a shorthand to specify a number of other background properties.
Which property is used to change the face of a font?
The font-family property is used to change the face of a font.
Which property is used to make a font italic or oblique?
The font-style property is used to make a font italic or oblique.
Which property is used to create a small-caps effect?
The font-variant property is used to create a small-caps effect.
Which property is used to increase or decrease how bold or light a font appears?
The font-weight property is used to increase or decrease how bold or light a font appears.
Which property is used to increase or decrease the size of a font?
The font-size property is used to increase or decrease the size of a font.
Which property is used as shorthand to specify a number of other font properties?
The font property is used as shorthand to specify a number of other font properties.
Which property is used to set the color of a text?
The color property is used to set the color of a text.
Which property is used to set the text direction?
The direction property is used to set the text direction.
Which property is used to add or subtract space between the letters that make up a word?
The letter-spacing property is used to add or subtract space between the letters that make up a word.
Which property is used to add or subtract space between the words of a sentence?
The word-spacing property is used to add or subtract space between the words of a sentence.
Which property is used to indent the text of a paragraph?
The text-indent property is used to indent the text of a paragraph.
Which property is used to align the text of a document?
The text-align property is used to align the text of a document.
Which property is used to underline, overline, and strikethrough text?
The text-decoration property is used to underline, overline, and strikethrough text.
Which property is used to capitalize text or convert text to uppercase or lowercase letters?
The text-transform property is used to capitalize text or convert text to uppercase or lowercase letters.
Which property is used to control the flow and formatting of text?
The white-space property is used to control the flow and formatting of text.
Which property is used to set the text shadow around a text?
The text-shadow property is used to set the text shadow around a text.
Which property is used to set the width of an image border?
The border property is used to set the width of an image border.
Which property is used to set the height of an image?
The height property is used to set the height of an image.
Which property is used to set the width of an image?
The width property is used to set the width of an image.
Which property is used to set the opacity of an image?
The -moz-opacity property is used to set the opacity of an image.
Which property of a hyperlink signifies unvisited hyperlinks?
The :link signifies unvisited hyperlinks.
Which property of a hyperlink signifies visited hyperlinks?
The :visited signifies visited hyperlinks.
Which property of a hyperlink signifies an element that currently has the user's mouse pointer hovering
over it?
The :hover signifies an element that currently has the user's mouse pointer hovering over it.
Which property of a hyperlink signifies an element on which the user is currently clicking?
The :active signifies an element on which the user is currently clicking.
Which property of a table specifies whether the browser should control the appearance of the adjacent
borders?
The border-collapse specifies whether the browser should control the appearance of the adjacent borders
that touch each other or whether each cell should maintain its style.
Which property of a table specifies the width that should appear between table cells?
The border-spacing specifies the width that should appear between table cells.
Which property of a table controls the placement of the table caption?
The caption-side captions are presented in the <caption> element. By default, these are rendered above the
table in the document. You use the caption-side property to control the placement of the table caption.
Which property of a table specifies whether the border should be shown if a cell is empty?
The empty-cells specifies whether the border should be shown if a cell is empty.
Which property of a table allows browsers to speed up layout of a table by using the first width properties?
The table-layout allows browsers to speed up layout of a table by using the first width properties it comes
across for the rest of a column rather than having to load the whole table before rendering it.
Which property specifies the color of a border?
The border-color specifies the color of a border.
Which property specifies whether a border should be solid, dashed line, double line, or one of the other
possible values?
The border-style specifies whether a border should be solid, dashed line, double line, or one of the other
possible values.
Which property specifies the width of a border?
The border-width specifies the width of a border.
Which property specifies a shorthand property for setting the margin properties in one declaration?
The margin specifies a shorthand property for setting the margin properties in one declaration.
Which property specifies the bottom margin of an element?
The margin-bottom specifies the bottom margin of an element.
Which property specifies the top margin of an element?
The margin-top specifies the top margin of an element.
Which property specifies the left margin of an element?
The margin-left specifies the left margin of an element.
Which property specifies the right margin of an element?
The margin-right specifies the right margin of an element.
Which property allows you to control the shape or appearance of the marker of a list?
The list-style-type allows you to control the shape or appearance of the marker.
Which property specifies whether a long point that wraps to a second line should align with the first line or
start underneath the start of the marker of a list?
The list-style-position specifies whether a long point that wraps to a second line should align with the first
line or start underneath the start of the marker.
Which property specifies an image rather than a bullet point or number for the marker of a list?
The list-style-image specifies an image for the marker rather than a bullet point or number.
Which property serves as shorthand for the styling properties of a list?
The list-style serves as shorthand for the styling properties.
Which property specifies the distance between a marker and the text in the list?
The marker-offset specifies the distance between a marker and the text in the list.
Which property specifies the bottom padding of an element?
The padding-bottom specifies the bottom padding of an element.
Which property specifies the top padding of an element?
The padding-top specifies the top padding of an element.
Which property specifies the left padding of an element?
The padding-left specifies the left padding of an element.
Which property specifies the right padding of an element?
The padding-right specifies the right padding of an element.
Which property serves as shorthand for the all the padding properties of an element?
The padding serves as shorthand for the all the padding properties.
Which property allows you to specify the type of cursor that should be displayed to the user?
The cursor property of CSS allows you to specify the type of cursor that should be displayed to the user.
Which value of cursor property changes the cursor based on context area it is over?
auto − Shape of the cursor depends on the context area it is over. For example, an 'I' over text, a 'hand'
over a link, and so on.
Which value of cursor property changes the cursor to a crosshair or plus sign?
crosshair − A crosshair or plus sign.
Which value of cursor property changes the cursor to an arrow?
default − An arrow.
Which value of cursor property changes the cursor to a pointer?
pointer − A pointing hand (in IE 4 this value is hand).
Which value of cursor property changes the cursor to the 'I' bar?
move or text − The 'I' bar.
Which value of cursor property changes the cursor to the an hour glass?
wait − An hour glass.
Which value of cursor property changes the cursor to a question mark?
help − A question mark or balloon, ideal for use over help buttons.
Can you set an image to be shown as cursor?
Yes! set the url as the source of a cursor image file.
Which property is used to set the width of the outline?
The outline-width property is used to set the width of the outline.
Which property is used to set the line style for the outline?
The outline-style property is used to set the line style for the outline.
Which property is used to set the color of the outline?
The outline-color property is used to set the color of the outline.
Which property is used to set all the outlining properties in a single statement?
The outline property is used to set all the outlining properties in a single statement.
Which property is used to set the height of a box?
The height property is used to set the height of a box.
Which property is used to set the width of a box?
The width property is used to set the width of a box.

S-ar putea să vă placă și