Eliminate blank spaces from the image

Check out this fiddle I created using the link below:

http://jsfiddle.net/cX47v/1

I'm attempting to maintain the visible effect, but am looking to eliminate the white space underneath the image. I've tried using display:block, but it interferes with the hover effect. Any suggestions on how to address this issue?

Answer №1

To resolve the issue in Chrome, Firefox, IE9 and Safari, I made a simple change to the HTML below by adding style="font-size:0". This trick addresses a situation where a browser incorrectly interprets the height of a row of text.

<div class='fancy_image'>
    <div class='shadow' style='border:2px solid; float:left;padding:5px;margin:10px;'>
        <div style="font-size: 0;">    
            <img class='fade' src="http://www.prelovac.com/vladimir/wp-content/uploads/2008/03/example.jpg" width=300 height=200  />
        </div>
    </div>
</div>

To see this fix in action, check out: http://jsfiddle.net/jfriend00/8FkmG/. The padding set in your HTML controls the white space surrounding the image.

Your mix of floats, positioning, and using span for positioning in your HTML/CSS is quite unusual and can be improved.

Answer №2

To create a shadow effect, you can set the line-height:0; property in your div.

Answer №3

only alters the .fade styling

.fade {font-size:0px;
    background: url('http://james.linnegar.com/demos/js/win7/hover.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

Only show the subcategory when a category has been chosen

Is there a way to only display the subcategory when a category is selected? If someone chooses a category but does not select a subcategory (for example, selecting "select sub-category"), can we automatically hide the subcategory select box? Below is the ...

Utilize AngularJS to modify the appearance of text

Just starting out with AngularJS and I need to achieve the following task. I have a text that says "bob" and two buttons, one for bold and one for italic. When the bold button is clicked, I want to make the text BOB bold and when the italic button is click ...

The dimensions of Bootstrap 4.0 card images vary

I am facing a challenge in achieving uniform image sizes for my bootstrap 4 cards. The images themselves vary in size. <div class="container"> <div class="row"> </div> <!-- card 2--> <div class="col-md-6 col-lg ...

Managing additional data in jQuery autocomplete

I'm encountering an issue with my current project. I am using the jQuery autocomplete plugin to retrieve a list of suggested values from the server. The format of the list is as follows: <input> field would be set to "Username1". However, I act ...

jquery equivalent of making a post request using curl

I am interested in utilizing echoprint at to send an mp3 file locally from my computer via a post request for retrieving the song details from their server. My goal is to write this post request in jquery within my text editor, receive a json object with ...

"Utilizing the power of Twitter Bootstrap and Snap.js for

I am currently working on integrating Snap.js by jakiestfu with Twitter Bootstrap. I have managed to make it work to some extent (I can slide the content and open a drawer through a click event). However, I am facing a challenge where the drawer content re ...

Modify the information on a page by clicking a button on a different page

I'm currently working on the design of a website that consists of two pages. The first page features a button, which when clicked should remove the hidden class from an element on the second page. I have searched extensively for a solution, but so far ...

open() the html file containing dojo elements

I have a simple Dojo chart that functions perfectly in a separate document. However, here lies the issue, When I use $('#result').load('dojo.html'); to import the file, nothing occurs - the page does not load the graph. On the other h ...

Discover updates within a JQuery Ajax call

I am sorry if this question sounds simple, but I would like to know how to set up a function that triggers when the Ajax data changes from the previous request. window.setInterval(function(){ $.get("feed", function(data){ if (data.changed ...

Having trouble populating data using JSON, the process is not functioning as expected

I need to dynamically populate a ul element with a list of options retrieved from JSON data. JSON Data: { "product": { "options":{ "42432":{ "id":42432, "title":"Choose your date", ...

"Enhance your website with a 'Read More' link using

I'm in the process of creating a simple example for displaying hidden content with a "Read More" button. The setup includes a paragraph and a button, with half of the text inside a span tag that is initially hidden. However, I have been able to implem ...

Is it possible to utilize Ajax in jqGrid to retrieve data for a custom_element?

In my current project, I am faced with a task similar to this query where I need to create a custom edit control with a list of checkboxes. However, the twist is that I want to populate this list dynamically from the server, not hardcode it on the client s ...

Enhancing Browser Validation Appearance Across Modern Web Browsers

Modern browsers now automatically validate forms using new HTML attributes. How can we style the auto browser validation for forms to have a consistent look across different browsers like Firefox, Chrome, IE, Opera, and Safari? I am seeking to achieve thi ...

Ways to enhance the legibility and visibility of the text

On my website, there's an image that appears as follows: https://i.sstatic.net/bCE3k.png I attempted to add a shadow to the text, resulting in this look: https://i.sstatic.net/4ha0J.png However, the shadow seems out of place. Any ideas on how I c ...

The DatePicker and FullCalendar consistently seem to be missing a day

This code snippet is being used to add bookings to a database. Date Selection <script type='text/javascript'> $(document).ready(function() { $('#dp1, #dp2').datepicker({ autoclose: true, format: "yyyy-mm ...

Using FormData to send an image and string data with a Jquery POST request

In this particular section of code, jQuery is being used: $(".btnGorevOlustur").click(function (e) { var fileUpload = $(".fileGorevResim").get(0); var files = fileUpload.files; var dt = new FormD ...

Tips for transmitting one or multiple data using jquery.ajax

I found this code on stackoverflow and it is working well for uploading multiple files. However, I am facing an issue where I cannot send additional parameters along with the file upload. Despite trying various methods, I have been unsuccessful in sending ...

Use jQuery to dynamically insert an audio element

Struggling to dynamically append audio elements for each song fetched from the iTunes RSS feed. The rest of the data loads correctly, but encountering difficulties in adding the audio element dynamically for each song. $.get('https://itunes.apple. ...

Having Trouble with the Dropdown Submenu in Bootstrap

Could someone assist me in getting this dropdown menu to function properly? I am trying to make it so that when the "Program" menu is clicked, a dropdown submenu will appear. I have inserted some code for it, but unfortunately it's not working. Just t ...

Achieving Perfect Alignment in Bootstrap Containers

My form is not aligned in the center of my page. Below is my HTML file and the resulting output. How can I center my view? https://i.sstatic.net/mqXr8.png Here is the code snippet from my HTML: <div class="container"> <div class='row justi ...