The width of the table column refuses to adjust

My table is 900px wide with 13 columns. The issue I'm facing is that no matter the width I assign, my first column Tap stays the same size. I'm trying to resize the first column to prevent the last column from looking squished.

This is how my table appears:

I've attempted adding a style="width: 40px;" to the first column but it doesn't have any effect.

.print_ttr {
    width: 900px;
    border: solid 1px;
    border-collapse: collapse;
}
.print_ttr th { 
    /* Additional CSS properties */
}
.print_ttr td { 
    /* Additional CSS properties */
}
.print_tableInputBox {
    /* Additional CSS properties */
}
.holder{
    /* Additional CSS properties */
}
.section{
    /* Additional CSS properties */
}
<div class="section">
    <div class="holder">
        <table class="print_ttr">
            <tbody>
                <tr>
                    <th style="width: 30px;">Tap</th>
                    <!-- Remaining columns -->
                </tr>
                <!-- More rows and cells -->
            </tbody>
        </table>
    </div>
</div>

Answer №1

After inputting your code in JS Bin here, this is the result:

Despite including the container div as well:

You might want to try adding this snippet to your code:

.print_ttr th:first-child{
    border-color: black;
    font-size: 12px;
    border: solid 1px;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    width: 30px;
}

I'm not sure what's going on, but I believe this matches your requirements. I've tested it on Google Chrome and even after embedding your code in a code snippet, the output remains consistent. Check it out here:

.print_ttr {
  width: 900px;
  border: solid 1px;
  border-collapse: collapse;
}
.print_ttr th {
  border-color: black;
  font-size: 12px;
  border: solid 1px;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
}
.print_ttr td {
  border-color: black;
  font-size: 12px;
  border: solid 1px;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  text-align: center;
}
.print_tableInputBox {
  width: 100%;
  height: 100%;
  border: none;
  display: inline-block;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color: black;
  text-align: center;
  margin: 0;
  padding: 0;
  border-collapse: collapse;
}
<table class="print_ttr">
  <tbody>
    <tr>
      <th style="width: 30px;">Tap</th>
      <th>Primary Voltage</th>
      <th>Secondary Voltage</th>
      <th>Calculated Ratio</th>

     <!-- More table rows and cells -->

  </tbody>
</table>

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

Issue with Bootstrap navigation bar not displaying on iPad devices

Currently, I am working on creating a custom bootstrap menu that displays properly on an iPad screen size. I have implemented the standard navbar code from Bootstrap with a few tweaks. While it works well on smartphones and laptops, the issue arises when ...

Submitting a form from outside the form using a button in HTML: A step-by-step guide

I'm looking to submit a form using Angular on the functions next() and saveStep(). I'm unable to place next() and saveStep() within the form itself. I have set up my ng-click for next() and saveStep() below the form. When I submit the form fro ...

Mobile devices with a horizontal scroll

Having trouble with side scrolling on mobile devices. I've set two @media queries for tablet and mobile. Visit dev.bdbshop.com @media only screen and (max-width: 767px) { .wrap { max-width: 300px; } Could the issue be related to this? Any suggestio ...

Animate the rotation of specific paths within the SVG

I've designed an SVG using Illustrator and I have a specific animation in mind for it. My goal is to create an animation where the upper part of the circle line rotates from left to right (considering that there are 4 circle lines, with number one st ...

Recording videos using the Safari Browser

Within my ReactJs application, I have integrated react-multimedia-capture, a package that utilizes navigator.mediaDevices.getUserMedia and the MediaRecorder API to facilitate video recording. While I am successfully able to record videos on Chrome, Safari ...

Why is the hashtag (#) mysteriously vanishing from the URL?

Imagine a scenario where you have a page with a URL like mypage.php#tab3, and there is a link that looks like this: When you click on the "Add" link, the URL becomes shorter to just mypage.php#. The code for the "Add" function is as follows: function ad ...

Adjusting the size of the iframe to match the dimensions of the window

Is there a way to make the iframe automatically fill up the entire space? For example, only opens the iframe up to half of the window in Mozilla Firefox and IE6. How can I ensure that it takes the maximum size of the screen? Are there any CSS or JavaScr ...

Exploring the placement and animation of a Flexbox dropdown menu

I'm currently working on designing a header with three main elements: ---------- LOGO ---------- hidden navigation bar ---------- BUTTON ---------- This header layout is supposed to grow into the following structure: ---------- LOGO ------ ...

Obtaining template attributes in CKEditor: A guide

I have been working with the template plugin in CKEditor to load predefined templates. Each template is defined as follows: templates: [ { title: "Quickclick 1", image: "template1.png", description: "Quickclick 1 template", html_et: "& ...

When using $.ajax, special characters are not rendered properly, displaying strange symbols instead of accents such as "é" or "ã"

I'm struggling to display the letter "é" using $.ajax and a JSON file. I've tried setting everything up with <meta charset="utf-8"> but all I get is an alert window showing "". Any help is appreciated, just not looking for PHP solutions. H ...

What is the best way to activate a click event when I set a radio button to checked?

I am facing an issue with an uninitialized property in my app.component.ts: color!:string; I am trying to automatically initialize the color property when a radio button is selected: <div> <input type="radio" name="colors" ( ...

Creating an adaptable image with CSS or Material UI

Is it possible to create a responsive image that shifts from the top right position to the bottom as the size decreases? I've been using Material UI but haven't found any guidance on how to achieve this. .my-photo{ height: 300px; positio ...

Production environment poses a challenge as Rails 4 struggles to locate fonts

Situation: I am facing an issue with my Rails 4.0.0 application deployed using capistrano, where the asset precompilation does not work properly on my production server. Challenge: Despite successfully adding a font and using it with @font-face locally, t ...

Center both vertically and horizontally in Bootstrap UI Modal

I'm attempting to create a Bootstrap UI Modal that is centered both vertically and horizontally. While I found this solution that successfully centers the modal vertically, it loses its horizontal centering when applied to my own template with 800px ...

Could you advise on the best placement for my upcoming JQuery animation?

Here is the code I am currently working with: $(function() { $("button").click(function() { $("#box1").animate({ left: $(window).width() - 800 }, { complete: function() { $("#box1").hide(); } }); $("#box2").a ...

Having trouble retrieving text using getText() or getAttribute("innerHTML")

getAttribute but struggling to retrieve the text associated with each combobox. I need to access the text content of every combobox. <small> <input type="checkbox" checked="checked" value="on" name="irOperations[0]"/> Account Activity < ...

How can I position a Button at the center of my Grid item using Material UI?

In my React 16.13.0 application, I am utilizing Material UI's Grid and trying to center the content of a button in the middle of a row. Here is what I have tried: center: { alignItems: "center", width: "100%", }, halfRow: { width: "5 ...

Creating interactive dialogue: the speech bubble script

I'm having trouble with my code overlapping in sections, and I just can't seem to figure out why. I've tried adjusting borders, adding padding, adjusting spaces, changing widths, reviewing the code, and even removing absolute positions, but ...

convert emails into web pages for easy viewing

When creating an email, ensuring it displays properly in all email programs can be a challenge. One way to address this issue is by including a "Email not displaying correctly? View online" link. One option could be to save a copy of the email on a server ...

Using jQuery to populate a select box with values from an XML file

I've come across various examples demonstrating how to achieve this task and have successfully applied others that utilize attributes. However, in the current scenario, I am working with XML data that does not contain attributes. My goal is to populat ...