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

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 document syntax. For example some tags can be without following closing tag.

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

html, css, interview, quiz

Feeds

all / emacs / java

Tags

adb(1), admin(1), android(1), anki(1), ansible(2), aop(1), blog(2), bytecode(1), c(1), css(2), cygwin(2), driver(1), emacs(3), fs(1), git(3), google(1), gradle(1), hardware(1), hg(2), html(1), interview(13), java(4), js(3), lang(2), lighttpd(1), markdown(1), mobile(1), naming(1), oracle(1), print(1), problem(5), python(1), quiz(6), rst(2), security(3), spring(2), sql(2), srs(1), style(1), tls(2), txt(1), unit(1), utils(1), vcs(3), web(2), win(2), windows(1)

Archive