简体   繁体   中英

How can i upload and use a .CSS, .js, and some audio files on my html project? (so that all thats needed is the HTML file)

I have some HTML that grabs a .CSS and a .js from my windows computer, how do I change this to grab it from online? (for example upload it to google drive then grab it from their, or something) I'm trying to make it so all the user needs is the HTML file.


(I'm new to HTML) so the above is the current external libraries/files that I have linked in my HTML, I would like to upload them somewhere online and access all of them online and only need the HTML to run the project.

I'm not sure about using Google Drive, but you can upload the files to a number of places around the web.

Once you have them uploaded all you need to do is to add the URLs for where they are located in place of the path that they are stored on your local disk in your html file and everything should work fine.

I don't think that uploading to google drive and accessing files there will work, but you can try uploading to a web host and accessing them from there. After you've uploaded your files, change your code slightly so <link rel="stylesheet" href="/main.css"> turns into <link rel="stylesheet" href="https://example.com/main.css"> . Do the same for your javascript.

Well, what you are looking for is a CDN(Content Delivery Network). You can store all your CSS, fonts, images and js files on this CDN and link them via URL in your HTML file.

Here are some free CDNs available

Netlify - https://www.netlify.com/

Hostry - https://hostry.com/products/cdn/

JSDELIVR - https://www.jsdelivr.com/

Cloudflare - https://www.cloudflare.com/en-in/#what-is-cloudflare

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM