What is the best way to ensure my inline-block table extends to 100% width?

I have some code below that I'm working on to achieve a look similar to this image: https://i.sstatic.net/744M7.jpg

One thing I'm struggling with is how to extend the table header all the way to the right. Additionally, I need help adding more space between the bottom border.

If you're feeling lazy, my current code renders like this: https://i.sstatic.net/9VLu1.jpg

font-family:Arial;
 font-size:12px;
 width:800px;

}
table {
  border-style: solid;
  border-color: #cfdaf1;
  border-width: 1px;
  border-collapse: collapse;
}
th {
  text-align: left;
  background-color: #cfdaf1;
  padding: 3px;
}
td {
  padding: 10px
}
#headerMenu {
  display: inline-block;
  height: 125px;
  padding: 5px;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
}
#contactTable {
  display: inline-block;
  padding: 3px;
  margin-bottom: 1px;
}
#tableHeader {
  display: inline-block;
  padding: 3px;
  margin: 5px;
}
#ul {
  list-style: none;
  padding: 0px;
}
#ul li:before {
  content: '►';
  margin: 0 1em;
}
<table id="tableHeader" width="100%">
  <tr>
    <th style="border-bottom: 1px solid black;">Key Skills</th>
  </tr>
  <tr>
    <td>This is a main summary of my skills.</td>
  </tr>
  <tr>
    <td>
      <ul id="ul" style="list-style-type: none">
        <li>Negotiating (Intermediate)</li>
        <li>Access (Beginner)</li>
        <li>Accounting (Beginner)</li>
        <li>Sales Auditing (Expert)</li>
        <li>Invoicing (Intermediate)</li>
      </ul>
    </td>
  </tr>
</table>

Answer №1

Using a table and setting its display: inline-block may not be the best approach. Instead, consider using display: table; width: 100% in CSS to make it fill the width. Additionally, wrapping it inside a <div class="container"> can improve CSS maintenance.

Check out this example for reference: https://jsfiddle.net/Zay_DEV/a5zwgjz3/

Extra Tip -

Implementing this example should fulfill all your requirements: https://jsfiddle.net/Zay_DEV/a5zwgjz3/2/

Answer №2

For those who lean towards a more streamlined and table-free layout, while maintaining the use of display: flex;, you can check out this alternative approach: https://jsfiddle.net/vowpzf47/

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

How to Align Bootstrap Icons in the Center Horizontally

I'm struggling to center Bootstrap Icons within my buttons. The icon appears to be off-center horizontally, and I've tried various methods like text-align and flexbox with justify-content. It seems like the "letter" itself is causing some extra s ...

Can the loaded image from the css sprite be displayed on the screen?

My webpage is designed to load two images from a CSS sprite using the following code: <html> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div class="arrow low"></div> ...

Error Message: The function "menu" is not a valid function

I've encountered an issue with a function not being called properly. The error message states "TypeError: menu is not a function." I attempted to troubleshoot by moving the function before the HTML that calls it, but unfortunately, this did not resolv ...

What is the reason behind the image not displaying before the AJAX request is initiated and then disappearing once the request is completed?

I am attempting to display a "loading" gif while my AJAX request is being processed. Below are the functions I am using: beforeSend: function () { $('.form-sending-gif').show(); console.log("The beforeSend function was called"); } and ...

Using Handlebars, you can easily interpolate variables within an "each" loop

I have integrated this code into an express app that utilizes handlebars as its template engine: res.render("movies", { data: pages, arraypages:arrayPages, movie:movie}) The "arrayPages" variable is represented by an array: [ 1, 2, 3, ...

Utilizing flexbox for dynamic width adjustment with flex-grow functionality

Currently, I am in the process of configuring a menu bar using this particular template I have been attempting to achieve this layout utilizing FlexBox, but it appears that there is an issue. Here is the HTML code: <nav> <ul> < ...

How can I resize an element using jQuery resizable and then revert it back to its original size with a button click?

I need help figuring out how to revert an element back to its original size after it has been modified with .resizable. I attempted the following: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="//code. ...

Issue with HTML5 video not displaying poster image after using .load() method

I am facing an issue with my video implementation where the poster image is not returning after exiting full screen mode. I have a video with overlay content that requests full screen when the user clicks a custom play button. When the user exits full scre ...

The never-ending scroll feature in Vue.js

For the component of cards in my project, I am trying to implement infinite scrolling with 3 cards per row. Upon reaching the end of the page, I intend to make an API call for the next page and display the subsequent set of cards. Below is my implementatio ...

How do I submit an array of objects in Laravel?

I am currently working with a dynamic table that allows users to add and delete rows. Each row contains input fields where users can enter data for an object. At the moment, I am manually assigning index numbers to the name attribute like this: <input ...

Meteor JS failed to load the CSS file due to an unsupported MIME type

Currently, I am working on a meteor js 1.8 app. I have created a layout and now I want to add CSS to it. Here is the structure I am following: imports -ui --stylesheets --bootstrap.min.css --font-awesome.min.css --skins.css --forms.css All my CSS files ...

What is an html5 tooltip widget?

I stumbled upon a helpful tutorial on html5canvastutorials.com that caught my eye: let triangle = new Kinetic.Shape(function(){ let ctx = this.getContext(); ctx.beginPath(); ctx.lineWidth = 4; ...

What is the solution to the error message "cannot find specified file or directory, lstat 'scss/'"?

I am currently following a tutorial on YouTube here where the instructor is demonstrating how to run an npm script "sass" file using the terminal. When I try executing the command npm run sass, it gives me an error message: Error: ENOENT: no such file o ...

I am having trouble with json_encode in my Symfony2 controller

Just starting out with Symfony2 and AngularJS. Trying to use json_encode to display content from my database, but running into issues. Here's my controller: public function catalogonewAction() { $data = $this->getDoctrine()->getManager() ...

Issue with preventDefault not functioning correctly within a Bootstrap popover when trying to submit a

I am facing an issue with a bootstrap popover element containing a form. Even though I use preventDefault() when the form is submitted, it does not actually prevent the submit action. Interestingly, when I replace the popover with a modal, the functional ...

Achieving maximum height in Tabs with react-bootstrap

Utilizing React Bootstrap, I have a full screen Modal with Tabs in its body. Within one of these Tabs, I aim to create a Lexical Editor that fills 100% of the width and height of the modal body with some margin. This is a simplified version of my code: F ...

managing the speed at which animated gifs are loaded and played

I am facing a challenge with a slideshow that features multiple animated gifs. Each slide is equipped with its own animated gif. My goal is to ensure that the animated gifs play in synchronization with the timeline I have set up in photoshop, starting fro ...

What is preventing the div container from extending to its full width?

The content on the right side of this div container is struggling to reach full width for some unknown reason. Click here to see an image of the issue. The right column is not extending to full width. This snippet shows my CSS code. The 'main-conte ...

Conceal the main div when the nested div does not contain any content

Is there a way to hide the parent div EventsRollup when the child div RelatedEventsList is empty? <div class="EventsRollup"> <span class="EventsRollupTitle">CPR &amp; Health Safety Classes</span><br /><br/> ...

Steps to eliminate the dividers between cells in a Material UI Table

I've been experimenting with various CSS properties and elements within the Material-UI Table and TableCells, but I'm still unable to remove the horizontal lines between rows. Does anyone know how to achieve this in the Table component of Materia ...