download webpage and dependencies, including css images

I ran into the same problem the other day working for a client. Another tool that works really well is HTTrack. The software is available in a commandline verison for both windows and Linux. For Linux they prebuilt packages for most of the more common operating systems found here

For my purposes it worked better than wget with some of the added features/switches that fix links inside the html file.


wget --page-requisites http://example.com/your/page.html

This option causes Wget to download all the files that are necessary to properly display a given html page. This includes such things as inlined images, sounds, and referenced stylesheets.

EDIT: meder is right: stock wget does not parse and download css images. There is, however, a patch that adds this feature: [1, 2]

UPDATE: The patch mentioned above has been merged into wget 1.12, released 22-Sep-2009:

** Added support for CSS. This includes:
 - Parsing links from CSS files, and from CSS content found in HTML
   style tags and attributes.
 - Supporting conversion of links found within CSS content, when
   --convert-links is specified.
 - Ensuring that CSS files end in the ".css" filename extension,
   when --convert-links is specified.

It's possible to do this through Firefox, see this form

  1. Right click
  2. View page info
  3. Select media tab
  4. Highlight all files
  5. Save as

Reference - http://www.webdeveloper.com/forum/showthread.php?t=212610