Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Which part of an HTML5 file specifies the document language? The document charac

ID: 3586824 • Letter: W

Question

Which part of an HTML5 file specifies the document language?
The document character set?
The document character encoding?
For all 3 question above show the HTML code.


Consider UTF-8 and UTF-16 character encodings. Why do we say
UTF-8 is ASCII preserving.


Are there situations when a correctly specified table has rows
containing different number of td elements?
Explain.


Using notepad ++ Practice row and column spanning by creating an HTML table to
present the mirror image of the following:

<table>

<tbody>

<tr> <td colspan="2"

style="background-color:red;height:40px">A</td>

<td rowspan="2"

style="background-color: cyan">B</td></tr>

<tr><td rowspan="2"

style = "background-color: yellow">C</td>

<td>D</td></tr>

<tr><td colspan="2"

style="background-color: blue;

color: white; height 40px">E</td></tr>

</tbody>

</table>

Explanation / Answer

The language of the HTML document can be declared in different ways in the <html> tag.

1. using lang attribute

Eg: 1.

<!DOCTYPE html>

<html lang="en-US">

<body>

</body>

</html>

Eg: 2.

<!DOCTYPE html>

<html lang="fr">

<body>

</body>

</html>

The first two letters specify the language (en). If there is a dialect, use two more letters (US).

2. Using xml:lang attribute.

Eg:-

<html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">

Note:-

If you are serving your page as XML, do not need the lang attribute.

Eg:-

<html xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">

3. In addition to the lang also possible to specify the language by using meta elements and an HTTP header

For single language

Eg:- <meta http-equiv="Content-Language" content="en">  

For multiple languages

Eg:- <meta http-equiv="Content-Language" content="de, fr, it">

HTML charset Attribute/character encoding

The character encoding standard, also called character set.

To display an HTML page correctly, a web browser must know the character set used in the page.

The default character encoding for HTML5 is UTF-8.

The default character encoding for HTML4 was ISO-8859-1.

UTF-8 (Unicode) covers almost all of the characters and symbols in the world.

Eg:- <meta charset="UTF-8">


UTF-8 encodes all characters into 8 bits like ASCII. A UTF-8 file containing only ASCII characters has the same encoding as an ASCII file. UTF-16 is better where ASCII is not predominant, since it uses 2 bytes per character, primarily.

--------------------------------------------------------

There may be situations like table has rows containing different number of td elements.

The better way to handle this is use of colspan which align the content in single td by merging multiple td s..

Eg:- <td colspan="2">Sum: $180</td>

This will include/display the entire content in the single td, also it will align the table properly.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote