-1

In my HTML code, I have a list element ID such as:

<li id="pageHome">

And, when I want to reference to it, I have:

<h1><a href="#!/pageHome" id="logo">Interior</a></h1>

This works fine, however, when I load my website, I noticed that when I want to go my home page, the link looks like this:

mywebsite.com/#!/pageHome

I don't think this looks professional. Is there anything that I can do such that anytime that I want to go to main page, it shows something like this instead?

mywebsite.com/pageHome

j08691
  • 197,815
  • 30
  • 248
  • 265
Rudy01
  • 957
  • 5
  • 15
  • 30

2 Answers2

2

The dash will always appear, but you can prevent the backslash and exclamation mark from appearing in the url, as writing href="#pageHome" is sufficient

fifou
  • 65
  • 6
Loïc Gammaitoni
  • 4,090
  • 14
  • 37
1

#pageHome should work perfectly fine.

Also check How do I scroll to an element using JavaScript? for JS solutions!

Community
  • 1
  • 1
Rstew
  • 585
  • 2
  • 8
  • 21