Dear Readers, Welcome to HTML Interview questions with answers and explanation.

HTML interview questions and answers for freshers and experienced – In this series, we have covered all about HTML and answered the questions that might be asked during an interview.

If there is any HTML interview question that have been asked to you, kindly post it in the the comment section.

The commonly asked interview questions and answers for HTML are given below.


 

1.What is HTML?

Ans:

HTML is short for HyperText Markup Language and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web. HTML documents are made up of two things: the content and the tags that format it for proper display on pages.

2. What are tags?

Ans:

Content is placed in between HTML tags in order to properly format it. It makes use of the less than symbol (<) and the greater than symbol (>). A slash symbol is also used as a closing tag. For example:

sample

3. Do all HTML tags come in a pair?

Ans:

No, there are single HTML tags that do not need a closing tag. Examples are the tag and
tags.

4. What are some of the common lists that can be used when designing a page?

Ans:

You can insert any or a combination of the following list types:

  • ordered list
  • unordered list
  • definition list
  • menu list
  • directory list

Each of this list types makes use of a different tag set to compose

5. How do you insert a comment in HTML?

Ans:

Comments in HTML begins with “<!–“nd ends with “–>”. For example:

6. Do all character entities display properly on all systems?

Ans:

No, there are some character entities that cannot be displayed when the operating system that the browser is running on does not support the characters. When that happens, these characters are displayed as boxes.

7. What is an image map?

Ans:

Image map lets you link to 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. What is the advantage of collapsing white space?

Ans:

White spaces are a blank sequence of space characters, which is treated as a single space character in HTML. Because the browser collapses multiple spaces into a single space, you can indent lines of text without worrying about multiple spaces. This enables you to organize the HTML code into a much more readable format.

9. Can attribute values be set to anything or are there specific values that they accept?

Ans:

Some attribute values can be set to only predefined values. Other attributes can accept any numerical value that represents the number of pixels for a size.

10. How do you insert a copyright symbol on a browser page?

Ans:

To insert the copyright symbol, you need to type © or & #169; in an HTML file.



 

11. How do you create links to sections within the same page?

Ans:

Links can be created using the tag, with referencing through the use of the number (#) symbol. For example, you can have one line as BACK TO TOP, which would result in the words “BACK TO TOP” appearing on the webpage and links to a bookmark named topmost. You then create a separate tag command like somewhere on the top of the same webpage so that the user will be linked to that spot when he clicked on “BACK TO TOP”.

12. Is there any way to keep list elements straight in an HTML file?

Ans:

By using indents, you can keep the list elements straight. If you indent each subnested list in further than the parent list that contains it, you can at a glance determine the various lists and the elements that it contains.

13. If you see a web address on a magazine, to which web page does it point?

Ans:

Every web page on the web can have a separate web address. Most of these addresses are relative to the top-most web page. The published web address that appears within magazines typically points this top-most page. From this top level page, you can access all other pages within the website.

14. What is the use of alternative text in image mapping?

Ans:

When you use image maps, it can easily become confusing and difficult to determine which hotspots correspond to which links. Using alternative text lets, you put a descriptive text on each hotspot link.

15. Do older HTML files work on newer browsers?

Ans:

Yes, older HTML files are compliant to the HTML standard. Most older files work on the newer browsers, though some features may not work.

16. Does a hyperlink apply to text only?

Ans:

No, hyperlinks can be used in the text as well as images. That means you can convert an image into a link that will allow users to link to another page when clicked. Surround the image within the tag combinations.

17. If the user’s operating system does not support the needed character, how can the symbol be represented?

Ans:

In cases wherein their operating system does not support a particular character, it is still possible to display that character by showing it as an image instead.

18. How do you change the number type in the middle of a list?

Ans:

The

  • tag includes two attributes – type and value. The type attribute can be used to change the numbering type for any list item. The value attribute can change the number index.

19. What are style sheets?

Ans:

Style sheets enable you to build consistent, transportable, and well-defined style templates. These templates can be linked to several different web pages, making it easy to maintain and change the look and feel of all the web pages within site.

20. State  bullet types available in HTML

Ans:

With ordered lists, you can select to use some different list types including alphabetical and Roman numerals. The type attribute for unordered lists can be set to disc, square, or circle.




 

21. How do you create multicolored text in a webpage?

Ans:

To create text with different colors, use the tags for every character that you want to apply color. You can use this tag combination as many times as needed, surrounding a single character or an entire word.

22. Why are there both numerical and named character entity values?

Ans:

The numerical values are taken from the ASCII values for the various characters, but these can be difficult to remember. Because of this, named character entity values were created to make it easier for web page designers to use.

23. How to update two frames at the same time using HTML?

Ans:

To update the two frames at the same time there is a requirement for the HTML based techniques that links the documents with a new frameset document. It specifies a new frames that can be combined with other frames. There is a JavaScript that will be used to link the updated frame and the method that will be used is onClick(). HTML based technique allow the new frameset document with the attribute of TARGET=_top. In this the first frameset document uses a secondary frameset document that will be defined as the nested frameset.

24. What is the advantage of grouping several checkboxes together?

Ans:

Although checkboxes don’t affect one another, grouping checkboxes together help to organize them. Checkbox buttons can have their name and do not need to belong to a group. A single web page can have many different groups of checkboxes.

25. What will happen if you overlap sets of tags?

Ans:

If two sets of HTML tags are overlapped, only the first tag will be recognized. You will find this problem when the text does not display properly on the browser screen.

26. What are applets?

Ans:

Applets are small programs that can be embedded within web pages to perform some specific functionality, such as computations, animations, and information processing. Applets are written using the Java language.

27. What if there is no text between the tags or if a text was omitted by mistake? Will it affect the display of the HTML file?

Ans:

If there is no text between the tags, then there is nothing to format. Therefore no formatting will appear. Some tags, especially tags without a closing tag like the tag, do not require any text between them.

28. Is it possible to set specific colors for table borders?

Ans:

You can specify a border color using style sheets, but the colors for a table that does not use style sheets will be the same as the text color.

29. How do you create a link that will connect to another web page when clicked?

Ans:

To create hyperlinks, or links that connect to another web page, use the href tag.  Replace “site” with the actual page URL that is supposed to be linked to when the text is clicked.

30. What other ways can be used to align images and wrap text?

Ans:

Tables can be used to position text and images. Another useful way to wrap text around an image is to use style sheets.


 

31. Can a single text link point to two different web pages?

Ans:

No. The tag < a> can accept only a single href attribute, and it can point to only a single web page.

32. What is the difference between the directory and menu lists and the unordered list?

Ans:

The key difference is that the directory and menu lists do not include attributes for changing the bullet style.

33. Can you change the color of bullets?

Ans:

The bullet color is always the same as that of the first character in the list item. If you surround < li> the and the first character with a set of < font>tags with the color attribute set, the bullet color, and the first character will be a different color from the text.

34. What are the limits of the text field size?

Ans:

The default size for a text field is around 13 characters. However, if you include the size attribute, you can set the size value to be as low as 1. The maximum size value will be determined by the browser width. If the size attribute is set to 0, the size will be set to the default size of 13 characters.

35. Dotags always need to come at the start of a row or column?

Ans:

Any < tr> tag can be changed to a < th>tag. This causes the text contained within the < th> tag to be displayed as bold in the browser. Although < tr> tags are mainly used for headings, they do not need to be used exclusively for headings.

36. What is the relationship between the border and rule attributes?

Ans:

Default cell borders, with a thickness of 1 pixel, are automatically added between cells if the border attribute is set to a nonzero value. Likewise, If the border attribute is not included, a default 1-pixel border appears if the rules attribute is added to the < table>tag.

37. What is a marquee?

Ans:

A marquee allows you to put a scrolling text in a web page. To do this, place whatever text you want to appear scrolling within the < marquee> and < /marquee> tags.

38. How do you create text on a webpage that will allow you to send an email when clicked?

Ans:

To change text into a clickable link to send email, use the mailto command within the href tag.

39. Are < br> tags the only way to separate sections of text?

Ans:

No. The < br> tag is only one way to separate lines of text. Other tags, like the < p> tag and < blockquote> tag, also separate sections of text.

40. Are there instances where the text will appear outside of the browser?

Ans:

By default, the text is wrapped to appear within the browser window. However, if the text is part of a table cell with a defined width, the text could extend beyond the browser window.



 

41. How are active links different from normal links?

Ans:

The default color for normal and active links is blue. Some browsers recognize an active link when the mouse cursor is placed over that link; others recognize active links when the link has the focus. Those that don’t have a mouse cursor over that link is considered a normal link.

42. Do style sheets limit the number of new style definitions that can be included within the brackets?

Ans:

Style sheets do not limit the number of style definitions that can be included within the brackets for a given selector. Every new style definition, however, must be separated from the others by a semicolon symbol.

43. Can I specify fractional weight values such as 670 or 973 for font weight?

Ans:

Implementation largely depends on the browser, but the standard does not support fractional weight values. Acceptable values must end with two zeroes.

44. What is the hierarchy that is being followed when it comes to style sheets?

Ans:

If a single selector includes three different style definitions, the definition that is closest to the actual tag takes precedence. Inline style takes priority over embedded style sheets, which takes priority over external style sheets.

45. Can several selectors with class names be grouped together?

Ans:

You can define several selectors with the same style definition by separating them with commas. This same technique also works for selectors with class names.

46. What happens if you open the external CSS file in a browser?

Ans:

When you try to open the external CSS file in a browser, the browser cannot open the file, because the file has a different extension. The only way to use an external CSS file is to reference < link/>it using tag within another HTML document.

47. How do you make a picture into a background image of a web page?

Ans:

Replace image.gif with the name of your image file. This will take the picture and make it the background image of your web page.

48. What happens if the list-style-type property is used on a non-list element like a paragraph?

Ans:

If the list-style-type property is used on a non-list element like a paragraph, the property will be ignored and do not affect the paragraph.

49. When is it appropriate to use frames?

Ans:

Frames can make navigating a site much easier. If the main links to the site are located in a frame that appears at the top or along the edge of the browser, the content for those links can be displayed in the remainder of the browser window.

50. What happens if the number of values in the rows or cols attribute doesn’t add up to 100 percent?

Ans:

The browser sizes the frames relative to the total sum of the values. If the cols attribute is set to 100%, 200% the browser displays two vertical frames with the second being twice as big as the first.




 

51. Which browsers support HTML5?

Ans:

The latest versions of Google Chrome, Apple Safari, Mozilla Firefox, and Opera all support most of the HTML5 features.

52. Name two new tags included in the HTML 5

Ans:

< Video> and < Audio> are new tags which are included in HTML5 version. They are mainly used as a replacement for Flash, Silverlight, and similar technologies to play multimedia items.

53. Do you know which are two semantic tags are included in HTML5 version?

Ans:

The < article> and < section> tags are two new tags that are included in HTML5. Articles can be composed of multiple sections that can have multiple articles. An article tag represents a full block of content which is a section of a bigger whole.

54. What is < figure> in HTML5?

Ans:

This tag represents a piece of self-contained flow content. It is mostly used as a single unit as a reference the main flow of the document.

55. What is the use of Canvas element?

Ans:

The canvas element helps to build charts, graphs, bypass Photoshop to create 2D images and place them directly into HTML5 code.

56. What are the new FORM elements which are available in HTML5?

Ans:

The new Form elements in HTML5 offers much better functionality than the earlier versions.

The tags given provided to carry out these functions are:

  1. – This tag is use to specify a list of options for input controls.< datalist> – This tag is use to specify a list of options for input controls.
  2. < keygen> – This tag represents a key-pair generator field.
  3. < output> – It represents the result of any scripting calculation.

57. Tell me two benefits of HTML5 Web Storage

Ans:

Two main benefits of HTML5 Web Storage:

  • It can store up to 10 MB data which is certainly more than what cookies have.
  • Web storage data cannot be transferred with the HTTP request. It helps to increase the performance of the application.

58. What are two types of Web Storage in HTML5?

Ans:

Two storage types of HTML5 are:

Session Storage: It stores data of current session only. It means that the data stored in session storage clear automatically when the browser is closed.

Local Storage: Local storage is another type of HTML5 Web Storage. In local storage, data is not deleted automatically when the current browser window is closed.

59. What is the Application Cache in HTML5 and why it is used?

Ans:

The Application Cache concept means that a web application is cached. It can be accessible without the need for internet connection.
Some advantages of Application Cache:

Offline browsing – Web users can also use the application when they are offline.
Speed – Cached resources load quicker
Reduce the server load – The web browser will only download updated resources from the server.

60. Explain five new input types provided by HTML5 for forms?

Ans:

Following are the important, new data types offered by HTML5:

  • Date: It allows the user to select a date.
  • datetime-local: This input type allows the user to select a date and time without time zone.
  • datetime: This input type allows the user to select a date and time with time zone.
  • month: It enables the user to select a month and year
  • email: These input fields used to contain an e-mail address.

 

61. What were some of the key goals and motivations for the HTML5 specification?

Ans:

HTML5 was designed to replace both HTML 4, XHTML, and the HTML DOM Level 2.
Major goals of the HTML specification were to:

  • Deliver rich content (graphics, movies, etc.) without the need for additional plugins (e.g., Flash).
  • Provide better semantic support for web page structure through the introduction of new structural element tags.
  • Provide a stricter parsing standard to simplify error handling, ensure more consistent cross-browser behavior, and simplify backward compatibility with documents written to older standards.
  • Provide better cross-platform support (i.e., to work well whether running on a PC, Tablet, or Smartphone).

62. What are some of the key new features in HTML5?

Ans:

Key new features of HTML5 include:

  • Improved support for embedding graphics, audio, and video content via the new < canvas>, < audio>, and < video> tags.
  • Extensions to the JavaScript API such as geolocation and drag-and-drop as well for storage and caching.
  • Introduction of “web workers”.
  • Several new semantic tags were also added to complement the structural logic of modern web applications. These include the < main>, < nav>, < article>, < section>, < header>, < footer>, and < aside> tags.
  • New form controls, such as < calendar>, < date>, < time>, < email>, < url>, and < search>.
    ,

63. What are “web workers”?

Ans:

Web workers at long last bring multi-threading to JavaScript.

A web worker is a script that runs in the background (i.e., in another thread) without the page needing to wait for it to complete. The user can continue to interact with the page while the web worker runs in the background. Workers utilize thread-like message passing to achieve parallelism.

64. How to include a frameset inside another frameset?

Ans:

One frameset can be defined inside another frameset if the accessing permission are provided directly. The frameset can be stored by using the JavaScript in the document that is being written by the user and the script is as follows:

<SCRIPT TYPE=” text/javascript”>
if (parent.location.href == self.location.href)
{
if (window.location.href.replace)
window.location.replace(‘frame.html’);
else
// causes problems with back button, but works
window.location.href = ‘frame.html’;
}
</ SCRIPT>

The anchor <a> tag is used to link the frameset that can be used to restore the frames that has been stored.
<A HREF=” frameset.html” TARGET=”_top”>Restore the frame

There is always a separate frameset document written for every content document. The frameset documents are generated automatically. The content document can be linked separately rather than linking them together.

65. Discuss the differences between an HTML specification and a browser’s implementation thereof.

Ans:

HTML specifications such as HTML5 define a set of rules that a document must adhere to in order to be “valid” according to that specification. In addition, a specification provides instructions on how a browser must interpret and render such a document.

A browser is said to “support” a specification if it handles valid documents according to the rules of the specification. As of yet, no browser supports all aspects of the HTML5 specification (although all of the major browser support most of it), and as a result, it is necessary for the developer to confirm whether the aspect they are making use of will be supported by all of the browsers on which they hope to display their content. This is why cross-browser support continues to be a headache for developers, despite the improved specificiations.

In addition, while HTML5 defines some rules to follow for an invalid HTML5 document (i.e., one that contains syntactical errors), invalid documents may contain anything, and it is impossible for the specification to handle all possibilities comprehensively. Thus, many decisions about how to handle malformed documents are left up to the browser.



 

66. What is HTML5 Web Storage? Explain localStorage and sessionStorage.

Ans:

With HTML5, web pages can store data locally within the user’s browser.

Earlier, this was done with cookies. However, Web Storage is more secure and faster. The data is not included with every server request, but used ONLY when asked for.

The data is stored in name/value pairs, and a web page can only access data stored by itself. Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.

The difference between localStorage and sessionStorage involves the lifetime and scope of the storage.

Data stored through localStorage is permanent: it does not expire and remains stored on the user’s computer until a web app deletes it or the user asks the browser to delete it. SessionStorage has the same lifetime as the top-level window or browser tab in which the script that stored it is running. When the window or tab is permanently closed, any data stored through sessionStorage is deleted.

Both forms of storage are scoped to the document origin so that documents with different origins will never share the stored objects. But sessionStorage is also scoped on a per-window basis. If a user has two browser tabs displaying documents from the same origin, those two tabs have separate sessionStorage data: the scripts running in one tab cannot read or overwrite the data written by scripts in the other tab, even if both tabs are visiting exactly the same page and are running exactly the same scripts

67. What is the difference between span and div?

Ans:

The difference is that span gives the output with display: inline and div gives the output with display: block.

span is used when we need our elements to be shown in a line, one after the other.

68. What is the Geolocation API in HTML5?

Ans:

HTML5’s Geolocation API lets users share their physical location with chosen web sites. JavaScript can capture a user’s latitude and longitude and can send it to the back-end web server to enable location-aware features like finding local businesses or showing their location on a map.

Today, most browsers and mobile devices support the Geolocation API. The Geolocation API works with a new property of the global navigator object.

A Geolocation object can be created as follows:

var geolocation = navigator.geolocation;

The geolocation object is a service object that allows widgets to retrieve information about the geographic location of the user’s device.

69. What’s one main result if you do not specify a doctype in an HTML page?

Ans:

New HTML5-specific tags will not be interpreted by the browser.

70. __________ can be used to advise the browser to download media content in the background to improve playback.

a) poster
b) autobuffer
c) buffer
d) data-X

Ans: b

Explanation: It suggests to the browser that it should load as much of the resource as possible. As long as the browser’s own media cache isn’t full, it will keep on downloading.

71. The _________ element is used to render simple graphics such as line art, graphs, and other custom graphical elements on the client side.

a) metadata
b) css
c) canvas
d) art

Ans: c
Explanation: The canvas element is part of HTML5 and allows for dynamic, scriptable rendering of 2D shapes and bitmap images.

72. State true or False. “Prior to HTML5 in web market, traditionally, multimedia has been inserted with the concept of tag-based multimedia back”.

a) True
b) False

Ans: b
Explanation: Traditionally,multimedia has been inserted with the embed and object elements, particularly when inserting Adobe Flash, Apple QuickTime, Windows Media, and other formats.




 

73. What more needs to be achieved to fulfil the promises of the Open Web Platform?

a) Security and Privacy
b) Performance and Tuning
c) Media and Real-Time Communications
d) All of the mentioned

Ans: d
Explanation: W3C CEO Jeff Jaffe states that “now that HTML5 is done, W3C should do more to strengthen the parts of the Open Web Platform that developers most urgently need for success.

74. State whether the given statement is true or false. “HTML5 brings to the Web video and audio tracks without needing plugins”.

a) True
b) False

Ans: a
Explanation: The World Wide Web Consortium (W3C) published a Recommendation of HTML5, the fifth major revision of the format used to build Web pages and applications, and the cornerstone of the Open Web Platform.
Sanfoundry Global Education & Learning Series – HTML.

75. Compare HTML & XML

Ans:

Criteria

HTML

XML

Deployed for

Rendering things on screen

Describing what things are

Functioning area

Human to computer interaction

Computer to computer interaction

Can explain what data means

No

Yes

76. What is $() in jQuery library?

Ans:

The $() function is an alias of jQuery() function, at first it looks weird and makes jQuery code cryptic, but once you get used to it, you will love it’s brevity. $() function is used to wrap any object into jQuery object, which then allows you to call various method defined jQuery object. You can even pass a selector string to $()function, and it will return jQuery object containing an array of all matched DOM elements. I have seen this jQuery asked several times, despite it’s quite basic, it is used to differentiate between developer who knows jQuery or not.

77. What are the advantage of using jQuery?

Ans:

  • Easy to use and learn.
  • Easily expandable.
  • Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)
  • Easy to use for DOM manipulation and traversal.
  • Large pool of built in methods.
  • AJAX Capabilities.
  • Methods for changing or applying CSS, creating animations.
  • Event detection and handling.
  • Tons of plug-ins for all kind of needs.

78. Difference between ID selector and class selector in jQuery?

Ans:

If you have used CSS, then you might know the difference between ID and class selector, It’s same with jQuery. ID selector uses ID e.g. #element1 to select element, while class selector uses CSS class to select elements. When you just need to select only one element, use ID selector, while if you want to select a group of element, having same CSS class than use class selector. There is good chance that, Interview will ask you to write code using ID and class selector. From syntax perspective, as you can see, another difference between ID and class selector is that former uses “#” and later uses “.” character. 

79. Difference between $(this) and this keyword in jQuery?

Ans:

Could be a tricky questions for many jQuery beginners, but indeed it’s simplest one. $(this) returns a jQuery object, on which you can call several jQuery methods e.g. text() to retrieve text, val() to retrieve value etc, while this represent current element, and it’s one of the JavaScript keyword to denote current DOM element in a context. You can not call jQuery method on this, until it’s wrapped using $() function i.e. $(this).

79. What is main advantage of loading jQuery library using CDN?

Ans:

This is slightly advanced jQuery question, and don’t expect that jQuery beginners can answer that. Well, apart from many advantages including reducing server bandwidth and faster download, one of the most important is that, if browser has already downloaded same jQuery version from same CDN, than it won’t download it again. Since now days, almost many public websites use jQuery for user interaction and animation, there is very good chance that browser already have jQuery library downloaded. Curious reader, please see the answer for in depth analysis.

80. How do CSS precedence/cascading rules work? How does the !important directive affect the rules?

Ans:

CSS style rules “cascade” in the sense that they follow an order of precedence. Global style rules apply first to HTML elements, and local style rules override them. For example, a style defined in a style element in a webpage overrides a style defined in an external style sheet. Similarly, an inline style that is defined in an HTML element in the page overrides any styles that are defined for that same element elsewhere.The !important rule is a way to make your CSS cascade but also have the rules you feel are most crucial always be applied. A rule that has the !important property will always be applied no matter where that rule appears in the CSS document. So if you wanted to make sure that a property always applied, you would add the !important property to the tag. So, to make the paragraph text always red, in the above example, you would write:p { color: #ff0000 !important; }p { color: #000000; }


 

81. What is a class? What is an ID?

Ans:

A class is a style (i.e., a group of CSS attributes) that can be applied to one or more HTML elements. This means it can apply to instances of the same element or instances of different elements to which the same style can be attached. Classes are defined in CSS using a period followed by the class name. It is applied to an HTML element via the class attribute and the class name.

The following snippet shows a class defined, and then it being applied to an HTML DIV element.

.test {font-family: Helvetica; font-size: 20; background: black;}

test

Also, you could define a style for all elements with a defined class. This is demonstrated with the following code that selects all P elements with the column class specified.

p.column {font-color: black;}

An ID selector is a name assigned to a specific style. In turn, it can be associated with one HTML element with the assigned ID. Within CSS, ID selectors are defined with the # character followed by the selector name.

The following snippet shows the CSS example1 defined followed by the use of an HTML element’s ID attribute, which pairs it with the CSS selector.

#example1: {background: blue;}

82. What is Grouping?

Ans:

When more than one selector shares the same declaration, they may be grouped together via a comma-separated list; this allows you to reduce the size of the CSS (every bit and byte is important) and makes it more readable. The following snippet applies the same background to the first three heading elements.h1, h2, h3 {background: red;}

83. What is HTML?

Ans:

HTML is short for HyperText Markup Language, and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web. HTML documents are made up of two things: the content and the tags that formats it for proper display on pages.

84. What is “Semantic HTML?”

Ans:

Semantic HTML is a coding style where the tags embody what the text is meant to convey. In Semantic HTML, tags like for bold, and for italic should not be used, reason being they just represent formatting, and provide no indication of meaning or structure. The semantically correct thing to do is use and . These tags will have the same bold and italic effects, while demonstrating meaning and structure (emphasis in this case).

85. Do all HTML tags come in pair?

Ans:

No, not all HTMLS tags come in pair. For e.g. ,

86. What are some of the common lists that can be used when designing a page?

Ans:

Some of the common lists that can be used are:

a) Ordered list
b) Unordered list
c) Definition list
d) Menu list
e) Directory list

87. What is the advantage of collapsing white space?

Ans:

The browser collapses the multiple white spaces into a single white space in HTML.
This allows the developers to arrange the HTML code in a well organized and legible format.

88. Is it possible to list elements straight in an html file?

Ans:

Yes, it is possible with the use of indents.

89. Does a hyperlink apply only to text?

Ans:

No. The hyperlinks can be applied to both text as well as the images.
It means that even the images can become clickable links with a capability to take the visitor to the next page.

90. What hierarchy is being followed when in style sheets?

Ans:

Inline style takes priority over embedded style sheets.
Embedded style take priority over external style sheets.
If a single selector includes three different style definitions, the definition that is closest to the actual tag gets the priority.



 

91. What happens if the list-style-type property is used on a non-list element like a paragraph?

Ans:

Here the property will be ignored without having any effect on the paragraph.

92. What is the advantage of using frames?

Ans:

Frames make it easier to navigate through a site.
The links that appear in the frame can appear through out the site.

93. How can I hide my source?

Ans:

No. you can’t hide your source as it is required by the browser to display your document.

94. You want only a vertical scrollbar and no horizontal scrollbar on your page. How would you do it?

Ans:

This can be done by defining the frame with SCROLLING = auto and having content to just fit into this frame.
SCROLLING=”yes” gets the scroll bar on both the sides, even when not needed.
SCROLLING=”no” doesn’t get the scrollbars at all, even when they are needed.




 

95. Explain Non Breaking space in HTML.

Ans:

When we add many spaces in the content then HTML remove all space except one space this is Non Breaking Space. To overcome this problem we use ‘& nbsp;'(without space between & and nbsp;). Suppose we want to add 3 space between two words then we have to use & nbsp; three time.

Example:
actual code:- hello I m Rohit Srivastava.
Display as:- Hello I m Rohit Srivastava.
But when we use & nbsp:
Actual code:- Hello & nbsp; & nbsp ; & nbsp; I m Rohit Srivastava.
Display as:- Hello I m Rohit Srivastava
NOTE: (without space between & and nbsp;)

96. Explain Cell Padding and Cell Spacing.

– Cell Padding : It refers to the gap or space between the cell content and cell border or cell wall.

– Cell Spacing : It refers to the gap between the two cells of same tables.

In HTML cell spacing and padding both are used with Table Border layou

97. What is difference between HTML and XHTML?

Ans:

The differences between HTML and XHTML are:

  1. HTML is application of Standard Generalized Markup Language(SGML) whereas XML is application of Extensible Markup Language(XML).

  2. HTML is a static Web Page whereas XHTML is dynamic Web Page.

  3. HTML allows programmer to perform changes in the tags and use attribute minimization whereas XHTML when user need a new markup tag then user can define it in this.

  4. HTML is about displaying information whereas XHTML is about describing the information.

98. How many types CSS can be include in HTML?

Ans:

There are three ways to include the CSS with HTML:

Inline CSS : It is used when only small context is to be styled.

To use inline styles add the style attribute in the relevant tag.

External Style Sheet : Is used when the style is applied to many pages.

Each page must link to the style sheet using the tag. The tag goes inside the head section.

Internal Style Sheet : Is used when a single document has a unique style.

Internal styles sheet needs to put in the head section of an HTML page.

 

 

99. What is CSS?

Ans:

CSS stands for Cascading Style Sheets. By using CSS with HTML we can change the look of the web page by changing the font size and color of the font. CSS plays an important role in building the website. Well written CSS file can be used to change the presentation of each web page. By including only one CSS file. It gives web site developer and user more control over the web pages.

100. What is difference between HTML and HTML5?

Ans:

The differences between HTML and HTML5 are:

  1. Document of HTML is very large as compare to the HTML5.
  2. Audio and Video tags are not present in HTML whereas HTML5 contains audio and video tags.
  3. Vector technology is not integral part of HTML whereas HTML5 Vector technology is the integral part of it.
  4. HTML supported by all old browsers whereas HTML5 is supported by new browser.
  5. In HTML web sockets are not available whereas in HTML5 Full duplex communication channel is present.

 

101. What is the Use of SPAN in HTML and give one example?

Ans:

SPAN : Used for the following things:

  1. Highlight the any color text
  2. For adding colored text
  3. For adding background image to text.


 

102. What is the importance of Doctype in HTML?

Ans:

Doctype tag is not a HTML tag, it is just an instruction that is passed to the web browser to check for the information that is being provided by the markup language in which the page is written. Doctype is sometimes referred as Document type definition (DTD) that describes some rules that has to be followed while writing the markup language so to make the web browser understand the language and the content correctly. Doctype is very important to be placed in the beginning of the HTML and before thetag to allow easy rendering of the pages that are used.

103. What are the different types of entities in HTML?

Ans:

The different types of entities that are present in HTML are < (less than) or > (greater then). It allows the special or the reserved characters are matched with the source code and then it is saved.

The sample code is being given by:

&entity_name;

OR

_number;

There is always a concept associated with it that will create more simpler provision to avoid the spaces that are being coming in between the characters or the text.

104. What does the elements mean in syntax given for URL in HTML?

Ans:

URL stands for Uniform Resource locater. This helps just like the Internet pooling concept where the people recognize themselves and others people connected together with each other. URL allows a document to be located on World Wide Web (www).

The example of the URL is as follows with the complete element:

scheme://host.domain:port/path/filename

This code has got with no meaning but there are some elements that are defined:

scheme – Is the type of internet service. In this HTTP can be used which has to most common type.

Host – It is used to control the host name and fetch the information from other templates as well.

Domain – It defines the internet domain that is google.com.

:port – It defines the port number on the Host where the default port that is being used is 80.

path – This defines the path of the server that consists of a hierarchical directory structure.

filename – It defines the unique name for the file or the document that saves it.