There are different options for doing this depending on your browser. Chrome will let you do a "Save as" where you can then select "Complete Web page." It will save the files and types as they are. I am not sure about Safari, but I think it allows you to save a web page and also to view source. There are also utilities out there to do this, as wrldwzrd89 has said.