how do you make a flex item fill the remaining space? [duplicate] - html

This question already has answers here:
Fill the remaining height or width in a flex container
(2 answers)
Closed 4 years ago.
Hey Guys I'm making a job application form for a website. I'm using flexbox for the layout but on <div class="row row-9"> I have one label element that sits on the left side and one input element on the right side. I'm using justify-content: space-between; to separate them apart. However I want the input field to expand to fill all of that empty space. Would i do this with the width property? Also Am I even making this form right I have s many css rules with one property and the html doesn't look good either. I've only made one other form before. Thanks for your help:)
https://jsfiddle.net/wpm1crtz/1/

input{
flex:2
}
Or however width You want to make the the input.
for example if you put flex:2 , it will essentially take up 66% of the row,
flex:1 would take up 50% etc.

Related

Make span tag fill the remaining height of div [duplicate]

This question already has answers here:
How to make div occupy remaining height?
(11 answers)
Closed 5 years ago.
I have the following situation:
In a bootstrap row with 2 columns:
- first column with a table that has a button to add new rows
- second column with a label and a span (it does not have to be a span)
The two columns have the same height, but I want the label and the span to fill the column. The label has a fixed height and the span should have the remaining height.
I tried using height: 100%, add an intermediate div, but with no success
Can this be achieved?
Edit: Here is what I would like:
<div>
<label>Descriere</label>
<span class="editorWidth positionDescription">This text is variable
This control should expand as the div in left
Also it should support scrolling if the text is greater than the allocated space
Extra
Extra
Extra</span>
http://jsbin.com/niyenudufo/edit?html,css,output
The span.positionDescription should fill the rest of the div.
I tried to convert the span to div but the scroll of the div is created outside of the containing div
Seeing your actual HTML and CSS it would be alot easier to understand the question however i believe your problem could be resolved with the calc function in CSS:
element {height calc(100% - x);}
x being the height of the logo.
calc is pretty self explanatory and allows basic caluclation in CSS.
this should take up 100% but not overflow. also ensure you account for padding and margin on both elements.

Individual sizing of div while using flex [duplicate]

This question already has answers here:
How to disable equal height columns in Flexbox?
(4 answers)
Closed 5 years ago.
I am using display: flex to create a responsive card-based dashboard.
Fiddle here.
I noticed that the cards (each individual element div) all shrink or expand vertically to maintain the same size when in a row. So, the height of the biggest (or highest) card is inherited by the rest of the cards in the same row.
Note: When you resize the Fiddle window, you will notice this happens only when more than one card is present in a row. So, when the window is too small to allow only one card horizontally, the size is dependent on the content inside.
I can't seem to figure out which property is doing that so here's my question:
How to get the cards to NOT get resized?
OR
How to retain the responsiveness without using display: flex
If you don't want the cards to be resized, you should had align-items: flex-start on the flex container and remove the min-height: 250px on the cards. Maybe you can set height: auto on the cards

Flexbox margins in a grid [duplicate]

This question already has answers here:
flex-grow not sizing flex items as expected
(5 answers)
Closed 5 years ago.
I have a grid in flexbox, like so:
They're all positioned using flexbox, and then the panels themselves (the coloured bits) have margin: 5px.
codepen here: https://codepen.io/callumacrae/pen/bRoZdp
Because the top right section has two elements, there's more margin there, so it's pushing down slightly—I don't want this to happen!
I guess the two possible fixes are either to make the margins not do that, or make the components five pixels smaller instead of five pixels larger like they are right now - but I don't know how to do either of those things.
How can I make adding more elements not change the size of the parent?
The main problem is that you are sizing the elements using flex-grow. flex-grow is not the right property as it, together with flex-shrink is used to distribute the space left (or if to little).
You should use flex-basis, because as soon as you start fill these empty boxes with content, and their content will differ in size, they will misalign even more.
Here is an updated version of yours, where I changed to style="flex-basis: calc(50% - 10px);" (the 10px is to make up for your margins).
Codepen with flex-basis
And here is a version of yours, with the same text I used in mine
Codepen with flex-grow

Difficulty spanning a row to full height [duplicate]

This question already has answers here:
Make a div fill the height of the remaining screen space
(41 answers)
Closed 7 years ago.
I have made a columnar layout that works fairly well for my needs, but I am experiencing an issue with the height of one column. I have prepared a jsBin that demonstrates the problem;
http://jsbin.com/mawuliyulo/1/edit?html,output
Basically, when you scroll down - eventually you start seeing white on the left side. Is there any way to force this to stretch all the way down indefinitely?
This is not using a flex-box layout. It is simply achieved using :before, and :after pseudo-selectors.
Add position:relative to your main-container class

2 column, left one adapts to content, the right one takes all remaning space [duplicate]

This question already has answers here:
How to get this 2 columns layout (were one fits to content)
(3 answers)
Closed 4 months ago.
The columns should:
be full height
have vertical scrollbars if needed but no horizontal
This is what I got so far (along with a footer and a header)
http://jsfiddle.net/HZMCX/11/
The problem withmy code is that the right panel text starts at mid screen and not next to the left panel.
[Ignore this, this is so stackoverflow allows me to post the link to jsFiddle ]
Any ideas on how to fix this?
Thanks!
Your code can be applied much more simply than you currently have it:
Consider simply floating the side column and the primary content and setting fluid widths on both.
http://jsfiddle.net/MygUu/
Wrap the overall layout in a .container class, and set overflow to hidden.
.container {
overflow: hidden;
}
Additionally, it is best practice not to style using ID selectors. Hope that helps.