I'm use http://placehold.it to put image size,but I don't know how to insert image,for example :
<img src="image/abc.png" alt="" />
and when i use placehod.it as src="https://placehold.it/320x150"
You can use placeholder image by just requesting the following URL:
http://placehold.it/300x200
The first parameter defines the width and the second parameter is height.
<img src="http://placehold.it/200x200">
http://placehold.it is just provide dummy images to fill up your content. You don't use it to set the image size. Use this:
<img src="image/abc.png" style="width:320px;height:150px" alt="" />
Related
How can we set default image in case if original image is not loaded or gives error and shows only alt text in place of image in html
try this way
<img id="currentPhoto" src="SomeImage.jpg" onerror="this.onerror=null; this.src='https://homepages.cae.wisc.edu/~ece533/images/airplane.png'" alt="" width="100" height="120">
Use onerror for this issue
The same thing has been use for another image that uses HTML, and it works fine, exept for this one : https://media.discordapp.net/attachments/604447563185127426/665665552324362260/BCS_Bottom_Bar.png
And when I put the URL the same way I did for my other image and the same elements used, Yet it doesn't work.
Can someone help me fix it ?
<div><img width="50" height="50" src="https://media.discordapp.net/attachments/604447563185127426/665665552324362260/BCS_Bottom_Bar.png?width=1260&height=117"></div>
I've tried many alternatives to the URL, but they all don't work, I even tried changing the name.
The img tag has two required attributes: src and alt.
So you have to change your href attribute to src.
<div><img width="50" height="50" src="https://media.discordapp.net/attachments/604447563185127426/665665552324362260/BCS_Bottom_Bar.png?width=1260&height=117"></div>
For more detail, take a look at; https://www.w3schools.com/tags/tag_img.asp
It loads this way, there are no issues in your html.
As the font color is white, you maybe need to give the div a black
background like this:
<div style="background: black">
<img width="50%" height="50%" src="https://media.discordapp.net/attachments/604447563185127426/665665552324362260/BCS_Bottom_Bar.png">
</div>
I changed your width and height attributes to 50 percent.
Demo:
https://jsfiddle.net/ohc50tx6/
If you give an src and it cannot find the img it usually appears a square with a X. Is there any way to avoid that? I mean if it cannot find the img, just show nothing
You can check your solution here:http://jsfiddle.net/GmBax/
HTML:
<img src="1.png" width="42" height="42" >
There's another option, you can load a default empty image on error. Ex: <img src="/img.jpg" onerror="this.src='/none.jpg'" />
put in an "alt" and a "title" tag - this way if the image doesn't show, the alt text will show instead.
e.g.
<img src="1.png" width="42" height="42" alt="hello" title="hi">
Use the alt parameter for example.. You can either add a text or leave it empty.
<img src="1.png" width="42" height="42" alt="" />
Or handle it by some PHP or whatever you're using.
<img src="#" alt="abc"/>
after above code rendered in browser the position of alt and src are changed like
<img alt="abc" src="#"/>
Is there is any way to fix these problem
"I want that every time src comes before others attributes!"
When I am testing my page in IE7, all the image have a tooltip corresponding to the text of the alt in the image tag..
<img src="Myimage.jpg" alt="No pic" />
When I hover my mouse on the displayed pic in IE7, I get a tooltip "No pic" corresponding to the text of the alt .How do I fix this ?
IE6/7 treats the alt attribute as though it was a title attribute - but only if there's no actual title attribute set.
You can workaround it with a blank title:
<img src="Myimage.jpg" alt="No pic" title="" />
You can try adding an empty title tag
<img src="image.jpg" alt="nopic" title="" />
The answer has been posted already (empty title tag).
However, (in reference to one of the answers) alts are supposed to describe the image for 508 compliance reasons and if the image doesn't show up, so you should change the alt text to describe your picture.
I would have made a comment on the original post but SO doesn't allow me to yet.
The actual question here is why are you using alt the way you are? If your image is simply decorative, you should have an empty alt attribute. look at the W3CS definition of the alt attribute.
http://www.w3.org/QA/Tips/altAttribute
On this occasion is suspect youd actually want:
<img src="Myimage.jpg" alt="" />