General / Posts /

Where should I upload the JS CSS and images files to the server

40
I am a novice in web design. Would you give me some hints on what location the JavaScript, CSS and HTML pages should be uploaded to on the web server?
Harrison  9 years ago   viewed: 42893    

6 Answers

11

It doesn't matter where you upload your js, css, html and images. It matters whether your links or file paths in your page(eg. HTML file) and CSS code are correct.

There are two ways to specify the paths. One is absolute, such as "/level1/level2/level3/myjs.js"

The other is relative, such as "level3/myjs.js"(assuming your page is located in level2).

If you are using relative path, you need to pay attention to the images specified in your CSS file. The relative image path in your CSS file should be relative to your CSS file location instead of your page location.  

Natalia   9 years ago
0

Certainly! When it comes to uploading JavaScript, CSS, and HTML files to a web server, the specific location can vary depending on your server configuration and personal preferences. However, there are some common conventions and best practices to consider: detroit michigan drywall taping

  1. HTML Pages: HTML pages are usually placed in the root directory or a subdirectory of the root directory. The root directory is often named "public_html," "htdocs," or "www" on many servers. Placing your HTML files directly in the root directory allows them to be accessed directly via URLs like http://example.com/index.html. If you prefer organizing your files, you can create a subdirectory within the root directory (e.g., public_html/pages/) and place your HTML files there.

  2. CSS Files: CSS files are responsible for styling your HTML pages. Typically, you'll want to place your CSS files in a separate directory to keep them organized and distinguish them from other types of files. Create a directory, such as "css" or "styles," within the root directory or a subdirectory of the root directory and upload your CSS files there. Then, you can reference the CSS files in your HTML pages using relative paths, such as <link rel="stylesheet" href="css/style.css">.

  3. JavaScript Files: JavaScript files can be uploaded to a similar directory structure as CSS files. Create a directory, such as "js" or "scripts," within the root directory or a subdirectory, and upload your JavaScript files there. In your HTML pages, you can include the JavaScript files using relative paths, like <script src="js/script.js"></script>.

Remember to update the file paths in your HTML files accordingly to match the directory structure you choose for your CSS and JavaScript files.

It's important to note that server configurations can vary, and sometimes additional steps may be required to ensure your files are accessible. For example, configuring server settings to allow directory browsing or modifying file permissions. If you're unsure about the server configuration, it's best to consult your hosting provider's documentation or support team for specific instructions.

Lastly, make sure to test your website after uploading the files to ensure they are correctly linked and functioning as expected.

sacramento sheetrock drywall french drains miami florida

Dan
  6 months ago
0

You must be aware of the pictures listed in your CSS file if you are utilizing a relative path.  

west auckland roofing contractor
Jackson
  6 months ago
0

Where you post your html, photos, java, and css doesn't matter. It important if the links and file paths in your page's (e.g., HTML file) and CSS code are accurate. 

Spartanburg concrete driveways house washing west auckland
Jenny
  6 months ago
0

Instead of being local to the position of your page, the relative image path in your CSS file should be relative to your CSS file location.   

fort worth photo booth rental Invoice factoring Seattle
Madison
  2 months ago
0

In general, it's a good idea to use a consistent approach to specifying file paths in your code. Either use all absolute paths or all relative paths. Mixing the two can make your code more difficult to understand and maintain.

SEO Tampa

Oscar
  22 hours ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question:
    • If your question is related to the General, click:

      Ask new question: General
    • Otherwise navigate to one of the following forum categories, and post your question there.

      ##