Is your Flexbox element exceeding the height of its parent container?

Due to design constraints, I implemented flexbox for this scenario and required the btn p elements to behave like display block. This was achieved through a post on another stack exchange thread. However, after setting the "other divs" class to 100%, it extends beyond the main parent container. The reason behind this behavior eludes me.

#outterWrapper {
  display: inline-block;
  height: 200px;
  border: 1px solid red;
}

#container {
  display: flex;
  height: 200px;
  flex-wrap: wrap;
}

#menu {
  display: flex;
  flex-basis: 100%;
}

#menu p {
  margin: 0;
  padding: 8px;
  padding-bottom: 0;
}

.otherDivs {
  height: 100%;
  width: 25%;
  background-color: grey;
  margin-right: 5px;
}
<div id="outterWrapper">

  <div id="container">

    <div id="menu">

      <p>Btn</p>
      <p>Btn</p>
      <p>Btn</p>

    </div>

    <div class="otherDivs"></div>

  </div>

</div>

As seen in the example above, the grey box extends beyond the red border?

Answer №1

If you want to switch to a column direction layout, you can use the following code:

#wrapper {
  display: inline-block;
  height: 200px;
  border: 1px solid red;
}

#content {
  display: flex;
  height: 200px;
  flex-direction:column;
}

#sidebar {
  display: flex;
}

#sidebar p {
  margin: 0;
  padding: 8px;
  padding-bottom: 0;
}

.additionalDivs {
  height: 100%;
  width: 25%;
  background-color: grey;
  margin-right: 5px;
}
<div id="wrapper">

  <div id="content">

    <div id="sidebar">

      <p>Link</p>
      <p>Link</p>
      <p>Link</p>

    </div>

    <div class="additionalDivs"></div>

  </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

Get real-time input values

Struggling to retrieve input value in real-time? The goal is to dynamically update the bottom buttons. The first X should match the number of carrots specified in the input above, and the second X will be calculated by a script. The key is to ensure that ...

Utilize flexbox to achieve center left alignment of elements within a DIV container

I've encountered a puzzling issue with my inherited markup. The width is defined on the outermost div and then inherited by each child div, creating a dynamic width scenario. The challenge I face is aligning the pink wrapper div to match the exact wi ...

Display a partial view dynamically without having to go back to the MVC controller

My div contains a partial view that is loaded dynamically based on data from the database. It can be students, employees, or any other type. I am utilizing MVC in the front end and web API in the back end. Instead of returning an MVC controller to view th ...

The show/hide toggle button is malfunctioning and not functioning properly

I'm still learning jQuery and I attempted to create a show/hide toggle button without relying on jQuery's toggle function. However, I can't seem to identify the issue in the code below. Although the Hide button successfully hides the paragr ...

Introducing a new left overlay panel popup feature using jQuery Mobile

I'm currently developing a mobile app and I'm having trouble getting a popup to launch on the left overlay panel when clicked on "Sign out". I can't figure out where I'm going wrong. Can someone please provide some suggestions? Thank yo ...

Utilizing HTML5 Canvas for Shadow Effects with Gradients

Surprisingly, it seems that the canvas API does not support applying gradients to shadows in the way we expect: var grad = ctx.createLinearGradient(fromX, fromY, toX, toY); grad.addColorStop(0, "red"); grad.addColorStop(1, "blue"); ctx.strokeStyle = gra ...

The word-breaking function is not functioning as anticipated

I am facing an issue with a container that holds multiple divs. I am attempting to prevent the contents of these divs from overflowing their parent element and breaking the text if it exceeds the parent's boundaries. However, my efforts are unsuccessf ...

Steps for Converting Unicode Characters to HTML Encoding in C++

Can you assist me with converting unicode characters like the ones below in C++? Thére Àre sôme spëcial charâcters ïn thìs têxt عربى I need to convert them to HTML encoding as shown below: Th&eacute;re &Agrave;re s&ocirc;me sp&am ...

Exploring the world of Json and html rendering

My service is designed to generate news with close to 30 different types, each requiring specific HTML code for display. When making an AJAX call, I extract the variable parts from the JSON response and use JavaScript to dynamically create and append the n ...

Firefox does not display the line headings on the sides

Hey everyone, I'm facing a compatibility issue with CSS and Firefox today. When I go to my website www.fashoop.com, you'll notice some header lines on the sides. Here's an example in Google Chrome: (GOOGLE CHROME EXAMPLE) COLOR BLUE AN ...

"Clicking on the dropdown menu will consistently result in it collapsing

When it comes to a DropDown menu, the typical expectation is that when an option is selected, the menu will collapse. However, in my situation, I do not want the dropdown menu to collapse if the user is attempting to log in and clicks on the Username and P ...

"Hey, do you need a see-through background for your

Currently, I am implementing the JS library found at . Unfortunately, I am struggling to make the background transparent or any other color. It appears that the issue lies in the fact that the tab styles are being overridden by the JS library whenever the ...

Using jQuery, extract the input value and verify its accuracy. If correct, display the number of accurately predicted results

I am attempting to extract the value from an input field and validate if the answer is accurate. Rather than simply indicating correctness, I aim to analyze and display the number of correct responses alongside incorrect ones. Encountering difficulties wit ...

What is the best way to integrate an admin template into a website without relying on popular CMS platforms like WordPress?

Do I need to use a WordPress system in the backend in order to utilize an admin template? I've noticed that there are several sleek web admin templates available in Bootstrap. I'm interested in using one of them but unsure how to do so without re ...

What is causing the navbar to malfunction on mobile devices?

I am facing an issue with my bootstrap navbar. It seems to be getting stuck when the screen resizes or when viewed on a mobile device. I have tried several solutions from various sources, but none seem to work. Here are some of the answers that I have look ...

Is there a CSS Blend Mode alternative for Internet Explorer?

I've implemented the background-blend-mode on this element: <a href="#" class="blend"> <h3>Title</h3> <p>Content goes here</p> </a> It's all set up with a background-image url. When the element with c ...

Designing a dynamic triangle with transparent features inside a container

Looking for a creative way to design a translucent responsive triangle with just one side of its border colored within a div. I came across a method online that involves using two triangles stacked on top of each other, but my preference is to have the tr ...

Tips for choosing the ancestor's ancestor in CSS

<div id="maincontent"> <div id="content"> <div id="admin"></div> </div> </div> Looking for a CSS rule that will target #maincontent only when #admin is present? I have a background color set in the admi ...

Background image specifically for the Fullcalendar sun component

When setting a background image for Sunday in the month view, I noticed that the day "Sunday" in the header is also getting the same background. The CSS for the table thread has classes like .fc-sun and .fc-mon set as well, but I'm not sure how to rem ...

How to make Vuetify grid columns wrap and fill the full height

I am facing an issue where the component created using v-card in a grid system does not fill the full height. I tried using d-flex but it did not work as expected. The middle column with a white v-card should occupy the entire column height but it is gett ...