Search code examples
htmlcssvisual-studio-codeliveserver

Can't navigate to linked pages with live server


this is my first time attempting to add a second page to the same site. I am having trouble navigating to a second page when using the live server extension in VS Code.

<div class="testtrans"> <a href="\test.html" target="_self">TEST</a> </div>

File Structure

First time posting on stackoverflow, so please pardon me for the mistake I likely made.


Solution

  • Here all the files are in same directory so just filename in href attribute is enough. And one more thing, you need to use / not \ if you want to access files in sub directories

    <a href="test.html" target="_self">TEST</a>
    
    <a href="dir/test.html" target="_self">TEST</a>