Can't load PNG file in HTML - html

Hello I have a problem with add logo to my website. Firstly I had some example logo
<a class="navbar-brand d-flex align-items-center" href="/">
<a class="navbar-brand" href="#"><img src="img/cattery/logo-cattery.png" width="250"height="70" class="d-inline-block mr-1 align-bottom" alt=""></a>
</a>
And everything was good.
Secondly I bought some logo on logo creator website and now there is a problem with my logo. There is 404 error. I use the same code and localization but another file- the file seems good, I can open it and I can see the content.
My new code:
<a class="navbar-brand d-flex align-items-center" href="/">
<a class="navbar-brand" href="#"><img src="img/cattery/cattery_logo.png" width="250"height="70" class="d-inline-block mr-1 align-bottom" alt=""></a>
</a>
I tried various files from my logo package and I changed localization etc but unfortunatelly I haven't got it.

A 404 error usually indicates that a resource can not be found. Are you completely sure that the path is 100% correct?
Another cause of error could be that (actually both paths) img/cattery/cattery_logo.png is a relative path, hence the actual path called depends on the currently opened site. Consider changing the path to absolute: /img/....

Related

how src and href properly work in thymleaf?

I wrote following code in main-page.html
<a href="" class="arrow">
<img th:src="#{/image/right-arrow.png}" alt="back">
</a>
but it said that no mapping
No mapping for GET /image/right-arrow.png
why it is happening? It is also not working for css
my resource files screen

Images appearing locally but not when hosted

I have a menu component html (src/menu/menucomponent) that exhibits images from a folder (src/assets/images/image.png) for the main nav when being viewed on a computer. Then I have a sidenav that is shown when on a mobile device.
The code is :
<div id='main'>
<span class="hamburger" *ngIf="isMobile" (click)="openNav()">☰</span>
These images appear both locally and globally. Then I have the following:
<div id='mySidenav' class='sidenav'*ngIf="isMobile">
×
<a href=".#/welcome" >Home</a>
<a href=".#/aboutme" >About Me</a>
<a href=".#/projects" >Projects</a>
<a href=".#/contactme" >Contact</a>
Subscribe
<img src="../assets/images/Image1.png">
<img src="../assets/images/Image2.png">
<img src="../assets/images/Image3.png">
<img src="../assets/images/Image4.png" >
These images appear locally but once hosted on a server, do not show, but the links still work. I have double-checked that they are in the same images folder and that they are the right image names.
Does anyone have some ideas?
The assets folder is copied to the dist when you compile the app.
So, you change your sources to:
<img src="./assets/images/Image1.png">
The ng serve can still figure out where the files are when you are testing locally.

Link my Logo to homepage

I am trying to make my logo clickable to go back to the homepage but can't seem to get it to work.
Any help appreciated...
<!-- logo begin -->
<div id="logo">
<a href="index.html">
<img class="logo logo_dark_bg" src="images/logo.png" alt="/">
<img class="logo logo_light_bg" src="images/logo_light.png" alt="/">
</a>
</div>
<!-- logo close -->
Your anchor currently work only from the root so you should update your reference to be from the root as well, so href="/index.html" note the starting "/". The Same applies to your src links:
<div id="logo">
<a href="/index.html">
<img class="logo logo_dark_bg" src="/images/logo.png" alt="logo">
<img class="logo logo_light_bg" src="/images/logo_light.png" alt="logo">
</a>
</div>
Starting an anchor link with a / means it sources from the root so that wherever the above code is based (such as in site.com/currentfolder/file.html) it will always connect with your home page which would typically be found in site.com/index.html.
Currently (without the leading /) the anchor link is looking for site.com/currentfolder/index.html which is almost certainly looking for a file which is not the welcome or home page.
Update
Also you need to ensure that the home page file does actually exist. Typically in your case the home pages may be /index.htm rather than /index.html. Please ensure that the file with the correct filetype HTML reference (.html or .htm) exists and is referenced correctly.
Summary Issues
Anchor href file should be absolute reference starting with /
Anchor href file must exist, with the correct filetype (.html or .htm, etc.).
image src should be absolute reference (starting /).
image alt should be the website name and/or logo description.

Html links don't work with localhost?

Is this true? I'm working on an mvc3 application in visual studio and I want the image I'm using as the header to be a link back to the home page, but since I'm just running it locally I'm using this line as the code:
<a href="localhost:60060">
<img src="../../Content/images/LionLabs.png" alt="Lion logo">
</a>
This doesn't work though! am I doing something wrong, or is it just that localhosts can't be used as this?
I also just tried using a javascript method as the href to refresh the page, but that didn't work either :(
Since links by default start at the domain, there is no reason to specify it. You can just use /.
<a href="/">
<img src="../../Content/images/LionLabs.png" alt="Lion logo">
</a>
HTML links work just fine with localhost:
<a href="http://localhost:60060/">
<img src="../../Content/images/LionLabs.png" alt="Lion logo">
</a>
The issue here is that just using localhost:60060 attempts to use a relative path, so the browser is actually looking for http://localhost:60060/localhost:60060/, which, of course, is an invalid path.
Also, you should not use absolute paths when linking between pages of your application, because that becomes a nightmare when you need to change domain names (like, deploying your application to the web).
To make your code more MVC friendly, do this:
<a href="#Url.Action("Index", "Home")">
<img src="#Url.Content("~/Content/images/LionLabs.png")" alt="Lion logo">
</a>
What's happening here is that the ASP.NET MVC Url helper is supplying the proper path information when the page is served out to the user, so it automatically accommodates any changes in the server. It also allows you to use your Routes to best effect, because you can easily change the route (ie the URL) of a link but still use the same controller and view.
The links for <a href=""> don't differ from the links for <img src=""> .
You shouldn't use absolute path, because, when you deploy your project, the site name will not be localhost:60060.
For main page use
Change this:
<a href="localhost:60060">
<img src="../../Content/images/LionLabs.png" alt="Lion logo">
</a>
To this:
<a href="#Url.Action("Index", "Home")">
<img src="#Url.Content("~/Content/images/LionLabs.png")" alt="Lion logo">
</a>
Why?
It's better to use #Url.Action as that will use any custom routing you set in Global.asax. Can you imagine modifying every single link reference on a complex site if you have to change your url routing? :)
Use #Url.Content, as that will correctly resolve to the root of your application, taking away the uncertainty of using ../ or ../../ or ../../... It's cleaner!
You have used href as localhost:60060. It should be a page (may be default.html or something like that).

Add this plugin... brain-jam

Guys I am about to get a massive headache here. First of all, I am working on a website and everything seems to be runng. So, I had difficulties with making them links etc. so I tried to add the addthis.com plugin which would do all of that automatically. But, when I add that everything seemed to crash so I have made a quick jsFiddle to show you what I want. Here: http://jsfiddle.net/cSP9Q/1/ the problem is that I want to change those icons to mine which you can see on the first link and I just can't seem to change the spacings in between the icons. Furthermore, is there anyway of deleting the bubble with the counter because that just looks ridiculous.
HTML
<div id="social"><!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"><img src="your_image_url" /></a>
<a class="addthis_button_preferred_2"><img src="your_image_url" /></a>
<a class="addthis_button_preferred_4"><img src="your_image_url" /></a>
<a class="addthis_button_google_plusone"><img src="your_image_url" /></a>
<a class="addthis_button_compact"><img src="your_image_url" /></a>
</div>
<!--javascript goes here-->
</div>
Example and Reference.
NOTE: your link http://www.aasingercom.ipage.com/php/ doesn't work, anyway.