HTMI Interview Questions and Answers for Freshers pdf & experienced Candidates

1. What is HTML?
Answer
HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on the Internet.



2. List various font attributes used in style sheet?
Answer
  • font-style
  • font-variant
  • font-weight
  • font-size/line-height
  • font-family
  • caption
  • icon
  • menu
  • message-box
  • small-caption
  • status-bar

3. How do I create frames? What is a frameset?
Answer
Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.

You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then display your content documents inside those frames. The frameset document should also include alternative non-framed content in a NOFRAMES element. The HTML 4 frames model has significant design flaws that cause usability problems for web users.
 Frames should be used only with great care.


4. What are style sheet properties?
Answer
  • CSS Background
  • CSS Text
  • CSS Font
  • CSS Border
  • CSS Outline
  • CSS Margin
  • CSS Padding
  • CSS List
  • CSS Table


5. Explain in brief about the term CSS?
Answer
A stylesheet language used to describe the presentation of a document written in a markup language.
Cascading Style Sheets are a big breakthrough in Web design because they allow developers to control the style and layout of multiple Web pages all at once.


 6. Do URL's have quotes or not?
Answer
Double or single quotes in URLs are optional. The tree following examples are equally valid:

BODY {background: url(pics/wave.png) blue}
BODY {background: url("pics/wave.png") blue}
BODY {background: url('pics/wave.png') blue}

7. What is the percentage value in 'font-size' relative to?
Answer
It is relative to the parent element's font-size. For example, if the style sheet says:

H1 {font-size: 20pt;}
SUP {font-size: 80%;}

...then a <SUP> inside an <H1> will have a font-size of 80% times 20pt, or 16pt.


8. Can I attach more than one declaration to a selector?
Answer
Yes. If more than one declaration is attached to a selector they must appear in a semi colon separated list, e.g.;

Selector {declaration1; declaration2}
P {background: white; color: black}


9. Can I include comments in my Style Sheet?
Answer
Yes. Comments can be written anywhere where whitespace is allowed and are treated as white space themselves. Anything written between /* and */ is treated as a comment (white space).
NOTE: Comments cannot be nested.


10. What is property?
Answer
Property is a stylistic parameter (attribute) that can be influenced through CSS, e.g. FONT or WIDTH. There must always be a corresponing value or values set to each property,
 e.g. font: bold or font: bold san-serif.


11. Are Style Sheets case sensitive?
Answer
No. Style sheets are case insensitive. Whatever is case insensitive in HTML is also case insensitive in CSS. However, parts that are not under control of CSS like font family names and URLs can be case sensitive - IMAGE.gif and image.gif is not the same file.

12. What is cascade?
Answer
Cascade is a method of defining the weight (importance) of individual styling rules thus allowing conflicting rules to be sorted out should such rules apply to the same selector.

Declarations with increased weight take precedence over declaration with normal weight:

P {color: white ! important} /* increased weight */
P (color: black} /* normal weight */

13. What is CSS declaration?
Answer
CSS declaration is style attached to a specific selector. It consists of two parts; property which is equivalent of HTML attribute, e.g. text-indent: and value which is equivalent of HTML value, e.g. 10pt.
 NOTE: properties are always ended with a colon.


14. What is selector?
Answer
CSS selector is equivalent of HTML element(s). It is a string identifying to which element(s) the corresponding declaration(s) will apply and as such the link between the HTML document and the style sheet.

For example in P {text-indent: 10pt} the selector is P and is called type selector as it matches all instances of this element type in the document.

in P, UL {text-indent: 10pt} the selector is P and UL (see grouping); in .class {text-indent: 10pt} the selector is .class (see class selector).


15. Can Style Sheets and HTML stylistic elements be used in the same document?
Answer
Yes. Style Sheets will be ignored in browsers without CSS-support and HTML stylistic elements used.

16. Can CSS be used with other than HTML documents?
Answer
Yes. CSS can be used with any ny structured document format. e.g. XML, however, the method of linking CSS with other document types has not been decided yet.


17. How do I place text over an image?
Answer
To place text or image over an image you use the position property. The below example is supported by IE 4.0. All you have to do is adapt the units to your need.

<div style="position: relative; width: 200px; height: 100px">
<div style="position: absolute; top: 0; left: 0; width: 200px">
<image>
</div>
<div style="position: absolute; top: 20%; left: 20%; width: 200px">
Text that nicely wraps
</div>
</div>


18. What is inline style? How to link?
Answer
Inline style is the style attached to one specific element. The style is specified directly in the start tag as a value of the STYLE attribute and will apply exclusively to this specific element occurrence.

<P STYLE="text-indent: 10pt">Indented paragraph</P>

19. What is embedded style? How to link?
Answer
Embedded style is the style attached to one specific document. The style information is specified as a content of the STYLE element inside the HEAD element and will apply to the entire document.

<HEAD>
<STYLE TYPE="text/css">
<!--
P {text-indent: 10pt}
-->
</STYLE>
</HEAD>

Note: The styling rules are written as a HTML comment, that is, between <!-- and --> to hide the content in browsers without CSS support which would otherwise be displayed.


20. What is CSS rule 'ruleset'?
Answer
There are two types of CSS rules: ruleset and at-rule. Ruleset identifies selector or selectors and declares style which is to be attached to that selector or selectors. For example P {text-indent: 10pt} is a CSS rule. CSS rulesets consist of two parts: selector, e.g. P and declaration, e.g. {text-indent: 10pt}.

P {text-indent: 10pt} - CSS rule (ruleset)
{text-indent: 10pt} - CSS declaration
text-indent - CSS property
10pt - CSS value


21. Is CSS case sensitive?
Answer
Cascading Style Sheets (CSS) is not case sensitive. However, font families, URLs to images, and other direct references with the style sheet may be.

The trick is that if you write a document using an XML declaration and an XHTML doctype, then the CSS class names will be case sensitive for some browsers.

It is a good idea to avoid naming classes where the only difference is the case, for example:

div.myclass { ...}
div.myClass { ... }

If the DOCTYPE or XML declaration is ever removed from your pages, even by mistake, the last instance of the style will be used, regardless of case.

22. What is external Style Sheet? How to link?
Answer
External Style Sheet is a template/document/file containing style information which can be linked with any number of HTML documents.
This is a very convenient way of formatting the entire site as well as restyling it by editing just one file.


23. What are Style Sheets?
Answer
Style Sheets are templates, very similar to templates in desktop publishing applications, containing a collection of rules declared to various selectors (elements).
The file is linked with HTML documents via the LINK element inside the HEAD element. Files containing style information must have extension .css, e.g. style.css.


24. How do I do multiple colors of text?
Answer
To do the multicolor text adjust the color of your font tag as:
< font color="blue">blue


25. How do I close a browser window with HTML code?
Answer
Use the below code example. < type="button" value="Close this window" onclick="self.close()">

26. How do I add scrolling text to my page?
Answer
Add a Tag of marquee.


27. What are the differences between cell spacing and cell padding?
Answer
Cell padding is used for formatting purpose which is used to specify the space needed between the edges of the cells and also in the cell contents. Cell spacing is one also used f formatting but there is a major difference between cell padding and cell spacing. It is as follows: Cell padding is used to set extra space which is used to separate cell walls from their contents.
But in contrast cell spacing is used to set space between cells.


28. What are differences between DIV and SPAN?
Answer
DIV is used to select a block of text so that one can apply styles to it. SPAN is used to select inline text and let users to apply styles to it. The main difference between DIV and SPAN is SPAN does not do formatting by itself. Also the DIV tag is used as a paragraph break as it creates a logical division of the document in which it is applied. This is in contrast to the SPAN as SPAN simply dos the functionality of
applying the style and alignment whatever was specified in it. DIV has ALIGN attribute in it which is not present in case of SPAN. Thus DIV is used in cases where one wants to apply styles to a block of text. But there may be situations in which there might not be clear well structured block of text to work with. In those cases one can opt to apply SPAN which is used to apply styles inline. That is in other words DIV is generally used for block of text and SPAN is generally used for words or sentences.


29. How to place a background for a single table cell?
Answer
You can put a background for a single table cell in two ways namely: Either by using HTML Using CSS

30. What is meant by iframe ?
Answer
iframe is used for creating an inline or floating frame. As most of know frames are mainly used to structure the page or for placing a menu bar on the side and so on. But iframe is used in a different context. That is in other words iframe is used to embed or insert content on a page of padding. This is done for several reasons. Say the content may be large enough that the user may wish to place it separately and scroll through it.


31. What are the attributes that make up a DHTML?
Answer
DHTML is called as Dynamic HTML. This is used to increase the interactive ability and the visual effect of the web pages which is loaded in the browser. The main technologies that are used in DHTML are namely:
* HTML
* JavaScript
* CSS which is also called as Cascading Style Sheet
* DOM also called as Document Object Model


32. How do I make a frame with a vertical scrollbar but without a horizontal scrollbar?
Answer
The only way to have a frame with a vertical scrollbar but without a horizontal scrollbar is to define the frame with SCROLLING="auto" (the default), and to have content that does not require horizontal scrolling. There is no way to specify that a frame should have one scrollbar but not the other.
 Using SCROLLING="yes" will force scrollbars in both directions (even when they aren't needed), and using SCROLLING="no" will inhibit all scrollbars (even when scrolling is necessary to access the frame's content). There are no other values for the SCROLLING attribute.


33. Can I use any HTML in the box?
Answer
Yes. Any HTML tag that your browser supports will work in the box. So you can carry tags from chapters to chapters and mix and match.

34. What is the difference between the HTML form methods GET and POST?
Answer
The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will find the CGI request data in:
* POST - post_args
* GET - httpargs


35. How can I specify background images?
Answer
With HTML, you can suggest a background image with the BACKGROUND attribute of the BODY element. Here is an example:

<body background="imagefile.gif" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#000080">

If you specify a background image, you should also specify text, link, and background colors since the reader's default colors may not provide adequate contrast against your background image. The background color may be used by those not using your background image. Authors should not rely on the specified background image since browsers allow their users to disable image loading or to override document-specified backgrounds.

36. How do I remove the border around frames?
Answer
Removing the border around frames involves both not drawing the frame borders and eliminating the space between the frames. The most widely supported way to display borderless frames is <FRAMESET ... BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>.

Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.) Also, removing the border around a frame makes it difficult to resize it, as this border is also used in most GUIs to change the size of the frame.

37. How do I specify page breaks in HTML?
Answer
There is no way in standard HTML to specify where page breaks will occur when printing a page. HTML was designed to be a device-independent structural definition language, and page breaks depend on things
like the fonts and paper size that the person viewing the page is using.

38. How do I link an image to something?
Answer
Just use the image as the link content, like this:

<a href=...><img src=... alt=...></a>


39. How can I eliminate the extra space after a tag?
Answer
HTML has no mechanism to control this. However, with CSS, you can set the margin-bottom of the form to 0. For example:
<form style="margin-bottom:0;" action=...>

You can also use a CSS style sheet to affect all the forms on a page:
form { margin-bottom: 0 ; }


40. How do I use forms?
Answer
The basic syntax for a form is: <FORM ACTION="[URL]">...</FORM>
When the form is submitted, the form data is sent to the URL specified in the ACTION attribute. This URL should refer to a server-side (e.g., CGI) program that will process the form data. The form itself should contain

* at least one submit button (i.e., an <INPUT TYPE="submit" ...> element),
* form data elements (e.g., <INPUT>, <TEXTAREA>, and <SELECT>) as needed, and
* additional markup (e.g., identifying data elements, presenting instructions) as needed.


41. What is a Hypertext link?
Answer
A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link's destination.


41. What is a DOCTYPE? Which one do I use?
Answer
According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies which version of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like HTML validators, which needed to determine which version of HTML a document used (or claimed to use).
Today, many browsers use the document's DOCTYPE declaration to determine whether to use a stricter, more standards-oriented layout mode, or to use a "quirks" layout mode that attempts to emulate older, buggy browsers.

0 comments: