Make sure that the two rows in my Bootstrap table are consistently positioned next to each other, regardless of the length of the text

When working with a Bootstrap panel containing text inside a table, I've encountered a challenge. One side features links while the other displays descriptions. At times, I find myself having to artificially lengthen the text to ensure it aligns correctly next to the corresponding link or description.
Is there a more efficient way to set up these rows so that the text always appears beside the designated link or description, irrespective of the text's length? I need a flexible solution that maintains the same line display but moves to a new row when necessary.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
  <div class="panel panel-primary">
<div class="panel-heading">
  <h4>Plan</h4>
</div>
<table class="table">
  <thead>
    <tr>
      <th>Set project strategy, tactics and timing</th>
      <th><a href="" target="_blank">Project Brief</a></th>
    </tr>
    <tr>
      <th>Choose the right channel for your communication</th>
      <th><a href="" target="_blank">Channel Guidelines</a>&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;</th>
    </tr>
    <tr>
      <th>Add your project to the calendar<br><br></th>
      <th><a href="" target="_blank">Communications Calendar Intake</a> </th>
    </tr>
    <tr>
      <th>Submit outbound call/text programs</th>
      <th><a href="" target="_blank">website to test</a></th>
    </tr>
    <tr>
      <th>Review vendor guidelines and share communication requirements with vendors</th>
      <th style="margin-left: 100px;"><a href="" target="_blank">Vendor Guidelines</a> &zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;&zwnj; &zwnj;</th>
    </tr>
  </thead>
</table>
  </div>
</div>

Answer №1

Your current approach may not work well across all screen resolutions; a more effective method is to utilize vertical-align:middle.

I've replicated the two rows without the &zwnj; that you initially included. These rows are highlighted in green, and I've also utilized the vertical-align property here.

Check out the working example below:

.table thead td {
  background-color: lightgreen;
  vertical-align: middle;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
  <div class="panel panel-primary">
    <div class="panel-heading">
      <h4>Plan</h4>
    </div>
    <table class="table">
      <thead>
        <tr>
          <th>Set project strategy, tactics and timing</th>
          <th><a href="" target="_blank">Project Brief</a></th>
        </tr>
        <tr>
          <th>Choose the right channel for your communication</th>
          <th><a href="" target="_blank">Channel Guidelines</a> &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj;&zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj;&zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; </th>
        </tr>
        <tr>
          <th>Choose the right channel for your communication</th>
          <td><a href="" target="_blank">Channel Guidelines</a>
          </td>
        </tr>
        <tr>
          <th>Add your project to the calendar<br><br></th>
          <th><a href="" target="_blank">Communications Calendar Intake</a> </th>
        </tr>
        <tr>
          <th>Submit outbound call/text programs </th>
          <th><a href="" target="_blank">website to test</a></th>
        </tr>
        <tr>
          <th>Review vendor guidelines and share communication requirements with vendors</th>
          <th style="margin-left: 100px;"><a href="" target="_blank">Vendor Guidelines</a> &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj;&zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj;&zwnj; &zwnj; &zwnj; &zwnj; &zwnj; &zwnj;</th>
        </tr>
        <tr>
          <th>Review vendor guidelines and share communication requirements with vendors</th>
          <td style="margin-left: 100px;"><a href="" target="_blank">Vendor Guidelines</a>
          </td>
        </tr>
      </thead>
    </table>
  </div>
</div>

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

JavaScript takes the spotlight before CSS

Currently experiencing this issue in Chrome, although Firefox seems to be working fine so far. Here is a greatly simplified version of the problem: HTML: <div class="thumbnail"> <a href='#' id="clickMe">Click me!</a> </d ...

Error 404: Jquery Fancy Box Not Found

Help needed with JQuery FancyBox: I encountered a 404 error when trying to enlarge small images. Here is the code that I used: <a class="fancybox-buttons" data-fancybox-group="button" href="images/gallery/1_b.png" style="margin-right:100px;"><im ...

How to choose elements using jQuery according to their CSS properties?

Seeking a solution to a unique challenge I've encountered. The website I frequent has found a way to bypass my uBlock extension by using a script that generates random element classes, such as: <div class="lcelqilne1471483619510ttupv"></div& ...

Dynamic menu bar accompanied by primary content

I'm facing an issue with my active navigation bar. Whenever I open the hamburger menu, the main content remains fixed and does not move along with the open navigation menu. I tried searching online for a solution but couldn't find anything helpfu ...

The issue of the back button not functioning in the React Multi-level push menu SCSS has

I have been developing a mobile-friendly Multi-level push navigation menu for my website using dynamically generated links based on projects from my GitHub account. I found a push menu on CodePen here and am in the process of integrating it into React inst ...

distinguish different designs for individual components in Angular 5

My project is divided into two main parts: one for public web pages and the other for an admin control panel. Each part has its own set of CSS and javascript files for custom templates. If I include all CSS and js files in index.html, they all load at the ...

Leveraging the form template in bootstrap solely for design enhancements

Is it possible to utilize the form layout in Bootstrap but have the input options disabled and the submit buttons act like regular HTML buttons that redirect elsewhere? https://i.sstatic.net/0Zwb8.jpg Why do I need this? I have resources on the homepage t ...

Execute grunt serve:dist with local file paths enabled

I am currently utilizing grunt to construct and deploy a basic angular web application that incorporates bootstrap and font-awesome. The project was initially set up using the yeoman generator-angular and constructed utilizing grunt serve:dist. I have obs ...

Creating a Distinct Interior Array Separate from the Exterior

I'm currently working on a project that involves creating a 2D array. I want the interior elements of this array to be black while the exterior elements should be white. However, my 2D array doesn't seem to be forming correctly - it looks more li ...

Troubles with Sizing in Twitter Bootstrap Modal

One issue I have encountered with my application is the varying widths of modals. Setting the width inline works well, but when the window is compressed it can cause part of the modal to be off screen, rendering it useless at smaller resolutions such as th ...

Icon that can be clicked before

I'm struggling to figure out how to make the link icon in my code clickable so that users can click anywhere within the card to navigate to another page. I experimented with (" attr(href) ") but it resulted in adding the URL text next to the ...

Button with small width containing an icon and text

I am trying to create a simple HTML button that has an icon on top and a description below it. <div class="mybtn"> <div><img src="someimage.png"></div> <div>Button description</div> </div> My question is, ...

Embed a photo into a pop-up window

Is there a way to dynamically insert an image into a Modal by utilizing the value of the variable data-image? This variable will change based on the selected image. <script type="text/javascript"> $('#myModal').on('show.bs.m ...

Is there a way to change the CSS of a sibling element when hovering over it

Imagine a scenario where hovering over one row changes its color. However, what if we want all rows of the same color to highlight when any row is hovered over? Is it possible to achieve this using just CSS? .red-row:hover { background-color: red; } ...

If the navigation menu contains sub-menus, it should slide to the left

I am currently working on developing a navigation menu with four levels of depth. The menu displays three levels at a time, and when the user reaches the fourth level, the first level should move to the left to make room for the second, third, and fourth l ...

Transitioning with an ellipsis

Currently, I am working on a project where I am trying to utilize the CSS property text-overflow: ellipsis to achieve a specific animation. However, despite applying this property along with white-space: nowrap and overflow: hidden to .card-dish__info, I a ...

Items within a shared container are currently displaying stacked on top of each other

I am facing an issue with my bike images and manufacturer names appearing on top of each other instead of next to each other. Despite using "col-md-12", the grid columns are not aligning horizontally as expected. How can I adjust the code so that each imag ...

Vue: auto-suggest feature in a text input field

I am looking to implement a text field with typeahead functionality. Essentially, I have a collection of words and as you start typing in the field, suggestions should appear based on the input. The challenge is that it should be capable of providing sugge ...

Is it necessary to install ng-bootstrap if my project was built using the Bootstrap 4 alpha theme in Angular 4?

I am currently utilizing the SB-Admin-BS4-Angular-4-master theme in Angular 4. The theme includes a link to . My goal is to implement Bootstrap modals in my code. Following the documentation provided in the theme, I integrated the modals as per instruction ...

utilize the "li" element to function as a clickable button

My HTML code contains ul elements, as shown below: <ul class="nav" id="loadCategories"> <li class="sub-menu"><a href="#">Search by category</a> <ul class=""> <li><a href="#">Food</a></li> ...