Can I include CSS StyleSheet from a local drive, on a page served from a website

My goal is to have a page served by a website that contains a stylesheet that is not accessible on a website, and not on another website, but on a local drive.

Something like:

<!DOCTYPE html> <html> <head> <link href="/styles/something.css" rel="stylesheet" /> <link href="file:///C:/custom.css" rel="stylesheet" /> </head> 

My initial research shows that browsers don't seem to support this, but I'm ready to make a mistake or open some sneaky way to do this. (I tried above, this does not work.)

[I know, I know, you want to know why. This is for the site designer - this will allow him to edit css locally during design and see the effect on a "semi-live" site. those. feedback for editing will be very fast and I won’t need to give him access to the actual site. In addition, for training purposes, this will allow several people to simultaneously practice their CSS skills locally]

Obviously, any changes made to the local file will be visible only on this local computer - this is the whole idea. If you had 10 students, each of them will see the same site with a different css file.

+8
html css
source share
5 answers

Well, if you can configure Apache on your machine, this is easy to do.

This suggests this question

I want to have the site in a central location (live) and allow users to access this site to change the site by editing the local file. These changes will be visible to the person, change, and the rest is easy to see no matter what CSS is in their local copy.

Thus, this means that you must serve the local file from several computers, and each person viewing the site may have a different perspective copy. If I'm right, read on.

Set up your local environment (perhaps using WAMP?) On all the machines you want to allow local changes. The important thing is that everyone should have the same host name (either localhost or something else - don't forget to add it to your hosts ). Place the CSS file inside your website and add a live link to your website pointing to that link.

 <link href="http://www.mysite.com/base.css" rel="stylesheet" /> <link href="http://localhost/custom.css" rel="stylesheet" /> 

And voila! Local editing.

Warning

  • Each must have its own files placed in the same local URL, otherwise it will not work

  • You need to set up your local environment (very simple)

+6
source share

Obviously you cannot. But why not try and find out if this works?

If your goals are for testing only, I suggest you install a web developer extension where you can add local CSS to the site - for testing only.

+3
source share

Just to answer the question, yes, he could use a CSS file on your site, but he had to install a server on his computer and publicly access his server IP address.

Then in href the stylesheet you should write something like <link href="190.181.169.118/styles.css" rel="stylesheet" /> .

Of course, this is not a recommended solution, I would advise you to use some kind of browser extension / extension for this.

+1
source share

Just press Shift + F7 in Firefox (or Tools-> Web Developer-> Style Editor). In the window that opens, you can import the entire file or you can also edit the downloaded styles.

+1
source share

Yes you can! You just need Firefox as your browser, and you also need to add WEB DEVELOPER to it ...

This allows you to disable inline CSS and add custom CSS ...

Download the add-on to WEBDEVELOPER

After you installed ... after restarting firefox, you will get a menu in the firefox window where you can click the CSS menu that will allow you to disable and add custom CSS

You will have to disable inline CSS to see the CSS applied by the user for the full effect.

-one
source share

All Articles