Grid, dynamic sidebar/navbar width with main 100% width #1774
Answered
by
robbyrice
frederikhors
asked this question in
Help
-
I need a simple main div column 100% full. Sometimes a sidebar can appear, with dynamic width. REPL: https://codesandbox.io/s/tailwind-dynamic-sidebar-kw1kuIn this example you can see I'm not able to change sidebar width (which has every time a new width value) and I'm not able to "stretch" main div to 100% width. How to do? <div class="min-h-screen grid grid-cols-12">
<div class="bg-green-500">
<div style={`width: ${randomWidth}px !important;`}>
Sidebar. This has dynamic width.
</div>
</div>
<div class="bg-red-500">
Main. This has full width.
</div>
</div> |
Beta Was this translation helpful? Give feedback.
Answered by
robbyrice
May 15, 2020
Replies: 2 comments 1 reply
-
Instead of using the grid utilities you might want to look into using the flexbox utilities for this layout. It might look something like this.
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
frederikhors
-
I fixed it with flexbox. Thanks. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of using the grid utilities you might want to look into using the flexbox utilities for this layout. It might look something like this.