Eli K
Eli K

Reputation: 3

Add another language to the website

first of all I would like to declare that I'm an absolute amature in programming. I'm doing this for school.

What I want to do is a create an icon in the top corner, like for example the Swedish flag, and when they press on it, it will rederict to my "swedish" version.

Any idea?

Upvotes: 0

Views: 48

Answers (2)

Lars Koole
Lars Koole

Reputation: 488

You can add an image with a link like this:

<a href="/sw">
    <img src="/flag.png">
</a>

The /sw is the directory you are redirecting them to, if you have a folder called "swedish" then change /sw to /swedish (be sure it is in the main website folder)

The /flag.png is the image you are using. If you have your image in a folder then use /foldername/flag.png.

You can also add classes like this:

<a class="language_link" href="/sw">
    <img class="swedish_flag" src="/flag.png">
</a>

I do recommend putting this code in a div and giving the div a class:

<div class="image_holder">
    <a class="language_link" href="/sw">
        <img class="swedish_flag" src="/flag.png">
    </a>
</div>

You can manipulate the classes with css, look on stackoverflow where to find css guides if you don't know how to use it. Good luck!

Upvotes: 1

Deblugger
Deblugger

Reputation: 153

maybe this will work

<a href="your_swedish_version"><img src="your_flag"></a>

Upvotes: 0

Related Questions