Should image/css/javascript references from HTML use relative or absolute paths?

Posted by Peter Howe on Stack Overflow See other posts from Stack Overflow or by Peter Howe
Published on 2010-04-06T14:20:48Z Indexed on 2010/04/06 14:23 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

What are the pros and cons of referencing web assets using relative or absolute paths? For example:

<link rel="StyleSheet" href="/css/mystylesheet.css" type="text/css" />
<img src="/images/myimage.gif" alt="My Image" />

vs.

<link rel="StyleSheet" href="../css/mystylesheet.css" type="text/css" />
<img src="../images/myimage.gif" alt="My Image" />

© Stack Overflow or respective owner

Related posts about html

Related posts about paths