The popularity of HTML is growing daily, and now it is used by a huge number of web-programmers, layout designers, etc. Due to its demand, the language has long gone beyond the web and increasingly began to appear in desktop applications.
This collection of questions and answers is primarily suitable for consolidating the material after training and to find out which topics were not fully discussed.
It will also be useful if your goal is to get some new Hypertext Markup Language possibilities or if you want to refresh your memory before work. Testing is suitable for a large number of users.
For instance, for beginners who have just begun to study HTML, for students and experienced professionals who have confident knowledge of the language.
I tried to gather info on all possible topics!
Among the testing topics of these questions are working with text and tables, HTML basics, working with blocks, HTML forms, pseudo-classes and pseudo-elements, the arrangement of elements on the page, features of the Hypertext Markup Language, working with images, tag attributes, fonts in HTML, adaptive layout, cross-browser compatibility and validity, html5 features, code reduction techniques and so on.
Essential HTML Q&A That You Should Know
1. What is usually written in the HEAD tag?
This tag includes:
Title tag: This is a significant tag, especially from an SEO standpoint. How is it prescribed? Using tags <title> </title>. That is, it turns out something like this: <title> The title of your web document </title>;
Meta tags: Meta tags are mainly needed for three things: prescribe the encoding, description (description), and keywords (keywords).
Also, inside the head tags, the path to the style sheet is written, this is how the web page and the style sheet are linked, or CSS is written directly on the page, inside the style tags.
All kinds of scripts are connected inside the head tag. How do they connect? Script tags are written with an indication of the type of language, and inside them, either the script code is written, or the src attribute is assigned to the script tag, which indicates the path to the script.
2. How is HTML different from XHTML?
XHTML is an XML vocabulary, while HTML is just an antecedent XHTML markup language. The main difference between the two is document handling. XHTML documents are processed and fought with their module (parser), similar to XML documents. During this processing, errors made by developers are not corrected.
Learn more about the differences:
- All elements must be closed. Tags that do not have an end tag (for example, <img> or <br>) must end with a / (for example, <br />).
- Boolean attributes are written in expanded form. For example, you should write <option selected = ”selected”> or <td nowrap = ”nowrap”>.
- The names of tags and attributes should be written in lowercase (for example, <img alt = ”” /> instead of <IMG ALT = ”” />).
- XHTML is much stricter about errors in the code; <and & everywhere, even in URLs, must replace <and &, respectively. As recommended by the W3C, browsers encountering an error in XHTML should report it and not process the document. For HTML, browsers had to try to understand what the author wanted to say.
- The default encoding is UTF-8 (as opposed to HTML, where the default encoding is ISO 8859-1).
3. What is DOCTYPE, and why is it needed?
DOCTYPE is a Document Type Definition (DTD), rules, the terms with which a specific XML document (web page) is checked or (X) HTML. Thanks to this entry, the browser determines which one is used in this document.
As a rule, it is needed so that browsers correctly display the markup of the document. If you do not specify DOCTYPE, then the browser will show a mistake. As a result, there is no question of any cross-browser compatibility.
4. What is the difference between div and span?
Div is a block container, and span is linear. Containers are something that something else can be nested in. div is used to mark up blocks, and span is used for text. div forms a block from what is in it on a new line, and after it, the element goes on a new line (unless you change the behavior with CSS), and the span does not wrap and “wraps.”
5. How are comments indicated in HTML?
<! – like this ->
6. Links. How to set the address of the document to which you should go?
<a href=>http://vottak.com/example/example.html </a>
<a href=>../../example/example.html/> Relative link </a>
7. How to create an e-mail link?
<a href=> Mailto:email@example.com </a> E-mail me
8. What do <em> tags do?
Output the enclosed text in italics.
9. What are <ol>, <ul> and <li>?
The <ol> tag sets up a numbered list. Each list item must start with a tag <li>. If a stylesheet is applied to the <ol> tag, then the <li> elements inherit these properties. The <ul> tag sets up an unnumbered (bulleted) list.
10. What are the tags <dl>, <dt>, <dd> for?
Tags <dl>, <dt>, <dd> are designed to create a list of definitions. Each such list starts with a container <dl>, which includes a <dt> tag that creates a term and a <dd> tag that specifies the definition of this term.
The closing tag </dd> is optional as the next tag informs about the completion of the previous element. However, good style is close all tags.
11. What are the tags <tr>, <th>, <td> for?
The <tr> tag serves as a container for creating a table row. Each cell within such strings can be specified using the <th> or <td> tag. <th> is intended to create one table cell, which is designated as a header.
The browser usually displays the text in such a cell in bold and aligned in the center. The <th> tag should be placed inside the <tr> container, which in turn is located inside the <table> tag.
<td> is for creating one table cell. The <td> tag must be placed inside container <tr>, which in turn is located inside the <table> tag.
12. In what case is it better to write HTML-code?
It is used to be considered indifferent. But with the advent of XHTML, there was a definite answer to this question – we write all tags, attributes, and predefined values in lowercase.
13. How to remove the blue border around the link image?
<img border = ”0” … />
14. Do you have to write alt in <img>?
Yes. This is required by the standard and by common sense. Some users still disable pictures, and some use text or even voice browsers. If the picture carries no semantic load, then you can put in <img> tag alt = ”.”
15. What are entities?
Entities are combinations of the & sign and an alphabetic or numeric code after it, intended to replace characters that cannot appear in “pure” form in HTML-text, for example, the “<” character.
16. How to make all site hyperlinks open in a new window, that is, to use target = ”_ blank” by default?
It is necessary to register the base tag with the target = “_ blank” attribute in the head area:
<base target = ”_ blank”>
17. Now, what if I want to open some of the hyperlinks in the same window, i.e., without creating something new?
In the <a> tag of this link, you will need to add the target = ”_ self” attribute because now we use target = ”_ blank.”
18. What are W3C standards?
The World Wide Web Consortium (W3C) is an organization that develops, introducing, and implementing technical standards for the World Wide Web.
The W3C develops uniform principles and standards for the Internet, which are then implemented by software manufacturers.
In this way, compatibility is achieved between software products and hardware, which makes the World Wide Web more perfect, universal, and convenient.
To summarize everything written above, it is essential to understand what you are working with clearly. In our case, it is HTML. I really hope that this article was useful for those who want to apply for a job and prepare for the interview very well and those whose aim is to hire HTML developers.