Search code examples
htmlasp.net-mvcurlhref

How to shorten a long url in HTML <a> tag


In my view I am sometimes getting long URLs like this:

https://www.google.de/#hl=de&sclient=psy-ab&q=break+long+url+css&oq=break+long+url+&gs_l=serp.1.1.0i30l4.3822.3822.0.5634.1.1.0.0.0.0.85.85.1.1.0...0.0...1c.Hao7HfzLitY&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&fp=48c9a29cac04fd97&biw=1680&bih=925

It is very annoying because it takes a lot of space.

In my view, I want it to display a short version of it, like https://www.google.de/#hl=de&sclient=psy-

When I click it, it should take me to the long link.

How can I do it with an HTML a tag?


Solution

  • <a href="full-url">short-url</a>
    

    The short url will be displayed on the page, but the link will point to the full url.