HTML and CSS HELP?

Help!!! Can someone who knows HTML explain to me why my website (when I save it in a zipped folder) no longer displays the way I want it to. All the images are gone, and the CSS design isn't being applied… I urgently need help!! :…(

Image 1: actual website

Image 2: zipped, same website

(2 votes)
Loading...

Similar Posts

Subscribe
Notify of
16 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
medmonk
1 year ago

If you compress folders as a zip archive to forward it to third parties, it must be completely unpacked at the end and viewed with a web browser. Otherwise, the path details run into the blank because the files do not exist.

When creating the zip archive or even when creating the websites, care should be taken that linked files with relative paths are specified and the necessary files (CSS, JS, graphics etc.) are located in the project directory.

If an HTML document is in a zip archive and tries to open only this, only this document (temporarily) is unpacked, but not the associated files. Consequently, no CSS can be loaded when calling.

medmonk
1 year ago
Reply to  elikissi1234

Exactly, the person must unpack the entire archive.

You can imagine the Zip archive as a product package. In this is the device, the accessory and the user manual. To be able to stretch and use everything, it must be removed from the packaging.

In your case, it’s not a device, it’s HTML. And the accessories would be your CSS as well as pictures and graphics. The person unpacks everything and can then open your HTML in the browser in which your CSS is loaded.

medmonk
1 year ago

If it is still displayed incorrectly, you might have to work with absolute paths instead of relative paths and therefore not load files.


http://www.example.de/img/bild1.jpg" alt="">



With relative paths you move within the project folder and it doesn’t matter if the page is now from your computer or from where it is opened elsewhere. Just because everything is in this directory.

 Mirko Marek
1 year ago

Hi,

if you access a single HTML file from a ZIP file, the remaining documents such as CSS, images cannot be loaded. That’s what the whole folder needs to unpack.

Pixie633
1 year ago

However, the CSS file does not look like this.

Probably you need to change the address of the CSS program in the heading part of the body (at the beginning of the body), as this file is stored elsewhere during compression.

Edit: The memory path of the CSS file changes.

Pixie633
1 year ago
Reply to  elikissi1234

You’ll have written the program code somewhere.

Copy the memory path of the CSS file in the ZIP-compressed function and insert it in the heading of the body at the place where style is in the <> characters.

To uncompress, then compress again.

CoSci
1 year ago

Because then the folder paths no longer fit and your browser or server (Apache, Nginx etc.) can no longer access the files.

If you unpack the Zip file again, everything should work again.

CoSci
1 year ago
Reply to  elikissi1234
  1. If people don’t unpack the data and open it directly from the Zip file it comes out on the same so that the page works the Zip file must be completely unpacked and the unpacked files will be opened
  2. How do you specify the file paths in your source code? If there’s something like C:\User\Sowieso\asdfsdf\etc.\Image.jpg in there, that’s an absolute path and can’t work with others, just if there’s something like the username.
CoSci
1 year ago

yes, it looks right, that is a relative path. However, it can only work if the Zip file has been unpacked, then the CSS file must be in the same folder as the index.html file (also not in subfolders or the like)

mjutu
1 year ago

You can’t store websites in zip folders.

When you do this and open the HTML file with a double click in the Windows Explorer, only the HTML file is temporarily unpacked, but not the images and css files.

The solution is simple: not dolls.