What is the method for implementing a personalized width for table headers with bootstrap/css?

I am facing an issue with applying custom width to each header of a table in my html. Despite having bootstrap4 integrated, the custom widths are not being applied.

Below is the complete HTML code for the table:

<div class="row">
  <div class="col-12">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th class="user-profile-th" style="width:10%;">
                        <label class="container-checkbox"><input class="site-checkbox "
                                type="checkbox" ><span
                                class="checkmark-checkbox"></span></label></th>
                    <th class="user-profile-th brand" style="width:20%;">Brand</th>
                    <th class="user-profile-th link-code" style="width:40%;">Link/Code</th>
                    <th class="user-profile-th" style="width:15%;">Clicks</th>
                    <th class="user-profile-th" id="status" style="width:15%;">Status</th>
                </tr>
            </thead>
            <tbody>

                <tr>
                    <td><label class="container-checkbox"><input class="site-checkbox"
                                type="checkbox"><span class="checkmark-checkbox"></span></label></td>
                    <td>ClassPass</td>
                    <td class="refrl">
                        www.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pkwww.testing.com.pk
                    </td>
                    <td>0</td>
                    <td>
                        <div class="tag-cstm rejected"> Rejected </div>
                    </td>
                </tr>
                <tr>
                    <td><label class="container-checkbox"><input class="site-checkbox"
                                type="checkbox"><span class="checkmark-checkbox"></span></label></td>
                    <td>Fave</td>
                    <td class="refrl">www.yoyo.com</td>
                    <td>0</td>
                    <td>
                        <div class="tag-cstm rejected"> Rejected </div>
                    </td>
                </tr>
                <tr>
                    <td><label class="container-checkbox"><input class="site-checkbox "
                                type="checkbox"><span class="checkmark-checkbox"></span></label></td>
                    <td>artificial inteliggence</td>
                    <td class="refrl">www.xyxx.com</td>
                    <td>0</td>
                    <td>
                        <div class="tag-cstm approved"> Approved </div>
                    </td>
                </tr>
                <tr>
                    <td><label class="container-checkbox"><input class="site-checkbox "
                                type="checkbox"><span class="checkmark-checkbox"></span></label></td>
                    <td>polymorphism</td>
                    <td class="refrl">www.oopconcepts.com</td>
                    <td>0</td>
                    <td>
                        <div class="tag-cstm pending"> Pending </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <!--bindings={ "ng-reflect-ng-if": "false"}-->
    </div>
</div>

Check out my full code on JSFiddle here

Does anyone know why the custom widths are not applying as expected?

Answer №1

To change the width, you can add a custom style with style="width: 2000px;".

You may want to consider using appropriate bootstrap classes for better functionality...

For more information on bootstrap tables, visit https://getbootstrap.com/docs/4.0/content/tables/.

Here is an example code snippet to illustrate:

<table class="table">
<thead class="thead-dark">
    <tr>
        <th style="width: 2000px;" scope="col">#</th>
        <th scope="col">First</th>
    </tr>
</thead>
<tbody>
    <tr>
        <th scope="row">1</th>
        <td>Mark</td>
    </tr>
</tbody>

View the image Here: Check out the image Here

Feel free to explore the Live code here: https://codepen.io/manaskhandelwal1/pen/WNvoVeg

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

In Internet Explorer, the list items are overlapping, while functioning perfectly in all other web browsers

I've encountered a strange issue with my list item in Internet Explorer. Despite working perfectly in Chrome and other browsers, it fails to function properly in IE. I've built this application using the Vue framework and have faced various probl ...

Access and expand a bootstrap accordion with a hyperlink

Here is a concept I want to make happen: For my project, I am utilizing Bootstrap v3.4.1 and have set up two columns next to each other. My goal is to link the elements in the hotspot banner (left column) to trigger and open the corresponding Accordions ( ...

Video embedded in a plain CSS popup that automatically starts playing even before the popup is triggered

My goal is to incorporate a video into a minimalist CSS modal window, following the guidance provided here. While the setup works well overall, I encounter a issue where the video starts playing before the modal window is opened (I need to maintain the "au ...

Enhancing the background with curves for optimal viewing on mobile devices

I'm currently pondering if I should create the shapes manually or simply use a background image to achieve the desired effect on mobile view. https://i.sstatic.net/y99A8.png Any input or guidance on this matter would be greatly appreciated. As of n ...

Tips for implementing resizable Material-UI Dialogs

I'm working on a project that involves creating a dialog box that can be resized and dragged. While I found steps in the Material-UI Dialog documentation on how to make it draggable, I'm still looking for information on how to make it resizable. ...

How do I ensure that my absolutely positioned element is centered in this specific scenario?

I've been working on centering an element within its parent container, and I'm having trouble ensuring it remains centered responsively. Here's what I have so far: HTML <div class="example"> <span class="element1">Element ...

Showing a div above another div without relying on z-index

I have designed custom drop down menus that consist of one <div> containing the current value and functioning as a <select> field, with another <div> below it that appears when the top one is clicked, displaying all the <option> val ...

Differences between -webkit- and -moz-transition

My website uses CSS3 transitions and I have noticed that the -webkit- prefix works, but the -moz- prefix does not seem to be working. This is the CSS code I am using: article {z-index: 2; float: left; overflow: hidden; position: relative; -webkit-transit ...

The CSS3 Border-Radius feature is showing some color bleeding on a border that is colored differently

I designed a dynamic-width container with rounded edges using border-radius, along with a bold border on one side of the container in a different color. Everything looks fine when the browser window is small, but as I expand the window size, I notice the ...

Interact with HTML Radio Buttons to Trigger Input Opening

I need to have a message saying "We're sorry..." and a "black box" displayed only when the radio button is set to YES, otherwise keep it hidden. Can I achieve this using JavaScript only, or is there a way to do it with HTML alone? <h3 >Did you ...

What is the method for choosing an item from a Bootstrap dropdown with Python Selenium?

I am facing an issue in selecting a Bootstrap DropDown using Selenium Python. The element I need to select does not have an ID or Name. Typically, we can locate it by id or name, but in this case, I attempted to use find_element_by_xpath. It seems that t ...

Can a URL be included in the options of an rmarkdown header?

We have developed a method within our team to create branded reports from rmarkdown documents using custom CSS and HTML files. To maintain consistency, we utilize absolute paths to the style documents in our shared file structure. This allows us to easily ...

Struggling to create a responsive navbar for a landing page using Next.js and TailwindCSS

I'm currently working on a landing page using nextjs, tailwind css, and shadcnui. The design looks great on desktop with a logo and two links, but it's not responsive on smartphones. https://i.stack.imgur.com/HVQsa.png On mobile devices, the lay ...

The Firefox browser is not rendering the website correctly

After successfully programming a website with the FullPage Slider from this source, everything was working fine except in Firefox. Specifically, one section containing a table with image overlay hover effects from these effects library was not functioning ...

Exploring the functionality of Jquery with the :active selector

Here is the code I have been working on: $('#ss a:active').parent().addClass('ss-active'); It seems like my code is not functioning as expected. Can you help me figure out how to achieve my desired outcome? Additionally, I want the bu ...

Displaying Unicode CSS Font Awesome Icons as Boxes in a React Project

I have incorporated the jPlayer example into a create-react-app. Encountering an issue where font-awesome icons are displaying as boxes in this CodeSandbox illustration. https://codesandbox.io/s/peaceful-heisenberg-d59nz?fontsize=14&hidenavigation=1&a ...

CSS designs that adapt flawlessly to high-resolution mobile devices with perfect responsiveness

Currently, I am implementing max-width: 768px to modify the appearance of my website. However, with the increasing number of high-resolution devices available in the market such as 4K mobile phones, I am wondering how I can detect them. Should I consider ...

Can you set the line thickness for "text-decoration: line-through;" using CSS?

When it comes to the line-through property in CSS, the default weight of 1px is ideal for body copy set at 1em. However, for larger items like a price set at 3em on an offer site, 1px can feel too light. Is there a way to increase the line weight for line ...

HTML5 provides seamless transitions for videos

Interested in implementing the HTML5 video tag and JavaScript to achieve a seamless video transition, similar to a cut in a movie. I have reviewed the API at http://www.w3.org/TR/html5/video.html#tracklist If anyone has any suggestions, I would greatly ap ...

The mobile screen size shortcuts are malfunctioning, while the regular links are functioning properly

ISSUE: Links in alias buttons are not working on mobile screen size, while normal links to other webpages like social media work fine. Description I created a project using an HTML, CSS, JS building tool from The project was exported and placed into a ...