Oleksandr Gavenko's blog
2017-01-12 18:40 HTML / CSS interview questions

Today talk is going about CSS / HTML / HTML 5 related questions on interview.

What is DOCTYPE and how is it important?

DOCTYPE considered deprecated way for embedding into XML documents. It supposed to point to DTD document definition. In other words it names document type. Nowadays XML namespaces is in use.

Because HTML is not an XML and have SGML as ancestor as legacy it has DOCTYPE declaration which helps identify HTML version and mode (strict or transitional).

Since HTML 5 is living standard without profiles there is no need to carry version or mode information and it was decided to reduce DOCTYPE declaration simply to:

<!doctype html>

as a marker of HTML5 ready document.

Compare with old HTML4.01 declarations:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

Of course none is able to memorize such syntax. That is the reason for today syntax simplicity.

What is the difference between visibility:hidden and display:none?

Element with visibility: hidden occupies space on layout but isn't shown.

Element with display: none doesn't occupy space on layout and isn't shown.

What is the use of data- attribute?

Attributes prefixed by data- solely used to store information or embedding private data.

Highlight text in HTML

Use HTML5 tag mark.

Does external resources trigger requests even it declared in display:none / visibility:hidden?

Yes.

Do JS/CSS files downloaded in order of occurring?

No. CSS/JS files can be downloaded in parallel if they are referenced in head element.

But interpretation of them performed with respect to their order.

Standards mode vs quirks mode

Quirks mode is a way to interpret HTML document in a way that is done by Navigator 4 and Internet Explorer 5 before web standards were established.

In standards mode rendering engine will follow W3C specifications.

What's the difference between HTML and XHTML?

HTML is less strict on socument syntax. For example some tags can be without following closing tag.

XHTML is HTML in a form that compatable with XML syntax.

html, css, interview, quiz

Feeds

all / emacs / java / python

Tags

admin(1), anki(1), blog(1), css(2), cygwin(2), emacs(3), fs(1), git(1), hg(2), html(1), interview(11), java(2), js(3), lang(1), lighttpd(1), mobile(1), naming(1), printer(1), problem(5), quiz(6), rst(1), security(1), sql(1), srs(1), unit(1), utils(1), vcs(1), web(2), win(2)

Archive