Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Interview Question

Tags:

html

xhtml

Well I got this question in an interview test.Give two reasons why the page might take longer to download than necessary with this image.

< IMG src="somethin.gif" width=10 height=10 border=0 >

Well I came up with 3 instead of 2 reasons Xhtml validation problems,image resizing and unnecessary border=0.So what is wrong in here? .

like image 624
Emre Avatar asked Aug 26 '10 22:08

Emre


2 Answers

Validation problems don't increase download times (and, aside from some extra whitespace, it is the only thing stopping it being valid HTML 4.01 Transitional is the missing alt attribute).

The things that could increase download times are:

  • The image might be more than 10x10 and have to be scaled down
  • Presentational attributes are used instead of cache-friendly CSS (which isn't going to be significant as a one-off)

Images which are inside links have a border by default, so border=0 might not be as "unnecessary" as you think (although it is still better handled with CSS).

like image 154
Quentin Avatar answered Oct 27 '22 03:10

Quentin


There is a space at either end. That's 2 unnecessary bytes to download ;)

like image 22
matt burns Avatar answered Oct 27 '22 03:10

matt burns