Base in HTML


Can we specify a folder path instead of a URL?

Can the following work?

<base href="/images" />                //or this should be "" only

<img src="house.jpg" alt="This is my house"/>

Who is Participating?
GaryConnect With a Mentor Commented:
You can but IE doesn't like it - which makes it pointless doing it that way.
Amar BardoliwalaCommented:
Hello jrawabt,

it should work.

Please look at following link to learn about absolute and relative paths.

Hope this will help you.

Thank you.

Amar Bardoliwala
Julian HansenCommented:
To clarify your question

Are you asking if the base ref can include a folder path or only a domain i.e. the following is valid

If you mean just


Then not sure what the objective is - you are trying to set a fixed base url to a relative path - why not just specify base ref as

I think you need to maybe give more information on what you are trying to achieve.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

JRawabiAuthor Commented:

Thanks for the reply.

Just local folder like /images

I am trying to fix a path not a url. Is that possible?

JRawabiAuthor Commented:

See my comment above. I want to use the base tag and use a local path not a url.

<base href="/images" />  not a domain name.
As I said, it will not work in IE - you have to use the full url.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.