M
Mark Olbert
I have some img tags on a master page which reference files in a top-level directory. They look like this:
<img src="assets/test.gif" id="gnr" />
assets is a subdirectory of the website root.
My problem is this: this kind of path reference in a master page won't work when the page using the master is not in the root
folder:
root_page.aspx <- if this uses the master, the image file will be located and displayed correctly
subdirectory/subdir_page.aspx <- if this uses the master, it won't locate and display the image file
One solution I've used before is to change the image tag as follows:
<img runat="server" src="~/assets/test.gif" id="gnr" />
This lets the file be found...but unfortunately it makes the img tag not respond to CSS positioning attributes. Specifically, even
though the gnr id is defined as being absolutely positioned at the right margin (within relatively positioned div element), it still
floats on the left.
I'm pretty sure this is a bug.
But I'd love to hear how to work around it. Anyone got any ideas? Other than switching to <asp:image> tags; I got that to work
already.
- Mark
<img src="assets/test.gif" id="gnr" />
assets is a subdirectory of the website root.
My problem is this: this kind of path reference in a master page won't work when the page using the master is not in the root
folder:
root_page.aspx <- if this uses the master, the image file will be located and displayed correctly
subdirectory/subdir_page.aspx <- if this uses the master, it won't locate and display the image file
One solution I've used before is to change the image tag as follows:
<img runat="server" src="~/assets/test.gif" id="gnr" />
This lets the file be found...but unfortunately it makes the img tag not respond to CSS positioning attributes. Specifically, even
though the gnr id is defined as being absolutely positioned at the right margin (within relatively positioned div element), it still
floats on the left.
I'm pretty sure this is a bug.
But I'd love to hear how to work around it. Anyone got any ideas? Other than switching to <asp:image> tags; I got that to work
already.
- Mark