Scooby
Scooby

Reputation: 3581

Trying to put an image in html

Easy question - very tired to find the answer.

I am doing the following :

a(href="https://github.com/xxx")
            img#github-banner(style="position:absolute;top:0px;right:0;border:0;", src="app\public\img\logo_github.png", alt="View our project on GitHub")

The image src here is changed between both project path and full path, but all I get is broken image and alternate text in that order. Whats the error?

Also any good way to debug these issues ?

Upvotes: 0

Views: 67

Answers (1)

Paul
Paul

Reputation: 36319

The problem is probably not with your code, but with the path to your image.

I assume you're using Express, and I'm guessing your app/public folder is pointed to by an express.static() middleware. This is the default in most cases.

If that's all true, then the path to your image should just be /img/logo_github.png. Try navigating to that in your browser first (with your app running, of course) and see what you get.

Upvotes: 1

Related Questions