HTML Interview Questions
What do you mean by HTML?
HTML is known as Hypertext Markup Language. This Language is used for World Wide Web. It’s a standard Language which is used for creating the web pages.
What are the parts of the HTML page?
Basically, there are two parts of the web pages: Content and Tags which are responsible for the format of an HTML page.
What do you mean by Tags?
In HTML page content is placed between the Tags which are basically responsible for the formatting of the page. Tags are written between less than symbol (<) and greater than (>) symbol. For Example: <h1>text</h1>
In the above example <h1> is the opening tag and </h1> is the closing tag.
What is the advantage of grouping several checkboxes together?
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.
What are applets?
This is the frequently asked HTML Interview Questions in an HTML Interview. Applets are the small program which can be embedded with the web pages to perform some specific functionality like computation, animation.
What is the advantage of collapsing white space?
- 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.
Does a hyperlink apply only to text?
- 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.
- This can be done simply by using <a href> tag.
What hierarchy is being followed when in style sheets?
- 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.
What is the advantage of using frames?
- Frames make it easier to navigate through a site.
- The links that appear in the frame can appear through out the site.
Why doesn’t <TABLE WIDTH=”100%”> use the full browser width?
- This is because the graphical browser is designed to leave a margin between the display area and actual content.
- The navigator also leaves some space for the scroll bar on the right side of the display area. Though, if the page is not long enough, the scroll bar doesn’t appear.
Explain Non Breaking space in HTML.
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.
The differences between HTML and XHTML are:
- HTML is application of Standard Generalized Markup Language(SGML) whereas XML is application of Extensible Markup Language(XML).
- HTML is a static Web Page whereas XHTML is dynamic Web Page.
- 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.
- HTML is about displaying information whereas XHTML is about describing the information.
How many types CSS can be include in HTML?
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 <link> tag. The <link> 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, by using the <style> tag, like this:
What are logical and physical tags in HTML?
- Logical tags are used to tell the meaning of the enclosed text. The example of the logical tag is <strong> </strong> tag. When we enclosed text in strong tag then it tell the browser that enclosed text is more important than other text.
- Physical texts are used to tell the browser that how to display the text enclosed in the physical tag.
Some example of the physical tags are: <b>, <big>, <i>
What is the importance of Doctype in HTML?
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 the <HTML> tag to allow easy rendering of the pages that are used.
Why it is important to set the meta information?
Metadata is the data about the data or the information about the data. There is a tag <meta> that is being provided for the HTML document.
This information won’t be displayed anywhere and will not be visible to the user. It will be parsable by the machine which will parse it according to the requirement.
It consists of the elements that are related to the page description, keywords, document related element. The tag that is being used resides in the <head> section in HTML.
The meta information is being used by the web browser or by the search engines to rank and let the user find the pages easily.
How to add helper plug-ins on the webpage using HTML?
A helper application is a program that is used in the browser to help the users with lots of information that is not being provided with the applications.
These helper application is known as Plug-ins. Helper application includes audio, video, etc. The tag that is used to embed is <object>.
Helper application allows easy incorporation of audio and video that is controlled by the user. Helper application allow the control over the volume setting and other functions like play, stop,etc.
What is main advantage of loading jQuery library using CDN?
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.
What are inline elements and block-level elements in HTML?
Block elements are the blocks that take the full available width and always start from a new line. It will stretch itself to the full available width of the available container width. Block level elements are <div>, <p>, <img>, <section> and many more.
Inline elements are the elements that will only take the width that is required to fit into the container.
Can we change inline elements into block-level elements?
Yes, we can change inline elements into block-level elements by adding display equal to block in its CSS tag. Writing it will change the inline elements into block elements and then inline elements will also take the full width of the container.
What is an image map?
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.
What is the use of alternative text in image mapping?
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.
What are style sheets?
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.
Do style sheets limit the number of new style definitions that can be included within the brackets?
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.
Can I specify fractional weight values such as 670 or 973 for font weight?
Implementation largely depends on the browser, but the standard does not support fractional weight values. Acceptable values must end with two zeroes.
What is the hierarchy that is being followed when it comes to style sheets?
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.
Can several selectors with class names be grouped together?
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.
What happens if you open the external CSS file in a browser?
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 it using <link/> tag within another HTML document.