YouTube Icon

Interview Questions.

Top 50 Html Interview Questions - Jul 25, 2022

fluid

Top 50 Html Interview Questions

Q1. Do Any Wysiwyg Editors Support The Creation Of Style Sheets? Any Text-based totally Html Editors?

As aid for CSS in browsers has matured in the closing year, both WYSIWYG and Text-primarily based HTML editors have appeared that allow the advent or the assistance of making Cascading Style Sheet syntax. There are now at least two dozen editors supporting CSS syntax in some form. The W3C maintains an up to date listing of those WYSIWYG and text-based editors.

Q2. How Do I Center A Table?

In your HTML, use

<div class="center">

<table>...</table>

</div>

In your CSS, use

div.Center 

textual content-align: middle;

 

div.Center desk 

margin-left: car;

margin-proper: auto;

textual content-align: left;

 

Q3. What Are The Differences Between Cell Spacing And Cell Padding?

Cell padding is used for formatting motive that's used to specify the gap wanted between the rims of the cells and also within the mobile contents. Cell spacing is one also used f formatting however there's a primary distinction among mobile padding and cell spacing. It is as follows: Cell padding is used to set extra area which is used to separate mobile walls from their contents. But in contrast mobile spacing is used to set area among cells.

Q4. Can Style Sheets And Html Stylistic Elements Be Used In The Same Document?

Yes. Style Sheets might be disregarded in browsers with out CSS-aid and HTML stylistic factors used.

Q5. How To Place A Background For A Single Table Cell?

You can positioned a history for a unmarried table cellular in  approaches namely: Either by the usage of HTML Using CSS

Q6. Must I Quote Property Values?

Generally no. However, values containing white areas, e.G. Font-circle of relatives names have to be quoted as white areas surrounding the font name are overlooked and whitespaces inside the font call are transformed to a unmarried area, therefore font names made from more than one phrase (e.G.) 'Times New Roman' are interpreted as three unique names: Times, New and Roman.

Q7. Which Set Of Definitions, Html Attributes Or Css Properties, Take Precedence?

CSS residences take priority over HTML attributes. If both are targeted, HTML attributes could be displayed in browsers without CSS guide but won't have any effect in browsers with CSS aid.

Q8. How Can I Show Html Examples Without Them Being Interpreted As Part Of My Document?

Within the HTML example, first update the "&" individual with "&amp;" everywhere it happens. Then replace the "&lt;" individual with "<" and the "&gt;" character with ">" in the same manner. 

Note that it could be appropriate to use the CODE and/or PRE factors while displaying HTML examples.

Q9. How To Trferring User To New Web Page Automatically?

You will need to apply the below meta tag. 

<META HTTP-EQUIV="Refresh" CONTENT="2"; URL="http://www.Yourname.Com"> 

Placing the above tag to your <HEAD></HEAD> will load yousite.Com in 2 seconds. 

Changing the two value on CONTENT="2" to some other fee will increase or lower the postpone until loading the new page.

Q10. How Do I Place Text Over An Image?

To location textual content or picture over an picture you operate the position property. The below instance is supported via IE 4.@All you have to do is adapt the gadgets in 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 well wraps

</div>

</div>

Q11. How Do I Close A Browser Window With Html Code?

Use the underneath code example. < type="button" value="Close this window" onclick="self.Close()">

Q12. How Do I Create A Button Which Acts Like A Link?

This is excellent done with a small shape:

<FORM ACTION="[URL]" METHOD=GET>

<INPUT TYPE=submit VALUE="Text on button">

</FORM>

If you want to line up buttons subsequent to each different, you may have to positioned them in a one-row desk, with each button in a separate mobile. 

Q13. What Are Cascading Style Sheets?

A Cascading Style Sheet (CSS) is a list of statements (also referred to as policies) which could assign diverse rendering houses to HTML factors. Style rules may be certain for a unmarried element occurrence, more than one factors, a whole document, or even more than one files straight away. It is viable to specify many distinctive rules for an element in distinct locations the usage of distinctive strategies. All these guidelines are amassed and merged (known as a "cascading" of styles) while the record is rendered to form a single fashion rule for each element.

Q14. What Is 'important' Declaration?

Important declaration is a statement with multiplied weight. Declaration with expanded weight will override declarations with ordinary weight. If each reader's and writer's fashion sheet comprise statements with crucial declarations the writer's assertion will override the reader's.

BODY historical past: white ! Critical; colour: black

In the example above the background property has expanded weight at the same time as the coloration assets has normal.

Q15. Do I Have To Memorize A Bunch Of Tags?

No. Most packages that assist you write HTML code already recognize most tags, and create them while you press a button. But you ought to recognize what a tag is, and how it works. That way you can accurate mistakes for your web page greater without problems.

Q16. Why Do Style Sheets Exist?

SGML (of which HTML is a spinoff) become meant to be a tool-unbiased method for conveying a record's structural and semantic content (its meaning.) It was never intended to deliver physical formatting facts. HTML has crossed this line and now incorporates many factors and attributes which specify visual fashion and formatting records. One of the main reasons for fashion sheets is to stop the creation of new HTML physical formatting constructs and once again separate fashion facts from document content material.

Q17. Can You Use Someone Else's Style Sheet Without Permission?

This is a extremely fuzzy problem. As with HTML tags, style sheet facts is given the usage of a special language syntax. Use of the language isn't copyrighted, and the syntax itself does no longer deliver any content - handiest rendering records.

It isn't a exceptional idea to reference an outside style sheet on a person else's server. Doing that is like referencing an in-line image from a person else's server to your HTML record. This can turn out to be overloading a server if too many pages all around the net reference the same item. It can not hurt to touch the author of a fashion sheet, if known, to discuss the use of the fashion sheet, however this may no longer be feasible. In any case, a nearby replica need to be created and used instead of referencing a remote copy.

Q18. What Is Property?

Property is a stylistic parameter (attribute) that may be inspired through CSS, e.G. FONT or WIDTH. There have to usually be a corresponing fee or values set to every belongings, e.G. Font: bold or font: ambitious san-serif.

Q19. How Do I Design For Backward Compatibility Using Style Sheets?

Existing HTML style strategies (such as <font SIZE> and <b>) may be without problems combined with style sheet specification techniques. Browsers that don't apprehend style sheets will use the older HTML formatting methods, and fashion sheets specs can control the arrival of those factors in browsers that assist CSS1.

Q20. How Do I Use Forms?

The fundamental syntax for a shape is: <FORM ACTION="[URL]">...</FORM>

When the shape is submitted, the form statistics is sent to the URL exact inside the ACTION characteristic. This URL have to refer to a server-side (e.G., CGI) software that will manner the shape statistics. The shape itself have to contain

* at the least one post button (i.E., an <INPUT TYPE="submit" ...> element),

* form records elements (e.G., <INPUT>, <TEXTAREA>, and <SELECT>) as wanted, and

* additional markup (e.G., figuring out facts factors, imparting commands) as wished.

Q21. What Browsers Support Style Sheets? To What Extent?

Microsoft's Internet Explorer model three.Zero Beta 2 and above supports CSS, as does Netscape Communicator four.Zero Beta 2 and above and Opera three.Five and above. Take observe that the early implementations in those browsers did now not aid ALL of the residences and syntax defined inside the full CSS1 specification and past. Later variations were getting tons toward full CSS1 compliance, however then comes the next hurdle - CSS2...It was one of these large soar over CSS1 that it has taken the browsers years yet to come close to supporting a majority of CSS2's capabilities. Mozilla and Opera's present day variations each offer top notch CSS requirements compliance. The Macintosh model of Internet Explorer is said to be very wonderful in its CSS capabilities as properly, however PC IE lags at the back of these implementations. Quite a few other implementations of CSS now exist in browsers that aren't as widely-used (along with Amaya, Arena and Emacs-W3), however insurance of functions in those files presently best covers Internet Explorer, NCSA Mosaic, Netscape and Opera browsers.

Q22. How Do I Make A Frame With A Vertical Scrollbar But Without A Horizontal Scrollbar?

The simplest manner to have a body with a vertical scrollbar however without a horizontal scrollbar is to define the body with SCROLLING="auto" (the default), and to have content that does not require horizontal scrolling. There is not any manner to specify that a frame need to have one scrollbar however no longer the opposite. Using SCROLLING="sure" will pressure scrollbars in both guidelines (even if they aren't wanted), and the use of SCROLLING="no" will inhibit all scrollbars (even when scrolling is important to get entry to the frame's content material). There are no other values for the SCROLLING characteristic.

Q23. Is Css Case Sensitive?

Cascading Style Sheets (CSS) is not case sensitive. However, font families, URLs to images, and different direct references with the style sheet can be.

The trick is that in case you write a document using an XML declaration and an XHTML doctype, then the CSS elegance names could be case touchy for a few browsers.

It is a good idea to avoid naming training in which the best distinction is the case, as an example:

div.Myclass  ...

Div.MyClass  ... 

If the DOCTYPE or XML announcement is ever removed out of your pages, even by way of mistake, the ultimate example of the style could be used, irrespective of case.

Q24. What Are Style Sheet Properties?

CSS Background

CSS Text

CSS Font

CSS Border

CSS Outline

CSS Margin

CSS Padding

CSS List

CSS Table

Q25. The Colors On My Page Look Different When Viewed On A Mac And A Pc.

The Mac and the PC use slightly different shade palettes. There is a 216 "browser safe" colour palette that both systems help; the Microsoft colour picker web page has some proper facts and links to different sources about this. In addition, the two structures use specific gamma (brightness) values, so a photograph that appears first-rate at the Mac can also appearance too darkish on the PC. The best way to deal with this trouble is to tweak the brightness of your photo so that it looks desirable on each systems.

Q26. Is There Anything That Can't Be Replaced By Style Sheets?

Quite a chunk clearly. Style sheets handiest specify records that controls show and rendering facts. Virtual fashion factors that carry the NATURE of the content cannot be replaced via fashion sheets, and hyperlinking and multimedia object insertion isn't part of fashion sheet functionality at all (although controlling how those gadgets seem IS a part of fashion sheets capability.) The CSS1 specification has long gone out of its manner to soak up ALL of the HTML capability utilized in controlling display and format traits. For greater statistics at the viable residences in CSS, see the Index DOT Css Property Index.

Rule of Thumb: if an HTML element or attribute offers cues as to how its contents have to be displayed, then some or all of its functionality has been absorbed via fashion sheets.

Q27. How Can I Allow File Uploads To My Web Site?

These matters are essential for Web-based totally uploads:

* An HTTP server that accepts uploads.

* Access to the /cgi-bin/ to position the receiving script. Prewritten CGI record-add scripts are to be had.

* A shape implemented something like this:

<form method="post" enctype="multipart/form-data" action="fup.Cgi">

File to upload: <input type=file name=upfile><br>

Notes approximately the record: <input type=text name=note><br>

<input type=submit value=Press> to upload the file!

</form>

Not all browsers assist form-based record add, so try and provide options in which possible.

The Perl CGI.Pm module helps document upload. The most recent variations of the cgi-lib.Pl library additionally aid document add. Also, in case you want to do report upload at the side of form-to-e-mail, the Perl package MIME::Lite handles electronic mail attachments.

Q28. How Do I Set The Focus To The First Form Field?

You cannot try this with HTML. However, you can consist of a script after the form that units the focal point to the appropriate field, like this: 

<form id="myform" name="myform" action=...>

<input type="text" id="myinput" name="myinput" ...>

</form>

<script type="text/javascript">

file.Myform.Myinput.Consciousness();

</script> 

A comparable approach uses <body onload=...> to set the point of interest, but a few browsers seem to system the ONLOAD occasion earlier than the entire record (i.E., the element with the shape) has been loaded.

Q29. Are Style Sheets Case Sensitive?

No. Style sheets are case insensitive. Whatever is case insensitive in HTML is likewise case insensitive in CSS. However, components that aren't underneath manipulate of CSS like font circle of relatives names and URLs can be case touchy - IMAGE.Gif and photo.Gif is not the same document.

Q30. How Can I Display An Image On My Page?

Use an IMG detail. The SRC characteristic specifies the region of the photo. The ALT characteristic gives alternate textual content for those not loading photographs. For instance:

<img src="logo.Gif" alt="ACME Products">

Q31. When I Try To Upload My Site, All My Images Are X's. How Do I Get Them To Load Correctly?

They are a few reasons that this could show up. The maximum common are:

@You're trying to use a .Bmp or .Tif or other non-supported file layout. You can simplest use .Gif and .Jpg at the web. You ought to convert documents that aren't .Gif or .Jpg right into a .Gif or .Jpg with your photo/photographs software.

@You've forgotten to add the graphic files. Double-Check.

@You've incorrectly connected to the pix. When you are starting out, attempt just the use of the record name in the <img> tag. If you have cat.Jpg, use 

img src="cat.Jpg">.

@Image file names are case-touchy. If your report is referred to as CaT.JpG, you cannot type cat.Jpg, you must kind CaT.JpG precisely inside the src.

@If all the above fail, re-add the photograph in BINARY mode. You may have by chance uploaded the photo in ASCII mode.

Q32. How Do I Create A Link?

Use an anchor detail. The HREF characteristic specifies the URL of the file that you want to hyperlink to. The following example links the textual content "Web Authoring FAQ" to <URL:http://www.Htmlhelp.Com/faq/html/>: 

<A HREF="http://www.Yoursite.Com/faq/html/">Web Authoring FAQ</A>

Q33. What Is Initial Value?

Initial fee is a default cost of the assets, this is the fee given to the foundation element of the document tree. All residences have an preliminary cost. If no particular cost is about and/or if a assets isn't inherited the initial price is used. For instance the historical past property isn't always inherited, but, the history of the discern element shines thru because the initial value of historical past property is trparent. 

<P style="background: red">Hello <strong>World </strong> </P>

Content of the element P will even have red heritage

Q34. How Can I Specify Background Images?

With HTML, you may recommend a history image with the BACKGROUND attribute of the BODY detail. Here is an example: 

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

If you specify a background photograph, you should additionally specify textual content, link, and heritage shades for the reason that reader's default colorations won't offer adequate assessment against your history photograph. The background color may be utilized by the ones now not using your historical past image. Authors should now not depend upon the desired historical past image because browsers permit their users to disable photograph loading or to override file-specified backgrounds.

Q35. How Can I Copy Something From A Webpage To My Webpage?

1: Plaintext or any text statistics viewable out of your browser can be without problems copied like every other text from every other document.

2: HTML and web scripts - you will want to view the web page's supply code. In the page's supply code, copying the tags as well as all of the statistics in-between those tags will generally permit the script to work on your web web page.

Three: Images, sounds, or movies - Almost all pictures, sounds, and films may be copied to your pc after which regarded to your web site. Images can be effortlessly copied from a website by means of right-clicking an image and selecting "Save Picture as" or "Save Image as". Unless the sound or films report has an instantaneous link to download and shop the file to a particular area for your hard disk force or to view your Internet browser's cache and find the sound or film file saved within the cache.

@Embedded items - Looking at the supply code of the item to determine the call of the report and how it is loaded, and copy both the code and the report.

Q36. How Do I Eliminate The Blue Border Around Linked Images?

In your HTML, you can specify the BORDER characteristic for the picture: 

<a href=...><img src=... Alt=... Border="0"></a> 

However, notice that putting off the border that suggests an picture is a link makes it harder for users to differentiate speedy and effortlessly which pictures on an internet web page are clickable.

Q37. Why Use Style Sheets?

Style sheets allow a far more degree of layout and show manipulate than has ever been possible to this point in HTML. The quantity of format coding essential to govern display traits may be significantly decreased through the usage of outside style sheets which may be utilized by a group of files. Also, multiple style sheets may be integrated from one-of-a-kind assets to shape a cohesive tapestry of styles for a file. Style sheets also are backward like minded - They can be combined with HTML styling elements and attributes so that older browsers can view content as supposed.

Q38. What Is The Percentage Value In 'font-length' Relative To?

It is relative to the determine element's font-length. For example, if the fashion sheet says:

H1 font-length: 20pt;

SUP font-size: eighty%;

...Then a <SUP> inside an <H1> could have a font-length of eighty% times 20pt, or 16pt.

Q39. Why Do My Links Open New Windows Rather Than Update An Existing Frame?

If there's no current frame with the name you used for the TARGET characteristic, then a new browser window might be opened, and this window will be assigned the call you used. Furthermore, TARGET="_blank" will open a brand new, unnamed browser window.

In HTML 4, the TARGET attribute fee is case-insensitive, in order that abc and ABC both talk over with the same body/window, and _top and _TOP both have the same which means. However, maximum browsers deal with the TARGET attribute price as case-touchy and do no longer understand ABC as being the same as abc, or _TOP as having the unique which means of _top.

Also, a few browsers consist of a security function that prevents documents from being hijacked via third-birthday celebration framesets. In these browsers, if a record's link targets a frame described by a frameset report that is positioned on a unique server than the file itself, then the link opens in a new window as a substitute.

Q40. What Is Selector?

CSS selector is equal of HTML element(s). It is a string identifying to which element(s) the corresponding assertion(s) will practice and as such the hyperlink among the HTML document and the style sheet.

For example in P text-indent: 10pt the selector is P and is called type selector because it matches all times of this detail type in the record.

In P, UL text-indent: 10pt the selector is P and UL (see grouping); in .Elegance text-indent: 10pt the selector is .Class (see magnificence selector).

Q41. What Is Inline Style? How To Link?

Inline fashion is the style attached to 1 unique element. The style is designated at once inside the begin tag as a cost of the STYLE attribute and could observe completely to this specific element prevalence.

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

Q42. How Can I Include Comments In Html?

Technically, on account that HTML is an SGML software, HTML uses SGML remark syntax. However, the total syntax is complex, and browsers do not aid it in its entirety besides. Therefore, use the following simplified rule to create HTML comments that each have legitimate syntax and paintings in browsers:

An HTML comment starts with "<!--", ends with "-->", and does no longer comprise "--" or ">" everywhere in the remark. 

The following are examples of HTML remarks:

* <!-- This is a comment. -->

* <!-- This is another comment,

and it continues onto a second line. -->

* <!---->

Do not put comments inner tags (i.E., among "<" and ">") in HTML markup.

Q43. Can I Nest Tables Within Tables?

Yes, a table can be embedded inner a cell in another table. Here's a simple example: 

<table>

<tr>

<td>that is the primary cell of the outer desk</td>

<td>that is the second one cellular of the outer table,

with the internal desk embedded in it

<table>

<tr>

<td>this is the primary mobile of the inner desk</td>

<td>this is the second one mobile of the internal desk</td>

</tr>

</table>

</td>

</tr>

</table>

The primary caveat about nested tables is that older versions of Netscape Navigator have issues with them if you do not explicitly near your TR, TD, and TH factors. To keep away from problems, include every </tr>, </td>, and </th> tag, despite the fact that the HTML specs don't require them. Also, older versions of Netscape Navigator have issues with tables which are nested extremely deeply (e.G., tables nested ten deep). To avoid problems, keep away from nesting tables quite a number deep. You may be able to use the ROWSPAN and COLSPAN attributes to reduce desk nesting. Finally, be mainly positive to validate your markup on every occasion you operate nested tables.

Q44. What Are The Various Style Sheets?

Inline, external, imported and embedded are the one-of-a-kind sorts of fashion sheets.

Q45. Can I Attach More Than One Declaration To A Selector?

Yes. If a couple of declaration is hooked up to a selector they should seem in a semi colon separated list, e.G.;

Selector declaration1; declaration2

P background: white; coloration: black

Q46. What Is Extensible Stylesheet Language (xsl)?

XSL is a proposed styling language for formatting XML (eXtensible Markup Language) files. The thought changed into submitted to the W3C through Microsoft, Inso, and ArborText.

Q47. What Are Differences Between Div And Span?

DIV is used to pick a block of textual content in order that one could apply patterns to it. SPAN is used to select inline textual content and allow users to use styles to it. The major distinction among DIV and SPAN is SPAN does no longer do formatting with the aid of itself. Also the DIV tag is used as a paragraph destroy as it creates a logical department of the document wherein it's miles carried out. This is in contrast to the SPAN as SPAN definitely dos the functionality of applying the style and alignment some thing changed into specified in it. DIV has ALIGN attribute in it which isn't present in case of SPAN. Thus DIV is used in cases where one wants to apply patterns to a block of textual content. But there can be conditions wherein there might not be clear well dependent block of textual content to work with. In those cases you will favor to apply SPAN that is used to apply styles inline. That is in other phrases DIV is generally used for block of textual content and SPAN is usually used for words or sentences.

Q48. What Is The Simplest Html Page?

HTML Code:

<HTML>

<HEAD>

<TITLE>This is my web page name! </TITLE>

</HEAD>

<BODY>

This is my message to the sector!

</BODY>

</HTML> 

Browser Display:

This is my message to the sector!

Q49. How Can I Use Tables To Structure Forms?

Small paperwork are now and again placed inside a TD element inside a desk. This can be a beneficial for positioning a shape relative to other content material, but it does not assist role the shape-related factors relative to each other. 

To function shape-related factors relative to each different, the entire desk need to be within the shape. You can not start a form in one TH or TD element and result in any other. You cannot area the form inside the table without putting it interior a TH or TD element. You can put the desk inside the shape, after which use the table to place the INPUT, TEXTAREA, SELECT, and different form-related elements, as proven in the following instance. 

<FORM ACTION="[URL]">

<TABLE BORDER="0">

<TR>

<TH>Account:</TH>

<TD><INPUT TYPE="text" NAME="account"></TD>

</TR>

<TR>

<TH>Password:</TH>

<TD><INPUT TYPE="password" NAME="password"></TD>

</TR>

<TR>

<TD> </TD>

<TD><INPUT TYPE="submit" NAME="Log On"></TD>

</TR>

</TABLE>

</FORM>

Q50. How Far Can Css Be Taken Beyond The Web Page--that Is, Have Generalized Or Non-web Specific Features For Such Things As Page Formatting Or Type Setting?

Yes, it is possible to take CSS further in several directions. W3C simply posted a new Working Draft which describes functions for printing, e.G., footnotes, move-references, or even generated indexes.

Another superb opportunity for CSS is Web Applications. Just like documents, programs want to be styled and CSS is an intrinsic component of AJAX. The "AJAX" call sounds exquisite.




CFG