What is the best way to decrease the width of one of the four columns?

I trust all is well with you.

I'm having trouble adjusting the width of one of my table data cells. In the image attached below, you'll notice that my + icon is the same size as the other columns. I'd like to make it much narrower and position it next to the left column.

This is the current setup:
HTML:

<thead>
      <tr>
          <th><h1></h1></th>
          <th><h1></h1></th>
          <th><h1>TITLE</h1></th>
          <th><h1>TITLE</h1></th>
      </tr>
</thead>

      <tbody>
          <tr style="background-color: #eee;">
          <td onclick="showPleaseHide()" id="trCheck" style="background-color: #eee; transition:box-shadow 0.2s ease-out; text-align: left;">Enrollment Fee</td>
          <td class="plusButton"><span class="down1"><i style="color: orange;" class="fa fa-plus"></i></span></td>
          <td>US $0</td>
          <td>US $450</td>
          </tr>

          <tr class="active" id="hide1">
          <td style="color: white; background-color: rgb(140, 167, 241);"></td>
          </tr>

CSS:

.container2 th h1 {
   font-weight: bold;
   font-size: 1em;
  text-align: center;
  color: black;
}

.container2 td {
    font-weight: normal;
    font-size: 0.9em;
  -webkit-box-shadow: 0 2px 2px -2px #0E1119;
     -moz-box-shadow: 0 2px 2px -2px #0E1119;
          box-shadow: 0 2px 2px -2px #0E1119;
}

.container2 {
    text-align: center;
    overflow: hidden;
    width: 70%;
    margin: 0 auto;
   display: table;
   padding: 0 0 8em 0;
}

.container2 td, .container2 th {
    padding-bottom: 2%;
    padding-top: 2%;
    padding-left: 5%;  

}

Appreciate your help in advance. Apologies if this seems basic, but I could use some guidance on this matter.

Answer №1

To accomplish this task, there are two methods to consider. Let's begin with the simpler one:

All you need to do is insert the + sign in the first column and adjust spaces accordingly (quite straightforward).

For example:

<tr style="background-color: #eee;">
          <td onclick="showPleaseHide()" id="trCheck" style="background-color: #eee; transition:box-shadow 0.2s ease-out; text-align: left;">Enrollment Fee  <i style="color: orange;" class="fa fa-plus"></i></td>
          <td>US $0</td>
          <td>US $450</td>
          </tr>

Alternatively, here is Option 2:

Utilize the predefined "plusButton" class to reduce the space between the border and the + sign.

Here is the HTML implementation:

<tr style="background-color: #eee;">
          <td onclick="showPleaseHide()" id="trCheck" style="background-color: #eee; transition:box-shadow 0.2s ease-out; text-align: left;">Enrollment Fee</td>
          <td class="plusButton"><span class="down1"><i style="color: orange;" class="fa fa-plus"></i></span></td>
          <td>US $0</td>
          <td>US $450</td>
          </tr>

The above code corresponds to the initial example provided. Now, let's delve into the CSS part:

.plusButton {

    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

I trust that this explanation proves helpful :)

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

Verifying StartDate and EndDate using AngularJS and Bootstrap Datepicker

My HTML Coding <form name="myForm"> <div class="row"> <div class="col-md-2"> <input data-ng-model="Data.StartDate" type="text" id="startDate" name="startDate" class="form-control" data-da ...

Mastering the art of transitioning between DIV elements

I am looking to implement a rotating three-card display on click, and have come up with the following code: $('.box1').click(function(){ $('.box1').toggleClass('removeanimate'); $(this).toggleClass('go'); ...

Harnessing the power of VUE.js: Exploring the versatility of V-bind with Array and

I've encountered an issue with an app I'm currently working on. In my project, I am utilizing Vue.js to create the front-end and attempting to apply two classes to a div within a v-for loop. The first class is bound with a filter that functions ...

Tips for responding to and disabling a specific button in Vuetify.js after clicking the follow or unfollow button

I have a situation where I need to implement a functionality for a series of buttons with follow and unfollow statuses. When a user clicks on any button, I want the status to change after a brief delay and deactivation, followed by reactivation. For instan ...

Retrieve the current date and time data from the database and populate it into a datetime input field

I've encountered an issue while trying to fetch a Datetime value from my database and insert it into an html input with a date type. Unfortunately, the input field appears empty. $resQuery = mysql_query("SELECT * FROM reserveringen WHERE id = $ID"); ...

Error: Property 'html' is undefined - AJAX response must be displayed only in a specific div

I encountered an issue: Uncaught TypeError: Cannot read property 'html' of undefined I am working on implementing a voting system for each video on my webpage from a database. I have successfully integrated it using AJAX, but the problem is ...

Techniques for preventing background layering using CSS

I have implemented a background image on the <input type="submit"> element to give it the appearance of a button. My CSS code looks like this: input.button { background-image:url(/path/to/image.png); } Furthermore, I would like to display a dif ...

CSS Media Query Assistance - optimizing text display for mobile responsiveness

I am currently facing an issue with my CSS code where the content is displaying as one long sentence on mobile devices, requiring users to scroll to read it. I am trying to modify it so that it displays as two lines on mobile. <!-- promo banner --> ...

The function was expecting an array for ordering, but instead received an object

I need help filtering my results based on their position. Whenever I try to use the orderBy function, it breaks the page because the result is not an array. How can I fix this issue? I'm currently stuck at this point. This is how I attempt to filter ...

Transform the contents of a div tag into a function by removing the entire div tag

My goal is to find a clever solution for removing the contents between specific HTML classes using PHP. For example, I want to erase all the HTML within the "sometestclass" class. The function below is somewhat functional but not perfect. It eliminates so ...

Tips for preserving changes made to a jQuery script when the page is reloaded

Is there a way to retain jQuery script changes when the page is reloaded? I have a page where clicking on certain elements triggers events, and I want these changes to persist even after reloading the page, resetting only when the cache is cleared. I appre ...

Scaling Vuetify icons dimensions

During the development of an app using Vuetify, I encountered challenges in changing the default colors set by Vuetify. After some trial and error, I came across a solution on: https://github.com/vuetifyjs/vuetify/issues/299 The solution involved adding ...

Troubleshooting a dysfunctional Vue.js component

I am currently facing a challenge in getting components to function properly. Interestingly, without the component, everything seems to be working fine (as per the commented code). Here is my HTML snippet: <strong>Total Price:</strong> <sp ...

I am having trouble displaying the background on my website using css/html

I'm currently working on enhancing my website BJBGaming1.com, and I've encountered an issue with setting a background. Here's the code snippet I have: <!doctype html> <html class="no-js" lang="en"> <head> <meta charset= ...

unable to retrieve real-time data using a search bar

I'm working on a drop-down menu of locations/Regions with a search box nested inside. https://i.sstatic.net/liWpP.png The image shows a list of places followed by regions. The region section is static, while the rest of the places are fetched from a ...

Notification of Exceeding File Size Limit

Seeking assistance with implementing a 'filesize' error message into a script used for uploading BLOB files to a mySQL server. if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($dat ...

What is the best way to duplicate a tag that contains multiple other tags with attributes?

My form, named 'myForm', needs a div tag with the id 'original' to be added every time I click a button. Can someone help me figure out how to add these tags? The new tags should appear after the original one, but still within myForm. ...

Is there a way to shift the display of inline-block to the right?

I'm struggling with positioning a div that's nested within a display:inline-block. How can I align it to the right side of the container? <div style='width:100%'> left <div style='display:inline-block;position:relative;r ...

Obtain the precise X and Y coordinates of a <li> element regardless of where the mouse is clicked using Typescript

I'm stuck and could really use some assistance! Hey there, I have a simple question but I seem to be missing a crucial element. Here's my fiddle where I can detect the clicked item but that's as far as I've gotten: http://jsfiddle.ne ...

The alert box is not displaying, only the text within the tags is visible

Trying to implement an alert message for logged-in users. A successful login will trigger a success message, while incorrect username or password will display an error. function showMessage(response) { if (response.statusLogged == "Success login") { ...