Image class that removes the border from the background image

I have an image with a background image and there is a gray border around it that I can't seem to remove. Setting the border to 0px doesn't work.

Here is a fiddle where you can see my code: Fiddle Link

.facebook {
  background: url(http://dev.truewarpit.com/play/wp-content/themes/FoundationPress-master/img/icons/facebook.png);
  background-size: 50px 50px;
  border: 0px;
  width: 50px;
  height: 50px;
}
<img class="facebook" alt="Facebook Logo" />

Answer №1

When an img element is used with an a src attribute that points to a non-existent or missing source, a default border will appear. To resolve this issue, simply include the correct src attribute:

.instagram {
  width: 60px;
  height: 60px;
  opacity: 1;
  transition: opacity .5s ease-in-out;
  -moz-transition: opacity .5s ease-in-out;
  -webkit-transition: opacity .5s ease-in-out;
}
.instagram:hover {
  opacity: 0.5;
  filter: alpha(opacity=50);
}
<img class="instagram" alt="Instagram Logo" src="http://dev.truewarpit.com/play/wp-content/themes/FoundationPress-master/img/icons/instagram.png" />

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Navigating to a particular div using a click event

I am trying to achieve a scrolling effect on my webpage by clicking a button that will target a specific div with the class "second". Currently, I have implemented this functionality using jQuery but I am curious about how to accomplish the same task using ...

A missing definition for req.body.object

The issue with the req.body.object variable persists. Even though I have body parser imported, the value remains undefined when I try to console.log() it. //javascript const express = require('express'); var bodyParser = require('body-pa ...

Tips for dynamically updating the id value while iterating through a class

Here's the HTML snippet I am working with: <div class="info"> <div class="form-group"> <label class="control-label col-sm-2">Title</label> <div class="col-xs-10 col-sm-8"> <inpu ...

Creating and displaying images dynamically on a webpage using JavaScript after it has finished loading

I am trying to load images from an array and display them on a webpage upon the browser window loading. Here is my approach: const players = [ { photo: 'img/photo0.jpeg' }, { photo: 'img/photo1.jpeg' }, { ...

Issue with loading Angular CSS files arises when managing two partials using a single controller

I am currently developing a web application using the MEAN stack. My project utilizes Bootstrap as the CSS library, with some CSS overrides present in two of my own files named "app.css" and "mio.css". Everything was running smoothly until I encountered an ...

Obtain information about a div element while scrolling

Looking to enhance my social feed page by adding a view count feature for each post. The challenge is figuring out how to keep track of views as the user scrolls down the page. Any suggestions? ...

What is the process for assigning a value to the body in a div element?

Within a div, there is a body element structured like this: <div id = "TextBox1"> <iframe id = "TextBox1_1"> #document <html> <head></head> <body></body> </html> </iframe> </div> I have attempte ...

The equal height feature in Bootstrap 4's card-deck is not functioning as expected

I am having an issue with the card-deck property where it is not being applied correctly. The .card-deck class should create a grid of cards that are equal in height and width, and the layout should adjust automatically as more cards are added. Here is th ...

Click the button to trigger the pop-up

After creating a photo gallery using a plugin, my goal is to display this gallery when the user clicks on my homepage button. I am unsure how to make this happen and would appreciate any assistance. Below is my button code: <div class="ow-button-base ...

Is it possible to rotate an image with a random angle when hovering in Angular?

I'm currently working on a photo gallery project and my goal is to have the images rotate when hovered over. However, I am experiencing difficulties in passing values from TypeScript into the CSS. HTML <div class="back"> <div cl ...

Manipulate webview content using a C# button

I'm currently developing my first cross-platform app. It's a basic webview, but I want to add functionality to control it using native buttons. For instance, I have this HTML div: <div id="country-change"> <i data-parameter="sessionCi ...

What is the contrast between specifying a MIME type and omitting it?

If I were to write a stylesheet in an HTML document, it's worth noting that since the introduction of HTML5, the type attribute is no longer necessary as text/css has become the default and only possible value: <style type='text/css'> ...

Jquery enables smooth image transitions when changing classes

I am seeking assistance with implementing a simple transition effect on hover/out for a div box to switch between the first image .image-main and the second one image-hover. The current setup works properly, but I am unsure how to incorporate a mouseOn/mou ...

The function $(this).addClass() seems to be malfunctioning

While trying to follow a tutorial, I noticed that the style sheet isn't being applied to the clicked element in the list. What could be causing this issue? In the example provided, when a string is added to the text box and the button is clicked, a n ...

What is the best way to update a div element following a successful AJAX request?

Sharing my experience as I struggled to find a raw JavaScript solution among all the jQuery answers. I have a function that posts comments to a section, and I want the section to refresh after posting. However, my code seems to be failing to work as expec ...

PHP Ajax Image Uploading and Storage

Is there a way to effortlessly upload an image and save it in the uploads folder without any page refresh? Not only that, but can we also have the uploaded image displayed on the screen within a designated div section? Unfortunately, I seem to encounter a ...

What is the best way to position href text on the top of a rectangular div box?

Whenever I try to position the text above the rectangle, it disables the link. How can I resolve this issue? Additionally, when attempting to change the color of the "San Diego" text, I'm unable to adjust its position. Just a heads up, I am new to HT ...

Preventing text and images from distorting when zooming on a website

Currently, the HTML page I'm working on has some issues when zoomed in. The paragraphs seem to break out of their designated area and display as vertical lines of text instead of staying horizontal. Additionally, the pictures on the site become overly ...

Discovering the best way to organize and sort information retrieved from the backend within an Angular

How can I restrict a user to only search for data that has been provided from the backend and prevent them from creating new data? In my backend, there are two words: "Chart" and "Map". I am looking for a way to limit the user's search to only these ...

Invisibility Problem

As a newcomer to web design, this is only the second website I have ever created. However, I am facing an issue with my Nav bar that I cannot seem to resolve. I want my "Other Pages" section to be visible when the screen size is below 600px and hidden when ...