img border - HTML img

 HTML inserts images through the < img > tag. In addition to a simple image, you can also add some borders (img border) to beautify the image, or you need to process the img border when adding hyperlinks to the image, otherwise the browser It may automatically add a hyperlink border, which is not so pretty.


For example, the picture below is a picture with a hyperlink, which shows a blue border under IE browser. To avoid this situation, you can use the img border property to handle it.



HTML img border syntax example

<img src="Image URL" border="0">


In the same picture, if we set the border to 0, there will be no blue border in the IE browser.



More changes to img border

Above we used HTML basic border property to adjust the border, but in fact, there are more styles of borders that can be used. Here is a brief introduction to the CSS img border design, which can design solid lines, dotted lines, and dots. Line... and many other styles, the color can also be adjusted freely, which is very convenient.

CSS img border syntax design example

<img src="Image URL" style="border:2px green dashed;">


When rendering the result such as



using CSS to define the border , you can directly add style in the <img> tag. In this example, the style we set is 2px thick, green and dotted. CSS border-style has many useful styles, for example Solid, dotted, double, groove, ridge, inset, outset... etc., all kinds of borders can be changed .

Post a Comment

0 Comments