Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Using CSS Grid, I want to be able to have two divs next to each other, where the first has its width perfectly fitted, as seen with justify-self: start, and the one to the right should have its width filling the remaining space of the parent div.

The parent div has
grid-template-areas: 'content remainder'

|content|----- remainder -----|

How can I achieve this without explicitly specifying widths? The problem I'm seeing is that the parent div, by default assigns 50% of its width to content and remainder, so when content is justified to the start, the remainder doesn't stretch left to fill the remaining gap. If I set the parent div to justify-content: start, the remainder moves left, but doesn't stretch right to fill that gap either.

What I have tried:

--------------------------------------------------------------------------------
Posted
Updated 15-Mar-18 7:34am
v2

1 solution

 
Share this answer
 
v2
Comments
[no name] 16-Mar-18 6:00am    
Perfect, I've been needing to do this for ages. Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900