Remove image border: CSS, HTML
HTML is the language most used to build web pages. It provides a lot of flexibility in building interactive and dynamic web pages. For example, you can use an image as a clicking button for a particular link. The problem is that the browser displays a border around this image. To remove the border in HTML/CSS, you need to change the required attributes. In this case you will have to set the attribute of the border as zero.
How to remove the border of a clickable image?
You made a clickable image by using the IMG tag within a <a href=""></a> link and the browser displays a frame or more precisely a border around the image. But what if you don't want it?
There are a few ways of deleting this border:
How to remove border using HTML?
Use the attribute BORDER = "0" in the tag <IMG>. For example:
<A HREF="jak58.html"><IMG SRC="pic1.gif" ALT="My picture." BORDER="0"></A>
How to remove border with CSS?
In the stylesheet, define the code below:
a img { border: none; }
How to remove border with external CSS file?
If you have multiple HTML files and want to apply the same style to all of them, consider using an external CSS file.
Create a CSS file (e.g., styles.css
) with the following content:
/* styles.css */
img {
border: none;
}
Then, link this external CSS file in your HTML documents:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<img src="your-image.jpg" alt="Your Image">
</body>
</html>
How to remove border for specific image?
If you want to target a specific image with a border, you can give that image a unique class or id and apply styles to it in your CSS. For example:
<img src="your-image.jpg" alt="Your Image" class="no-border">
Remember to replace "your-image.jpg"
with the actual path to your image file. By using these methods, you can easily control the appearance of borders around your images in HTML and CSS.