HTML for Beginners: Questions and Answers



At the interview, many beginners (and not only) applicants for positions related to HTML, suddenly realize that they cannot answer the same standard, and seemingly elementary questions. But once this should come to an end? I think you know the answer to this question for sure.

We've put together a list of HTML questions and answers that are most likely to be asked during the interview. Having understood them, the applicant will be able to demonstrate a fairly high level of knowledge about the subject. If the candidate prepares the answers to these questions well and can quickly respond to them before the interview, this will make a good impression and give him an advantage over the “slower” competitors.

Questions and answers




What is HTML?


HTML stands for HyperText Markup Language. This is the markup language for documents on the World Wide Web (WWW). HTML is a standardized language for formatted text. The browser interprets it and displays elements of web pages on the screen.

What does HTML formatted text consist of?


First of all, HTML is content and tags. Tags allow you to specify how content is displayed on web pages.

What is an HTML tag?


A tag is a special service word enclosed in angle brackets. It is also called the "HTML element." There are many tags in the HTML language and each one does something with the content, which is usually located inside the brackets or between the tags.
If the tag is paired, then the <TEG> tag corresponds to </ TEG>.

Are all tags paired?


No, not all. There are single tags, for example, <img> - for images. In this case, the content along with other service words (for example, for <img> it may be src = "image url") is placed between the brackets, but after the word img.

What are the main types of lists used to create a web page?


When creating a web page, you can use:

  1. Menu list (menu list - <menu>).
  2. Directory list (directory list - <dir>).
  3. Ordered list (numbered list - <ol>).
  4. Unordered list (bulleted list - <ul>).
  5. Definition list (<dl>).


Why use lists in HTML?


Lists make information more visual and easy to read. Moreover, inside the lists (more precisely, for arbitrary display of list items), you can also use various tags.

Can we write comments in HTML? How?


Yes we can. To do this, the comment text must be placed inside <! - and ->.

Why do some characters on a web page sometimes display incorrectly?


Most often, characters are displayed incorrectly due to encoding problems. That is the reason - in the settings of the browser or web server.

What is Image Map?


In HTML, Image Map is a technology that allows you to link links to image fragments. By clicking on individual parts of the image, the user can follow this or that link to different web pages.

What is white-space?


White-space is a property that allows you to change the number of spaces between words when displaying a web page. By default, the browser interprets any number of spaces in the HTML code as one space.

What is the main advantage of white-space?


When writing HTML code, the developer does not need to worry about the extra spaces that he could enter: the browser will remove all extra spaces when the web page is displayed.
The developer can add spaces to the code, not only by accident, but also on purpose: to make the code more readable.

Can I assign values ​​to not all tag attributes?


Yes, in this case the browser will use the default values. If you are not comfortable with the way he displayed the web page, then perhaps you should explicitly specify the values ​​of some attributes.

How to place the copyright mark on a web page, because it is not on the keyboard?


The copyright symbol refers to special characters. To place it on a web page, you need to type the sequence & copy or & # 169 on the keyboard in the corresponding fragment of the HTML code.

How to create links to different fragments (sections) of the same web page?


To do this, find the beginning of the fragment we need in the HTML code. In this place, create the so-called “anchor” using the name attribute of the <a> tag and give the link to the fragment name using the href attribute and the # sign:
href = "#link_name_to_fragment"

Can we align list items in an HTML file?


Yes, we can store list items directly in the HTML file using indents. Indentation can also be used for any nested list inside the parent.

Which web page address is usually considered the site address?


This is usually one of the top-level pages, the main page. From it, the user goes to pages located at lower levels. And their address is most often formed on the basis of the address of the main page.

Why do we use alternative text (alt attribute of the <img> tag) for images?


Alternative text is displayed when graphics are disabled in the user's browser or if there is a problem loading a specific image. This text makes it clear what should have been depicted in this picture.

Can HTML files work well in some rare or cutting edge browser?


Of course, HTML files can and should work well in any browser, because the browser must comply with HTML standards. If the developers decided not to support some of the features of the standard, this remains on their conscience.

Do you think the hyperlink can only be text?


No, a hyperlink can be not only text, but also, for example, graphic. This means that we can convert the image into a link that directs the user to another page. A hyperlink does not depend on the type of content that lies “under it”.

What are the attributes of the <li> tag - a list item?


There are two of them:

  1. type sets the appearance of a bullet or bullet list marker;
  2. value - the number from which the numbered list will begin.


What are stylesheets (CSS) for?


Style sheets allow you to set clear rules that determine the appearance of content, various HTML elements and the entire page as a whole. Moreover, the same rules can be applied to several web pages at once, which simplifies the preservation and, if necessary, changing the uniform style of the site.

What types of numbering in lists do you know?


The following values ​​can serve as numbering elements:

  • Arabic numbers (1, 2, 3, ...);
  • latin capital letters (A, B, C, ...);
  • lowercase latin letters (a, b, c, ...);
  • uppercase Roman numbers (I, II, III, ...);
  • lowercase Roman numbers (i, ii, iii, ...).


How to set different colors for text fragments of a web page?


To set different colors for fragments of text, you need to put each of the fragments inside the paired font tag:

<font color=“color”>-    “color”</font>


Where are numeric character codes stored in HTML?


In the ASCII table. When a web page is displayed, the browser takes the numeric character codes from the HTML document and replaces them with the corresponding character from the table.

What are the benefits of grouping multiple checkboxes (checkbox elements)?


There are several advantages to grouping flags:

  • it helps to better organize and structure them;
  • this allows you to access specific flags from the group using id;
  • this allows you to create another group of flags on the same web page without fear of confusing the names or identifiers of the flags.


How does tag overlap affect content display?


Overlapping tags in HTML only recognizes the first tag. But such problems only occur if the browser tries to recognize tags without text.

If there is no text between the tags, what will be the result? Give an example?


If there is no text between the tags, then the content will be impossible to format. For example, single tags, such as <img>, do not require text input, and therefore, formatting is not required in this case.

How to specify colors for table borders?


This can be done in the stylesheet, and if it is missing, the text color will be used.

Can we create a link that leads to another web page?


Yes, you need to use the href attribute for this.

Can stylesheets help align the image and determine how text is positioned relative to it?


Yes, a stylesheet may contain rules for positioning text and images.

Can a single hyperlink lead to different pages?


No, one hyperlink can only lead to one web page, the address of which you provide.

Is there a difference between a bulleted list and a list of directories and menus?


Yes, the difference is that an unordered list has attributes for changing marker style.

How to change marker color?


The color of the marker usually matches the color of the first character in the list. If you change the color of the first character using the <font> tag, the color of the marker will also change.
If we want to set the color of the marker in the list without changing the color of the text, then we need to put the <span> tag inside the <li>, and put the text inside it. And then the color of the marker will be determined by the style property color of the LI selector, and the color of the text by the color property of the SPAN selector.

Is it possible to introduce some restrictions on the size of text fields in HTML?


The standard size is 20-25 characters. But using the size or maxsize attributes, you can set other restrictions. For instance:

<input type="text" size="5" />


What is the maximum size of a text field?


The width of the browser window.

What happens if you set the size of the text field to zero?


The browser will use the default value.

What are the similarities between border and rules attributes?


If the border attribute is set to a non-zero value, the default border of a cell with a thickness of one pixel will be added automatically. If the rules attribute is added to the <table> tag, the border attribute will not be included.
But at the same time around each cell (the same as border), a frame with a thickness of one pixel by default will appear, thereby forming a grid.

What is marquee? How can we apply this?


Marquee helps in customizing the scrolling of text on a web page. To activate scrolling, you need to use the <marquee> tag.

What does the <br> tag do?


The function of the <br> tag is to separate pieces of text from each other.

Is there any other way to split text without using <br>?


Yes, there are other ways to split text. You can use the <p> tag or the <blockquote> tag.

Can text be displayed outside the browser window?


By default, text cannot be displayed outside the browser, but if the text is part of a table cell with a predetermined width, then it can go beyond the browser window.

What is the difference between active and inactive links?


The active link has focus, that is, the mouse is over it. In other cases, the focus is somewhere else.

Does the stylesheet have restrictions on the number of rules?


No, style sheets do not limit the number of rules for a selector. However, each new rule must be separated by semicolons.

Do stylesheets have any hierarchy of rules?


Yes, there is a hierarchy that includes four levels (from highest priority to least priority):

  1. Inline style: Attaches directly to the element for which the style is created. Example:
    <h1 style="color: #ffffff;">
  2. An identifier is a unique identifier for page elements, such as #navbar.
  3. Classes, attributes, and pseudo-classes: these categories include .class [attribute] and pseudo-classes such as: hover,: focus, etc.
  4. Elements and pseudo-elements: this category includes elements and pseudo-elements, such as h1, div,: before and: after.


Can we group different selectors with different class names?


Yes, for this you just need to write the class names with a comma.

Can I attach an external CSS file in a browser?


No, an external CSS file can be included using the <link /> tag in the HTML document itself.

Can a list-style-type property affect a paragraph?


No, the list-style-type property cannot affect a paragraph, it will most likely ignore it.

What is a canvas element?


The HTML5 canvas element can be used to insert images, gradients, and complex animations. It can also help create 2D images directly inside the source code of an HTML document.

Conclusion


The above answers to questions can give you an idea of ​​what you may be asked. You can overcome fear and gain confidence, which will help you get the job you want. The answers outlined above are mostly quite clear and short. But this is enough for the interviewer to understand that the candidate is in the subject.

Conclusion


In addition to preparing the answers outlined above, we also recommend chatting with a friend or relative who has recently been interviewed. This will help you get information about industry trends and employers expectations. Thus, you can improve your skills and abilities accordingly, and then use this to offer your services to the employer and properly present yourself in accordance with his expectations.

Communication with people who have recently been interviewed, as well as answers to the questions above, will help you position yourself as a more worthy candidate and increase your chances of an offer.


All Articles