26073

Spacing in a table

Question:

I'm trying to setup a table in html. Below is a screenshot of part of it.

<img alt="Screenshot" class="b-lazy" data-src="https://i.stack.imgur.com/6nPUk.png" data-original="https://i.stack.imgur.com/6nPUk.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

As you can see, there is a horizontal white strip between the image and the cell below, which I cannot get rid of. I have tried the following (bit ott I know - but I'm getting right frustrated!)

<table style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; "> <tr style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; "> <td width="200px" height="175px" style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; "> <img src="img" style="display: block; padding: 0; border: 0;" /> </td> </tr> <tr style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; "> <td width="200px" height="25px" style="text-align: center; border: 0; background-color: #535152; color: #fffdfe; padding: 0; margin: 0; border-collapse: collapse; "> Text </td> </tr> </table>

This is based on what I've got - just more simple. Any ideas on how I can get rid of that gap?

Answer1:

Add

vertical-align: top;

to the element style of the image. That's because the image is treated as text and so line-height and font-size also take effect.

Recommend

  • Can't figure out Shaders for DirectX11?
  • Android emulator platform 4.0 startup problems
  • Fancybox + Bursting Pipe Ad
  • C#: How To Crosshatch A Bar In An ASP.Net Bar Chart
  • How to get an extra column in relational model in Django-rest-framework serializer?
  • How to read the param value from the object tag using javascript
  • Dropdown menu items hides behind main menu in bootstrap customized navigation bar
  • How do one only submit click event (div), when using jquery live function?
  • TCPDF's getNumLines() is sometimes wrong
  • Play Framework nested form errors missing
  • IOS > Open URL in Safari with POST
  • is it possible to insert a line break in this tooltip?
  • How to add closing tag for canvas in three js rendered Canvas?
  • cell spacing in div table
  • Plotting densities in R
  • Update Google Maps traffic layer without page reloading
  • Floated image with variable width and heading with background image
  • How to add a focus style to an editable ComboBox in WPF
  • How Lists (specifically, RecyclerView with CardViews) in Android work
  • how to display data from 1st point on words on y axis for line chart in d3.js
  • Installing iPhone App to iPhone
  • How do I alternate colors in Flat List (React Native)
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • Change multiple background-images with jQuery
  • Asynchronous UI Testing in Xcode With Swift
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Change JButton Shape while respecting Look And Feel
  • Insert into database using onclick function
  • Encrypt data by using a public key in c# and decrypt data by using a private key in php
  • MySQL WHERE-condition in procedure ignored
  • jquery mobile loadPage not working
  • Web-crawler for facebook in python
  • Unanticipated behavior
  • trying to dynamically update Highchart column chart but series undefined
  • JTable with a ScrollPane misbehaving
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal