I am busy with a project where I am using angular-flex-layout. As far as I understood a flex container should wrap to the next line if the fxLayoutWrap property is applied to a container. For some reason I have a very small x-overflow. it used to be bigger and then I removed some fxLayoutGaps I had on two fxLayout row containers which made it much better. I have no idea what the cause of this could be as I applied the fxLayoutWrap property to the parent (first row of dashboard component) row container. Any idea what i'm doing wrong?
Picture of the pageafter scrolling to the right
https://imgur.com/a/Ga4UR
And a picture before scrolling to the right:
https://imgur.com/CWyWO4T
my code:
my home component's html:
<mat-sidenav-container position="start" class="custom-sidenav-container">
<mat-sidenav #sidenav mode="side" opened="true">
Navigation
<ul class="sn-list">
<li>
<mat-icon class="sn-item">
<i class="material-icons">dashboard</i>
</mat-icon>
<a class="sn-item" href="#">Dashboard</a>
</li>
<li>
<mat-icon class="sn-item">
<i class="material-icons">archive</i>
</mat-icon>
<span class="sn-item" [matMenuTriggerFor]="stockSystemMenu">Stok System</span>
<mat-menu [overlapTrigger]="false" #stockSystemMenu="matMenu">
<button mat-menu-item>
<mat-icon class="sn-item">
<i class="material-icons">chevron_right</i>
</mat-icon>
<span class="sn-item">Service 1</span>
</button>
<button mat-menu-item>
<mat-icon class="sn-item">
<i class="material-icons">chevron_right</i>
</mat-icon>
<span class="sn-item">Service 2</span>
</button>
<button mat-menu-item>
<mat-icon class="sn-item">
<i class="material-icons">chevron_right</i>
</mat-icon>
<span class="sn-item">Service 3</span>
</button>
</mat-menu>
</li>
<li>
<mat-icon class="sn-item">
<i class="material-icons">shopping_cart</i>
</mat-icon>
<span class="sn-item" [matMenuTriggerFor]="salesMenu">Sales / Purchases</span>
<mat-menu [overlapTrigger]="false" #salesMenu="matMenu">
<button mat-menu-item>
<mat-icon class="sn-item">
<i class="material-icons">chevron_right</i>
</mat-icon>
<span class="sn-item">Service 1</span>
</button>
<button mat-menu-item>
<mat-icon class="sn-item">
<i class="material-icons">chevron_right</i>
</mat-icon>
<span class="sn-item">Service 2</span>
</button>
<button mat-menu-item>
<mat-icon class="sn-item">
<i class="material-icons">chevron_right</i>
</mat-icon>
<span class="sn-item">Service 3</span>
</button>
</mat-menu>
</li> </ul>
</mat-sidenav>
<div class="sn-content">
<!--<button mat-icon-button (click)="sidenav.toggle()">-->
<!--<mat-icon aria-label="menu">-->
<!--<i class="material-icons">restaurant_menu</i>-->
<!--</mat-icon>-->
<!--</button>-->
</div>
<mat-toolbar class="toolbar" color="primary">
<button mat-icon-button (click)="toggleSidenav()">
<mat-icon aria-label="menu">
<i class="material-icons">restaurant_menu</i>
</mat-icon>
</button>
<span>POC Toolbar</span>
<span class="fill-remaining-space"></span>
<div class="rhs">
<mat-icon class="rhs-icon fa fa-home fa-lg"></mat-icon>
<span class="rhs-item">Home</span>
<mat-icon class="rhs-icon fa fa-sign-out fa-lg" aria-hidden="true"></mat-icon>
<span class="rhs-item">Logout</span>
<mat-icon class="rhs-icon fa fa-key fa-lg"></mat-icon>
<span class="rhs-item">Password</span>
<mat-icon class="rhs-icon fa fa-sitemap fa-lg"></mat-icon>
<span class="rhs-item">Site map</span>
</div>
</mat-toolbar>
<router-outlet></router-outlet>
</mat-sidenav-container>
my dashboard component's html (This is the default route of the router-outlet in home component)
<div fxLayout="row" fxLayoutAlign="start start" fxLayoutWrap>
<br /><br />
<div fxFlex>
<div fxLayout="column" fxLayoutGap="20px">
<div fxFlex>
<h1>Dashboard</h1>
</div>
<div fxFlex>
<p>Lorem ipsum dolor sit amet, eum iuvaret delicata at. Eu postea commodo persius mei. Id est semper constituto, ignota aperiri adversarium ne vix. Id est impetus suscipit, nulla meliore epicuri id eos. <br /> Ad pro modo albucius atomorum. At mel ullum libris debitis, in vero apeirian mediocrem mei.</p>
</div>
<div fxFlex="80%">
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>
</div>
<div fxFlex="80%">
<h2>Sample Angular/Flex Column Layout</h2>
</div>
</div>
<div fxLayout fxLayoutGap="15px">
<div fxFlex="26%">
<h3>Notes</h3>
<ul>
<li>we're using responsive css & Angular(Angular-material & Angular/flex) This allows us to show (or hide) things like the left menu and the number of columns displayed by dataTables.</li>
<li>The amount of "Custom" css we've used is actually very little, prefering rather to make use of the framework's built in features.</li>
<li>Angular reactive forms and validators should probably replace the generic php form.</li>
<li>No server side php is used.</li>
</ul>
</div>
<div fxFlex="26%">
<h3>Example views</h3>
<ul>
<li><a href="#">Login Screen</a></li>
<li><a href="#">Home Page</a> » Ledger system » Sales ledger » Customer master files</li>
<li><a href="#">Customer Master Search</a></li>
<li><a href="#">Customer Master List</a></li>
<li><a href="#">detail Customer Master</a></li>
<li><a href="#">update Customer Master</a></li>
<li><a href="#">detail Account</a> - Click on suburb <i class="fa fa-info-circle"></i></li>
<li><a href="#">Lookup Screen(Generic)</a> - Click on suburb <i class="fa fa-search"></i></li>
</ul>
</div>
<div fxFlex="26%">
<h3>Keyboard Shortcuts</h3>
<ul>
<li><Ctrl + b: Go back/li>
<li>Ctrl + i: Launch info</li>
<li>Ctrl + h: Launch help</li>
<li>Ctrl + l: Show or hide menu</li>
<li>Ctrl + n: Add new item</li>
<li>Ctrl + p: Print</li>
<li>Ctrl + r: reload table data</li>
<li>Ctrl + <em>any other</em> page specific function you ned</li>
</ul>
</div>
</div>
<div fxLayout>
<h2>Quick Links & Favourites</h2>
</div>
<div fxLayout>
<div fxFlex="40%">
<mat-list>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-archive fa-2x"></mat-icon>
<a matLine href="#">Stock System</a>
<span matLine>Nam ultricies enim id sapien dignissim, in facilisis neque blandit, te corrumpit vituperata constituam pri.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-shopping-cart fa-2x"></mat-icon>
<a matLine href="#">Sales Purchases</a>
<span matLine>Donec cursus augue sit amet suscipit volutpat. Ne dignissim sadipscing pro. Munere scripta temporibus mel at.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-sticky-note fa-2x"></mat-icon>
<a matLine href="#">Stock Ordering</a>
<span matLine>Integer placerat libero ac dui hendrerit lacinia. Brian semper constituto, ignota aperiri adversarium ne vix.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-book fa-2x"></mat-icon>
<a matLine href="#">Ledger System</a>
<span matLine><a href="#">Ledger System</a> »
<a href="#">Sales Ledger</a>»
<a href="#">Customer Master Files</a>»
<a href="#">Customer Master</a></span>
<span matLine>Purus scelerisque, dapibus felis sit amet, accumsan est.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-money fa-2x"></mat-icon>
<a matLine href="#">POS Control</a>
<span matLine>Pellentesque id purus scelerisque, dapibus felis sit amet, accumsan est. Diceret dissentiunt ad sea, te corrumpit vituperata constituam pri.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-tablet fa-2x"></mat-icon>
<a matLine href="#">PDCU Control</a>
<span matLine>In vestibulum dui sed dapibus accumsan. Id est semper constituto, ignota aperiri adversarium ne vix.</span>
</mat-list-item>
</mat-list>
</div>
<div fxFlex="40%">
<mat-list>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-line-chart fa-2x"></mat-icon>
<a matLine href="#">Price Change System</a>
<span matLine>Integer placerat libero ac dui hendrerit lacinia. Brian semper constituto, ignota aperiri adversarium ne vix.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-building fa-2x"></mat-icon>
<a matLine href="#">HO Coms</a>
<span matLine>Donec cursus augue sit amet suscipit volutpat. Ne dignissim sadipscing pro. Munere scripta temporibus mel at.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-plane fa-2x"></mat-icon>
<a matLine href="#">Auto Pilots</a>
<span matLine>Fusce eget velit tincidunt erat sollicitudin eleifend in in odio. Integer placerat libero ac dui hendrerit lacinia.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-hashtag fa-2x"></mat-icon>
<a matLine href="#">Additional</a>
<span matLine>Fusce eget velit tincidunt erat sollicitudin eleifend in in odio. In vestibulum dui sed dapibus accumsan.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-desktop fa-2x"></mat-icon>
<a matLine href="#">Workspaces</a>
<span matLine>matLinePellentesque id <a href="#">Customer Master</a> purus scelerisque, dapibus felis sit amet, accumsan est.</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-icon class="fa fa-cogs fa-2x"></mat-icon>
<a matLine href="#">System Config</a>
<span matLine>Pellentesque id purus scelerisque, dapibus felis sit amet, accumsan est. Diceret dissentiunt ad sea, te corrumpit vituperata constituam pri.</span>
</mat-list-item>
</mat-list>
</div>
</div>
<div fxLayout>
<div fxFlex="80%">
<hr>
<p>Numquam honestatis neglegentur ex duo, ad vix movet tollit tantas. Cu quaeque labores debitis vis, dicta eruditi eligendi ex vim. Est mentitum
voluptaria te. Decore aperiri explicari cu usu, suas saepe accumsan ea usu. In vim modo accusata, ad audire delenit prodesset usu.</p>
<hr>
</div>
</div>
<div fxLayout fxLayoutGap="20px">
<div fxFlex="26%" class="centered">
<h2>Heading</h2>
<p>
Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus,
porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.
</p>
<p><button mat-raised-button><a href="#">View Details</a></button></p>
</div>
<div fxFlex="26%" class="centered">
<h2>Heading</h2>
<p>
Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.
</p>
<p><button mat-raised-button><a href="#">View Details</a></button></p>
</div>
<div fxFlex="26%" class="centered">
<h2>Heading</h2>
<p>
tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
</p>
<p><button mat-raised-button><a href="#">View Details</a></button></p>
</div>
</div>
<div fxLayout fxLayoutGap="20px">
<div fxFlex="26%" class="centered">
<h2>Heading</h2>
<p>
Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus,
porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.
</p>
<p><button mat-raised-button><a href="#">View Details</a></button></p>
</div>
<div fxFlex="26%" class="centered">
<h2>Heading</h2>
<p>
Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.
</p>
<p><button mat-raised-button><a href="#">View Details</a></button></p>
</div>
<div fxFlex="26%" class="centered">
<h2>Heading</h2>
<p>
tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
</p>
<p><button mat-raised-button><a href="#">View Details</a></button></p>
</div>
</div>
<div fxLayout>
<div fxFlex class="centered">
<p>Copyright Trade Link © 2017</p>
</div>
</div>
</div>
</div>
my styles.css:
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
body {
font-family: 'Roboto', sans-serif;
max-width: 100%;
x-overflow: hidden;
max-width: 90%;
}
my home component's css:
.fill-remaining-space {
flex: auto;
}
.rhs {
display: flex;
align-items: center;
justify-content: center;
}
.rhs-item {
margin-right: 20px;
}
.rhs-icon {
margin-right: 5px;
display: inline-flex;
vertical-align: middle;
}
/*.custom-sidenav-container {
position: inherit;
display: inherit;
transform: inherit;
}*/
mat-sidenav {
// width: 300px;
margin-top: 65px;
border: 1px solid rgba(0, 0, 0, 0.5);
position: fixed;
left: 0;
}
.sn-list {
list-style: none;
}
.sn-list li {
cursor: pointer;
margin-bottom: 10%;
}
.sn-item {
display: inline-flex;
vertical-align: middle;
}
.toolbar {
position: fixed;
left: 0;
top: 0;
right: 0;
}
my dashboard component's css:
.centered {
text-align: center;
}
We can fix the X axis overflow by adding 'overflow-x: hidden' but by doing so overflow-y becomes assumed as 'auto'.
There is no such CSS property as x-overflow
, you probably want overflow-x
instead.
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
You need to set that to 'hidden' to disable scrolling. You should look for the element that is wider than it should be (the element, that causes the scrolling). On its parent, you should have overflow-x: hidden, or you should prevent that element from being wider at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With