Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Flexbox: how to set max width to a div

I'm using Angular Flexlayout (based on FlexBox) to add responsiveness to my application.

Is it possible to set a max-width to a HTML element?

Example:

<div fxFlex.gt-md="70" fxLayout.lt-lg="100"> 
<!-- I want this div to have a maximum width of 1750px. 
Setting max-width has no effect. How can I achieve this? -->
</div>
like image 886
Vingtoft Avatar asked Feb 03 '23 20:02

Vingtoft


1 Answers

The solution is to use the "shrink" and "grow" value of the FxFlex tag. Grow: How to grow the element Shrink: How to shrink the element Initial: Initial value

Examples:

fxFlex="grow shrink initial"
fxFlex="0 1 70" <- Will not grow, will shrink 1:1, initial value of 70%
fxFlex="0 1 1750px" <- Will not grow, will shrink 1:1, initial value of 1750px

Documentation here

like image 181
Vingtoft Avatar answered Feb 06 '23 14:02

Vingtoft