The width of a <div> element in CSS is not dependent on the width

Is there a way to make tables within a div have relative widths to each other? For example, if one table has a large image or long word causing it to extend to 100%, how can we ensure that the other tables in the same div also adjust to 100% width?

CSS

.outer {
    border: solid 3px green;
    width: 100%;
    display: block;
}
table {
    border: solid 1px red;
    width: 100%;
}
.label {
    border: solid 3px red;
    width: 20%;
}

HTML

<div class="outer">
      <table >
        <tr>
          <td class="label">
                 Label 01
          </td>          
          <td>
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq  s
          </td>  
        </tr>
        <tr>
          <td class="label">
                 Label 02
          </td>                  
          <td>
    meworks & Extensionsotools More 1.3.1 (compat)
    ART 0.8.7 PowerTools 1.0.5 Fiddle Options External Resources
    Languages Results Ajax RequestsLegal, Credits and Links
          </td>  
        </tr>      
      </table>
    </div>

Check out my Demo

Answer №1

To provide a solution to the specific inquiry,

    utilize: table;

for the main 'section' container.

Answer №2

style for table td element should include word-wrap property with a value of break-word.

The content must consist of meaningful words, not just random letters repeated.

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

What could be causing the removeChild() method to fail when trying to delete a list item in JavaScript DOM manipulation?

Check out this interactive shopping list. You can add items, delete them, and mark them as completed. Adding and deleting items works fine, but there's an issue when toggling them. Issue (occurs when toggling multiple list items) If you add 3 items ...

The line directly following the first line within the <li> element is located in the same position

I need help with customizing the bullet background-image for an <li> element. I want the text in the bullet to be displayed outside the marker using the CSS property list-item-position: outside. However, my current implementation doesn't seem to ...

Is it possible to rearrange the positions of 2 divs using solely CSS?

I have created a unique design. On iPad, I am assigning the class 'handHeld' to the <body>, which will trigger positional changes between optionsWrapper and #container using CSS classes I've defined below on jsfiddle.net. .handHeld d ...

The impact of Opacity CSS on child elements in web design

Struggling to show an error message when a user disables JavaScript. In my current work, I have two div layers - one covering the entire page and another on top to display the warning message. However, I'm facing issues with the opacity settings affec ...

Construct a Product Showcase Page" (FreeCodeCamp) - Issue "Incurred upon clicking a .nav-link button in the navigation panel

Hi there! I've been working on a page programming task, but I'm having trouble with the "№5 “When I click a .nav-link button in the nav element, I am taken to the corresponding section of the landing page.” error. Can anyone help me figure ...

Customize your Bootstrap 4 card: change the header content, keep the body fixed

My current project involves the use of a bootstrap 4 card element: <div class="card" style="height:"500px;width:100px"> <div class="card-body"> <div class="top-portion"> This section can b ...

What is the best way to change the background color of a table cell in HTML and CSS?

Trying to adjust the background image of each data cell to a selected image has been challenging. Using the method displayed below, only the top left corner of the photo appears. The code snippet demonstrates setting the background of each data cell to th ...

Dropdown menu is misaligned on the screen

I am currently working on enhancing my navigation bar with a dropdown menu using Bootstrap. However, I have encountered an issue where one of the items in the menu is not displayed properly. If you would like to see the full HTML and CSS code, you can vie ...

Expanding SVG Button Overlay in ChakraUI

I am trying to design a uniquely shaped button that sits on top of an image, but I am encountering some challenges with the scaling of the button mask. Both the image and masks were created at the same base dimensions for easy alignment at 0,0. Here is a ...

The content div sits atop the full-width image instead of being displaced downwards

Featuring a stunning full-width image: .image { background-image: url(http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2014/06/wallpaper_51.jpg); background-position: center center; background-repeat: !important; position: absolute; ...

Remove the empty space between lines of images

Is there a way to remove the horizontal and vertical space between the squares? <div class="first"> <ul> <li><img src="http://dummyimage.com/40x40/111111/000000.jpg"/></li> <li><img src="http://dummyimage ...

Malfunctioning Bootstrap collapse feature

I am experiencing an issue with my modal that contains 2 blocks. When I click on the .emailInbound checkbox, it opens the .in-serv-container, but when I click on the .accordion-heading to reveal the comment section, the .in-serv-container collapses. What c ...

Tips for preserving CSS styling following a hover event

While working on implementing a Menu control using jQuery and CSS, I encountered the following issue: Here is a live demo that demonstrates my current problem When I hover over 'Menu Item 1', this item successfully changes its style (background ...

Ways to adjust the height of a Vuetify v-autocomplete listbox (results area) through CSS

I'm looking to adjust the height of the Vuetify v-autocomplete component, which is currently set at 304px (possibly a calculated value). <v-autocomplete class="flex-grow-0 ml-16 mr-6 largecontent" prepend-inner-icon="mdi-magn ...

Using javascript to display a vertical scroll bar within a dropdown menu

My challenge is to create a drop-down list that displays the first four items with a vertical scrollbar when the user clicks on it. The remaining items should be visible as the user scrolls through the list. You can find a sample fiddle here: http://jsfid ...

The functionality for dragging elements is not functioning properly in JavaScript

Here is the code I used in an attempt to make a div element draggable: let div = document.querySelector('div') div.onmousedown = function() { div.addEventListener('mousemove', move, true) } window.onmouseup = function() { window. ...

How would you go about creating a VueJS component that displays a table with a set number of columns and automatically distributes the cells within them?

Hey there! I'm currently working with a VueJS component that looks like this: <template> <div> <table> <tbody> <tr v-for="(item, index) in items" :key="index"> <t ...

Assign multiple EventListeners to an element and remove specific ones individually

I have a specific element, in this case the $(window) in the code example. I want to attach multiple EventListeners to this element, specifically the "scroll" event twice. These two EventListeners have distinct functionalities that I prefer not to combine, ...

How can I ensure that a form submission still functions properly even when the submit button disappears due to an onBlur event in React and Next

I am facing an issue with a form on my website that triggers an event upon submission. Within the form, there is a textarea field. When you click on the textarea, a submit button appears. However, it disappears when you click out of the textarea. This fun ...

Tips for utilizing JavaScript getElementByClassName to retrieve all the elements within a ul without having to specify the class name in each li

Looking to tidy up my HTML/CSS. Is there a way to keep this JavaScript functioning without needing to add the class name to every li element within the ul? Any suggestions on how to improve the visual appeal and readability of the HTML code? const Profi ...