Ask coding questions

← Back to all posts
How would you add a link to an HTML file on repl.
webmunchster (20)

So I am trying to make a social media site, (one that would have more than one page), and I was wondering if there is a more efficient way to make separate pages and instead send destinations to other HTML files inside the repl. If this is obvious, I am sorry.

Answered by JustARatherRidi (203) [earned 5 cycles]
View Answer
ArchieMaclean (793)

If you have a page called about.html then you can link using the a tag like:

<a href="/about.html">About me!</a>

(Assuming a HTML/CSS/JS repl)
Please mark this as the answer if it solved your problem :)

webmunchster (20)

@ArchieMaclean No, that des not help. Maye if I share the link it might help.

JustARatherRidi (203)

@webmunchster Where in your page would you like your link to be?

webmunchster (20)

@JustARatherRidi It will probably be a button in the top row

JustARatherRidi (203)

@webmunchster Okay, so assuming you fix your about.html, maybe like so:

<!DOCTYPE html>

Then, on line 26 of index.html, you can change the href attribute to ./about.html, after which it will look like:

<a href="./about.html" class="w3-bar-item w3-button w3-hide-small w3-padding-large w3-hover-white" title=""><i class="fa fa-user"></i></a>

Doing that should make the profile button on the top navbar to redirect to about.html.

Working repl:

Hope this helped!

EthanJustice (66)

Within the Repl editor, on top of the file tree sidebar, there are two icons: a file and a folder with a green plus icon in the corner. Click the file icon, and then name that file what you want. Then link the file using root or relative linking on your site, i.e. if the file's name is yeet.html, then you could create <a href="/yeet.html">Yeet</a>, which would link to a yeet.html file in your root directory. Read More About Linking.

If this helped, please mark my reply as the answer. Thanks!