<p>When opening a file from your hard drive into your browser, where is the document root?  To illustrate, given the following HTML code, if the page is opened from the local machine <code>(file:///)</code> then where should the <code>css</code> file be for the browser to find it?</p>

<pre><code>&lt;link href="/temp/test.css" rel="stylesheet" type="text/css" /&gt;
</code></pre>

[{'answer_id': 18924, 'author': 'Andy', 'author_id': 1993, 'author_profile': 'https://Stackoverflow.com/users/1993', 'pm_score': 3, 'selected': True, 'text': '<p>It depends on what browser you use, but Internet Explorer, for example, would take you to the root directory of your harddrive (eg. <code>C:/</code>), while browsers such as Firefox does nothing. </p>\n'}, {'answer_id': 19301, 'author': 'Mario Marinato', 'author_id': 431, 'author_profile': 'https://Stackoverflow.com/users/431', 'pm_score': 0, 'selected': False, 'text': '<p>Eric, the document root is the folder in which your file is, wherever it may be.</p>\n'}, {'answer_id': 19338, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>On a Mac, the document root is what you see in the window that appears after you double click on the main hard drive icon on your desktop. The temp folder needs to be in there for a browser to find the CSS file as you have it written in your code. </p>\n\n<p>Actually, you could also write the code like this:</p>\n\n<pre><code>&lt;link href="file:///temp/test.css" rel="stylesheet" type="text/css" /&gt;\n</code></pre>\n'}, {'answer_id': 27725, 'author': 'Sam Murray-Sutton', 'author_id': 2977, 'author_profile': 'https://Stackoverflow.com/users/2977', 'pm_score': 0, 'selected': False, 'text': '<p>As far as local, static html goes, unless you specify it, most browsers will take the location of the html file you are viewing as the root. So any css put in there can just be referenced by it\'s name only. </p>\n\n<p>The lazy way to get the correct reference for your css file is to open it in your browser. Then just grab the url that you see there - something like: <pre>file:///blah/test.css</pre> and copy that into your stylesheet link on your html: <pre><code>&lt;link href="file:///blah/test.css" rel="stylesheet" type="text/css"&gt;</code></pre></p>\n\n<p>Either that or you can just take the url for the html file and amend it to refer to the stylesheet.</p>\n\n<p>Then your local page should load fine with the local stylesheet.</p>\n'}, {'answer_id': 27728, 'author': 'Brian Warshaw', 'author_id': 1344, 'author_profile': 'https://Stackoverflow.com/users/1344', 'pm_score': 0, 'selected': False, 'text': "<p>If you're interested in setting the document root, you might look at getting a web server installed on your machine, or, if you already have one (like Apache or IIS), storing your project-in-development in the web root of that server (htdocs in Apache, not entirely sure in IIS). If you'd rather leave your files where they are, you can set up virtual hosts and even map them to addresses that you can type into your browser (for example, I have a local.mrwarshaw.com address that resolves to the web root of my personal site's development folder).</p>\n\n<p>If you're on Windows and don't want to mess around with setting up a server on your own, you could get a package like XAMPP or WAMPP, though bear in mind that those carry the extra weight of PHP and MySQL with them. Still, if you've got the space, they're a pretty easy drop-in development environment for your machine.</p>\n"}, {'answer_id': 38377, 'author': 'bstark', 'author_id': 4056, 'author_profile': 'https://Stackoverflow.com/users/4056', 'pm_score': 4, 'selected': False, 'text': '<p>You <i>can</i>, but probably don\'t want to, set the document root on a per-file basis in the  head of your file:</p>\n\n<pre>\n&lt;base href="my-root"&gt;\n</pre>\n'}]
['https://Stackoverflow.com/questions/18920', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1858/']