I put a picture of HTML img tag between a tag and put a link, and when I run it with a browser, it shows a-" between the pictures and there's a link here

Asked 2 years ago, Updated 2 years ago, 89 views

<a href=http://sales.happyreport.co.kr/sunnyfanta/20190423201305 target=_blank> <img src='http://www.happyreport.co.kr/prev/201904/ Regional Agricultural Cooperative's Letter-4556_01_.jpg' width='150' height='230'></a>
<a href=http://sales.happyreport.co.kr/sunnyfanta/20190423201305 target=_blank> <img src='http://www.happyreport.co.kr/prev/201904/ Regional Agricultural Cooperative Letter-4556_01_.jpg' width='150' height='230'></a>

When you run the code above, the picture below appears in your browser.

However, if you look at the bottom of the middle between the two images, you can see a "-" in a red circle.

If you click here, the contents of href will be linked and moved.

However, there is no link for "-" on the code above, but it just happened.

What's the reason?

If you insert multiple pictures, a "-" appears between the pictures and the pictures.

I can't see it when there's only one painting.

html img

2022-09-22 11:14

1 Answers

LOL That's not a minus sign ("-"), but a space (&nbsp;) with a link underlined .

Originally, HTML considers the space between the tag and the tag as a valid character. They see it as input that the user wants to put it in. However, from the browser's point of view, if you show all the HTML source files, which are filled with all kinds of tab and spacing characters, everything becomes a mess.

<!-- Some sources at this site -->
<!-- This a tag has six spaces in front of it and eight spaces in it. -->
      <a class="navbar-brand" href="https://hashcode.co.kr/">
        <span class="hc-icons-logo">Hashcode</span>
</a>
<!-- But look at the logo part of this site. Can you see the spacing? -->

So the browser is very smart, showing only the necessary spaces and omitting the rest from the actual rendering. (As a representative action, Summarize multiple spaces into one space.) And if you look at the source you gave me, there is a spacing in the first <a> tag right after the <img> tag. Now the browser thinks of it as a valid space -- what the user wants -- and then it links up and underlines it. And the underline looks just like -".

One-line summary: Remove all gaps between > and < and save it and watch it again.


2022-09-22 11:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.