Eliminate any excessive space located at the bottom of the table

How can we adjust the spacing at the bottom of the table to remove extra space?

Currently, it looks like this:

https://i.stack.imgur.com/DwkbG.png

We want it to look like this:

https://i.stack.imgur.com/extDP.png

CSS

.wk_mp_body td {
    background: #282828;
}

.wk_mp_body td {

    padding: 5px 7px;
}

tbody {
    display: table-row-group;
    vertical-align: middle;
    border-color: inherit;
}

table {
    border: 0;
    border-collapse: collapse;
    empty-cells: show;
    font-size: 100%;
}

HTML

<table cellspacing="0" class="border wk_mp_list_table">
    <thead>
      <tr id="wk_mp_tr_heading">
        <th><span><?php echo $helper->__('Product Name') ?></span></th>
        <th><span><?php echo $helper->__('Date') ?></span></th>
        <th><span><?php echo $helper->__('Product Status') ?></span></th>
        <th><span>&nbsp;</span></th>
      </tr>
    </thead>
    <tbody class="wk_mp_body">
      <tr>
        <td><input class="input-text" name="s" placeholder='<?php echo $helper->__(' type="text">' value="<?php echo $this->getRequest()->getParam('s')?>"/&gt;</td>
        <td><span class="wk_mp_td_span"><?php echo $helper->__('') ?> <input class="input-text" id="special_from_date" name="from_date" placeholder='<?php echo $helper->__(' value="<?php echo $this->getRequest()->getParam('from_date')?>">'/&gt;</span> <span class="wk_mp_td_span"><?php echo $helper->__('') ?> <input class="input-text" id="special_to_date" name="to_date" placeholder='<?php echo $helper->__(' value="<?php echo $this->getRequest()->getParam('to_date')?>">'/&gt;</span></td>
        <td><select class="input-text" name="prostatus" style="height:35px;">
          <option value="">
            <?php echo $helper->__('All') ?>
          </option>
          <option value="1">
            <?php echo $helper->__('Approved') ?>
          </option>
          <option value="2">
            <?php echo $helper->__('Unapproved') ?>
          </option>
        </select></td>
        <td><button class="button" style="background:#fc6c0b;" title="Save" type="submit"><span><span><span><?php echo $helper->__('Submit') ?></span></span></span></button></td>
      </tr>
    </tbody>
  </table>

Looking for a solution to fix this issue. Thanks in advance!

Answer №1

To center the content within the td elements, you just need to adjust the vertical-align property from baseline to middle.

tbody td {
  vertical-align: middle;
  background: black;
}
thead th {
  border: 0;
  text-align: left;
  width: 30%;
}
.wk_mp_td_span {
  float: left;
  width: 50%;
}
button span {
  color: #fff;
  float: left;
  text-align: center;
}
button span span {
  padding: 9px 15px 8px;
  text-transform: capitalize;
}
input,
select,
textarea {
  border: 1px solid #dcdcdc;
  border-radius: 0;
  color: #a0a0a0;
  font: 12px/29px Arial, Helvetica, sans-serif;
  height: 29px;
  padding: 2px 8px !important;
  width: 80%;
}
select {
  height: 35px
}
<table cellspacing="0" class="border wk_mp_list_table">
  <thead>
    <tr id="wk_mp_tr_heading">
      <th><span>Product Name</span>
      </th>
      <th><span>Date</span>
      </th>
      <th><span>Product Status</span>
      </th>
      <th><span>&nbsp;</span>
      </th>
    </tr>
  </thead>
  <tbody class="wk_mp_body">
    <tr>
      <td>
        <input class="input-text" name="s" placeholder="Search by product name" type="text" value="">
      </td>
      <td><span class="wk_mp_td_span"><input class="input-text hasDatepicker" id="special_from_date" name="from_date" placeholder="From:" value=""></span>  <span class="wk_mp_td_span"><input class="input-text hasDatepicker" id="special_to_date" name="to_date" placeholder="To:" value=""></span>
      </td>
      <td>
        <select class="input-text" name="prostatus">
          <option value="">
            All
          </option>
          <option value="1">
            Approved
          </option>
          <option value="2">
            Unapproved
          </option>
        </select>
      </td>
      <td>
        <button class="button" style="background:#fc6c0b;" title="Save" type="submit"><span><span><span>Submit</span></span>
          </span>
        </button>
      </td>
    </tr>
  </tbody>
</table>

Answer №2

Can you explain the reason behind having two separate .wk_mp_body td css classes? Is it possible to merge them into a single class?

Have you considered removing the 5px 7px padding from your styling?

Answer №3

Combine the elements from both classes (.wk_mp_body td) For example:

.wk_mp_body td {
background: #282828;
padding: 2px 3px;
}

Decrease the value for padding.

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

Establish a vertical column that matches the height of its parent element

Is there a way to create a column that matches the height of its parent element? I have a navbar followed by a container with three columns. The challenge is to make the last right column the same height as its parent and also scrollable. In this scenario, ...

Discover the secret sauce to effortlessly adding text upon hovering over a button

I am completely new to CSS and only know the basics. Recently, I stumbled upon this code online that creates a button. However, I want to use an image inside the button, add a color overlay when hovered, and display text saying "LEARN MORE" upon hovering ...

Clicking on the images will display full page versions

Apologies for not making an attempt just yet, but I'm struggling to locate what I need. Here's the menu structure in question: <div class="overlay-navigation"> <nav role="navigation"> <ul class="test"> & ...

Implementing text overlays on images within a Bootstrap 4 navigation bar

I am struggling to grasp the flex structure in Bootstrap. I'm attempting to overlay text on an image within the navbar, but it seems the container of the navbar is causing issues. Perhaps my containers are not set up correctly. Any assistance would be ...

I am encountering difficulties with generating images on canvas within an Angular environment

I am trying to crop a part of a video that is being played after the user clicks on it. However, I am encountering the following error: ERROR DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may no ...

How come the dark grey in CSS appears to be lighter than the standard grey hue?

JSBIN DEMO Could this be a mistake or is it a bug? Shouldn't the dark gray shade be darker than the default grey one? HTML <div class="lightgrey">Light Grey</div> <div class="grey">Grey</div> <div class="darkgrey">Dar ...

Code that achieves the same functionality but does not rely on the

I utilized a tutorial to obtain the ajax code below. The tutorial referenced the library jquery.form.js. Here is the code snippet provided: function onsuccess(response,status){ $("#onsuccessmsg").html(response); alert(response); } $("# ...

The CSS Grid does not align properly in the horizontal direction when displayed on mobile devices

I am currently working on a responsive layout where the header and footer should each take up around 5% of the screen space and remain fixed. The middle section should scroll based on the number of elements within it. Despite using the fr and % values, the ...

Passing references using a personalized component

So, I've encountered this issue with my code: import MuiDialog from "@mui/material/Dialog"; import { styled } from "@mui/material/styles"; const TheDialog = styled((DialogProps) => ( <MuiDialog {...DialogProps} /> ))(( ...

SwiperJS continuously applies additional right margin to every slide

My Swiper carousel seems to be adding an unnecessary 5px margin-right to each slide, resulting in the cards not fitting into one frame. I attempted to fix this by setting the margin-right to 0px for the .swiper-slide class using !important, but it didn&ap ...

Is there a way to automatically compile LESS files whenever I save a document?

After installing Less using npm with the command $ npm install -g less I currently compile my source files to .css by running $ lessc styles.less styles.css Is there a method through the command line to automatically compile the document when saving it ...

Generating Dynamic Widgets Within the Document Object Model

Currently, I am working with jQuery Mobile 1 alpha 1. In order to create a text input field using jQuery Mobile, you need to include the following HTML code: <div data-role='fieldcontain'> <label for='name'>Text Input:</ ...

As the browser window is resized, the HTML div is causing the image to be clipped

Having an issue with the dynamic resizing of Divs containing Images in my HTML Table. The Challenge: The Image within a resizable Div gets clipped at the bottom when the height decreases due to window resizing. To view the problem, visit this Example Pag ...

Aligning an image in a way that adjusts to different screen sizes

Struggling with centering an image horizontally in a responsive manner while using Bootstrap v3.3.5? Here's my code: <div class="container"> <div style="margin:0 auto;"> <img src="images/logo.png" alt="logo" /> ...

best practices for creating space between flexbox items

My task involves presenting a continuous scroll list of scheduled jobs using Angular Material. Each item in the list needs to be divided into three columns utilizing flexbox. Despite my efforts, I am struggling with adding space between the columns within ...

Converting HTML code into executable PHP code

I'm having trouble embedding PHP into an HTML file. I modified my .htaccess to recognize HTML files as PHP, but when I attempt to open the .html file in my browser, it gets downloaded instead of being processed and shown. UPDATE: Here is what's ...

Unable to decrease the width of a div element in Vuetify and Nuxt

As I work on creating a dynamic form with fields that need to occupy only 50% of the size of a regular field, I encounter different components based on data provided by Vuex. The use of v-for in Vue.js helps me loop through form objects and render the app ...

I'm encountering problems when attempting to display the image/png response from an xmlHTTPRequest. Instead of the correct data, I

I have implemented the following code to integrate a captcha generating web service. The response data is successfully obtained, but when I attempt to display the result within a div element, the image appears as distorted text. var xmlHttp = new XMLHtt ...

React Native: Enhance the background with a vibrant stripe of color

I am trying to incorporate a strip of grey in the middle of my white background, but I am encountering an issue where I am unable to input any text inside it. Below is the code snippet I am working with: container: { flex: 1, justifyContent: "cent ...

CSS3 keyframes hover animation for Firefox

I implemented keyframes animation for a div on mouse hover using pure CSS3. The animation runs smoothly on all browsers (Google Chrome, Safari, IE, Opera) except for Firefox! I'm puzzled as to why it doesn't work only in Firefox. The animation ...