- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Angular Material 和弹性布局来处理 Angular 2。我已经实现了 mat-sidenav 并采用了一些 mat-form-field 并且还实现了 mat-table
我只为 mat-table 组件指定了最大高度,但是除了 mat-table< 的垂直滚动条之外,我还得到了页面的水平和垂直滚动条/strong>
谁能帮我解决如何避免这些滚动条......?
请访问我的示例代码here
<mat-sidenav-container>
<mat-sidenav #sidenav>
<div class="sidenav-header">
<mat-nav-list>
<h3 mat-subheader>Status At A Glance</h3>
<a mat-list-item routerLink='' routerLinkActive="active">Not Started</a>
<a mat-list-item routerLink='' routerLinkActive="active">Incomplete</a>
<a mat-list-item routerLink='' routerLinkActive="active">Complete</a>
<mat-divider></mat-divider>
<a mat-list-item routerLink='' routerLinkActive="active">Total</a>
<mat-divider></mat-divider>
<mat-form-field floatPlaceholder="never" style="width:150px; height:15px; margin-left:10px; font-size:12px; font-family: Verdana,Sans-Serif;">
<mat-select placeholder=" Select Department" [(value)]="selecteddept" style="width:150px;">
<input class="input1" matInput type="text">
<mat-option *ngFor="let Department of departments " [value]="Department.value" style="font-size:12px; font-family: Verdana,Sans-Serif; margin:-5px 0 -5px 0;">
{{Department.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-divider></mat-divider>
<h3 mat-subheader>Space Administration </h3>
<a mat-list-item routerLink='/Home/SurveyTools/RemoveRoomFromList' routerLinkActive="active">Remove Room From List</a>
<a mat-list-item routerLink='/Home/SurveyTools/RequestRoom' routerLinkActive="active">Request A Room </a>
<a mat-list-item routerLink='/Home/SurveyTools/SplitRoomMultiplePi' routerLinkActive="active">Split Room - Multiple PI's</a>
<a mat-list-item routerLink='/SpaceAdmin/BlockCode/BlockCode' routerLinkActive="active">Block Code</a>
<a mat-list-item>Lab Support Rooms</a>
<mat-divider></mat-divider>
<h3 mat-subheader>Survey Tools</h3>
<a mat-list-item>Create New Lab Cluster</a>
<a mat-list-item>Blank Survey Form </a>
<a mat-list-item>Common Task</a>
<a mat-list-item>Survey Instruction</a>
<a mat-list-item>User Guide</a>
<mat-divider></mat-divider>
</mat-nav-list>
</div>
</mat-sidenav>
<div [ngStyle]="{'display' : (screenWidth > 840) ? 'none' : 'block'}">
<div fxLayout="row" fxLayoutAlign=" start stretch">
<a (click)="sidenav.open()">
<mat-icon>menu</mat-icon>
</a> 
<h1> SPACE SURVEY </h1>
</div>
<p style="margin:-5px; text-align:center;">   If you need help, Please <strong><a href="#visit our detailed instruction">visit our detailed instruction </a></strong> on how to use this site.</p>
</div>
<div>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Department">
<input class="input1" matInput type="text">
<mat-option *ngFor="let Department of department " [value]="Department.value">
{{Department.viewValue }}
</mat-option>
</mat-select>
</mat-form-field><br/>
<mat-form-field floatPlaceholder="never">
<mat-select placeholder="Building ">
<input class="input1" matInput type="text">
<mat-option *ngFor="let Building of buildings " [value]="Building.value">
{{ Building.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div><br/>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Sub Department">
<input class="input1" matInput type="text">
<mat-option *ngFor="let subdepartment of subdepartments " [value]="subdepartment.value">
{{ subdepartment.viewValue }}
</mat-option>
</mat-select>
</mat-form-field><br/>
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Floor">
<input class="input1" matInput type="text">
<mat-option *ngFor="let floor of floors" [value]="floor.value">
{{ floor.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div><br/>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Status">
<input class="input1" matInput type="text">
<mat-option *ngFor="let status of statuses" [value]="status.value">
{{ status.viewValue }}
</mat-option>
</mat-select>
</mat-form-field> <br/>
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Room Type ">
<input class="input1" matInput type="text">
<mat-option *ngFor="let roomtype of roomtypes" [value]="roomtype.value">
{{ roomtype.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div><br/>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-input-container floatPlaceholder="never">
<input matInput placeholder=" Responsible Person ">
</mat-input-container> <br/>
<mat-input-container floatPlaceholder="never">
<input matInput placeholder=" Room Number ">
</mat-input-container>
</div>
</div>
<br/>
<div fxLayout="row" fxLayoutAlign="center center">
<button mat-raised-button color="primary">View All</button><br/>
</div> <br/>
<div class="material-table mat-elevation-z8">
<mat-table #table [dataSource]="dataSource">
<!-- Checkbox Column -->
<ng-container matColumnDef="select">
<mat-header-cell style="max-width:50px;" *matHeaderCellDef>
<mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()" [indeterminate]="selection.hasValue() && !isAllSelected()">
</mat-checkbox>
</mat-header-cell>
<mat-cell style="max-width:50px;" *matCellDef="let row">
<mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">
</mat-checkbox>
</mat-cell>
</ng-container>
<ng-container matColumnDef="num">
<mat-header-cell style="max-width:0px;" *matHeaderCellDef> </mat-header-cell>
<mat-cell style="max-width:0px;" *matCellDef="let element"></mat-cell>
</ng-container>
<ng-container matColumnDef="statuses">
<mat-header-cell *matHeaderCellDef> Completion Status </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.statuses}}</mat-cell>
</ng-container>
<ng-container matColumnDef="building">
<mat-header-cell style="text-align:left; padding-left:70px;" *matHeaderCellDef> Building </mat-header-cell>
<mat-cell style="text-align:left; padding-left:70px;" *matCellDef="let element"> {{element.building}} </mat-cell>
</ng-container>
<ng-container matColumnDef="floor">
<mat-header-cell *matHeaderCellDef> Floor </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.floor}} </mat-cell>
</ng-container>
<ng-container matColumnDef="roomtype">
<mat-header-cell *matHeaderCellDef> Room No. </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.roomtype}} </mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selection.toggle(row)">
</mat-row>
</mat-table>
<div style=height:30px;>
<mat-paginator #paginator [pageSize]="9" [pageSizeOptions]="[5, 10, 25, 100]">
</mat-paginator>
</div>
</div>
</mat-sidenav-container>
h1,h2 {
font-family: Verdana, sans-serif;
color:#1a084c;
font-weight:bold;
font-size:14px;
}
.mat-raised-button{
border-radius: 15px;
font-size:12px;
font-family: Verdana,Sans-Serif;
text-align:center;
font-weight:bold;
height:30px;
}
mat-form-field, mat-input-container{
font-family: Verdana, sans-serif;
color:#1a084c;
font-size:11px;
height:10px;
width:300px;
}
mat-select{
font-family: Verdana, sans-serif;
color:#1a084c;
font-size:11px;
width:300px;
}
//styles for material -table
mat-header-cell, mat-header-row, .mat-header-cell-def{
background:#f2f4f7;
min-height:15px;
font-family:Verdana,sans-serif;
font-weight:bold;
font-size:13px;
color: #1a084c;
margin-bottom:5px;
top: 0;
position: sticky;
z-index: 1;
}
mat-row{
min-height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
mat-cell{
height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
.example-container {
display: flex;
flex-direction: column;
max-height: 180px;
margin:auto;
}
.mat-table {
font-size:11px;
font-family: Verdana,Sans-Serif;
color: #1a084c;
overflow: auto;
max-height: 180px;
}
mat-header-cell, mat-header-row, .mat-header-cell-def{
background:#f2f4f7;
min-height:15px;
font-family:Verdana,sans-serif;
font-weight:bold;
font-size:13px;
color: #1a084c;
margin-bottom:5px;
top: 0;
position: sticky;
z-index: 1;
}
mat-row{
min-height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
mat-cell{
height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
@media only screen and (max-width: 736px) and (orientation:portrait) {
mat-header-row, mat-row {
width: 200%;
}
}
//style for the paginator
mat-paginator{
}
.mat-paginator-container{
float:right;
}
.mat-subheader{
font-family: Verdana, sans-serif;
font-size: 13px;
font-weight:bold;
background-color: #f2f4f7;
height:8px;
margin-top:5px;
}
.mat-list-item{
font-family: Verdana, sans-serif;
font-size: 12px;
height: 20px;
}
.mat-list-item:visited {
color: #0c0c28;
background-color: transparent;
text-decoration: none;
}
.mat-list-item:hover {
color: #0c0c28;
background-color: transparent;
text-decoration: underline;
font-weight: bold;
}
.mat-list-item:active {
color: #0c0c28;
background-color: transparent;
text-decoration: underline;
}
import { SelectionModel } from '@angular/cdk/collections';
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
/**
* @title Table with selection
*/
@Component({
selector: 'table-selection-example',
styleUrls: ['table-selection-example.css'],
templateUrl: 'table-selection-example.html',
encapsulation: ViewEncapsulation.None
})
export class TableSelectionExample {
selecteddept: string;
departments = [
{value: 'Department 1', viewValue: 'Department 1'},
{value: 'Department 2', viewValue: 'Department 2'},
{value: 'Department 3', viewValue: 'Department 3'}
];
department = [
{value: ' ASB ', viewValue: ' ASB '},
{value: 'BIOCHEMISTRY 2', viewValue: 'BIOCHEMISTRY 2'},
{value: 'BUDGET AND COST 3', viewValue: 'BUDGET AND COST 3'},
{value: ' CANCER CTR ', viewValue: ' CANCER CTR '},
{value: 'CARDIOTHOR SURG 2', viewValue: 'CARDIOTHOR SURG 2'},
{value: 'CELL BIOLOGY', viewValue: 'CELL BIOLOGY'},
{value: ' DMB ', viewValue: ' DMB '},
{value: 'DUPLICATING SVCS', viewValue: 'DUPLICATING SVCS'},
{value: 'EMERGENCY MEDICINE', viewValue: 'EMERGENCY MEDICINE'}
];
buildings = [
{value: 'Alpha', viewValue: 'Alpha '},
{value: 'Beta ', viewValue: 'Beta '},
{value: 'Gamma ', viewValue: 'Gamma '},
{value: 'delta ', viewValue: 'delta '},
{value: 'ribon ', viewValue: 'ribon '}
];
subdepartments = [
{value: 'Sdept', viewValue: 'Sdept'},
{value: 'bdept', viewValue: 'bdept'},
{value: 'cdept', viewValue: 'cdept'},
{value: 'zdept', viewValue: 'zdept'},
{value: 'ldept', viewValue: 'ldept'},
{value: 'mdept', viewValue: 'mdept'}
];
floors = [
{value: 'first', viewValue: 'first'},
{value: 'second', viewValue: 'second'},
{value: 'third', viewValue: 'third'}
];
statuses = [
{value: 'Status 1', viewValue: 'Status 1'},
{value: 'Status 2', viewValue: 'Status 2'},
{value: 'Status 3', viewValue: 'Status 3'}
];
roomtypes = [
{value: ' 1', viewValue: ' 1'},
{value: ' 2', viewValue: ' 2'},
{value: ' 3', viewValue: ' 3'}
];
constructor(public showmenu:ShowmenuService, private _activateroute: ActivatedRoute) { }
ngOnInit() {
this.showmenu.show();
this.showmenu.show1();
}
displayedColumns = ['num', 'select','statuses', 'building', 'floor', 'roomtype'];
dataSource = new MatTableDataSource<Element>(ELEMENT_DATA);
selection = new SelectionModel<Element>(true, []);
@ViewChild(MatPaginator) paginator: MatPaginator;
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
}
/** Whether the number of selected elements matches the total number of rows. */
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.dataSource.data.length;
return numSelected === numRows;
}
/** Selects all rows if they are not all selected; otherwise clear selection. */
masterToggle() {
this.isAllSelected() ?
this.selection.clear() :
this.dataSource.data.forEach(row => this.selection.select(row));
}
}
export interface Element {
statuses: string;
num: any;
building: string;
floor:string;
roomtype:string;
}
const ELEMENT_DATA: Element[] = [
{num:1,statuses: 'accepted', building: 'Abby', floor:'1',roomtype:'2'},
{num:1,statuses: 'accepted', building: 'Hospital ', floor:'2',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'3',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Flexner Hall', floor:'4',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Abby', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Hospital', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'6',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Abby', floor:'1',roomtype:'2'},
{num:1,statuses: 'accepted', building: 'Hospital ', floor:'2',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'3',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Flexner Hall', floor:'4',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Abby', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Hospital', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'6',roomtype:'1'}
];
最佳答案
你只需要调整mat-row,mat-header-row的字体和宽度,这样它们就可以适应小屏幕并且滚动条会消失:
@media only screen and (max-width: 736px) and (orientation:portrait) {
mat-header-row, mat-row {
width: 100%;
}
mat-row{
font-size:8px;
}
mat-cell{
font-size:8px;
}
关于angular - 如何使用 Angular Material 柔性布局避免 Angular 水平和垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49923712/
我目前正在研究一个项目欧拉问题(www.projecteuler.net),但遇到了一个绊脚石。其中一个问题提供了一个 20x20 的数字网格,并要求直线上 4 个数字的最大乘积。这条线可以是水平的、
我有两个表,我需要从每个表中选择一列。 这必须在单个查询中完成。 好消息是这两列以正确的方式排序,并且它们都包含相同数量的行。 现在,我知道我可以通过 rowid 加入两个表,但它很慢,因为它必须进行
我想在我的 iPad 应用程序中实现一个布局,该布局具有一个可左右滚动而不是上下滚动的合适 View : 所以而不是 第 1 行第 2 行第 3 行(垂直滚动)这将是 :第 1 行、第 2 行、第 3
我有五个尺寸的图像:600x30、600x30、600x30、600x30、810x30。它们的名称分别是:0.png、1.png、2.png、3.png、4.png。 如何使用 ImageMagic
我正在寻找一个选项来滚动多个列表(水平),如附件中的图片所示。您可以向左或向右滑动以进入下一个 ListView 。顶部应该有一些按钮可以单击或滚动 我尝试将 ListViews 放入类似此代码的内容
这些值之间是否存在数学关系?如果我知道 hFOV 和 vFOV,我可以计算对角 FOV 而不涉及焦距等其他值吗? 我的第一个想法是使用毕达哥拉斯定理,但也许这是错误的。 最佳答案 感兴趣的物理量是传感
我正在尝试在 game_width=640 和 game_height=480 的窗口内绘制网格。网格单元的数量是预定义的。我想在水平和垂直方向上均匀分布单元格。 void GamePaint(HDC
你好,我已经发布了我的 iphone 应用程序 Micro-Pitch,现在正在将它移植到 android 上。我不知道如何在 ScrollView 中画线,想知道我做错了什么。 这是我的 Scrol
如果您访问我的网站:www.ryancoughlin.com - 如果您在页面右侧看到 Google、Yahoo 等 RSS 按钮。我试图让它们均匀对齐,它们的图像高度都相同,我一直试图让它们均匀对齐
我想将此 Material 水平居中: 最佳答案 将 text-align:center 添加到您的 anchor 。我假设您的 zoom1 具有 display
我正在努力做到这一点,以便我的旋转木马可以与其他文本共享一个水平行,但由于某种原因它无法正常工作,当它设置为 40% 时它占据了 100% 的宽度。 我将在下面发布代码和屏幕截图。 在上图中,它显示了
问题来了。我正在尝试放置一些 彼此相邻的元素。 div 的宽度s 未指定,取决于它们的内容。我正在使用下面的 CSS 代码来定位 彼此相邻: #div{ height: 50px; f
我正在尝试使用这样的 Bootstrap 并排打印表格 但是当我尝试打印预览时,我得到了这个 我的代码如下。我尝试了所有可能的解决方案,但我不知道为什么我无法打印我看到的页面。请指导我解决这个问题。
我想知道是否可以在背景中使用两种不同的颜色,并通过 Bootstrap 在每一侧扩展 100%。 这是我的意思的截图, 左侧为红色,右侧为深色,为更大的屏幕放大 100%。有什么简单的解决方案吗? 最
我正在尝试制作一个包含所有事件的滚动触发的整个网站。我只需要帮助来实现这种效果: 我有一个网站,其中包含一些填满所有视口(viewport)的 div,我希望用户能够向下滚动到一个命名的 div,然后
我的代码是 Show All Show Valid Show Pending Save Clear Download As CSV 我希望那些输入日期和按钮在 class="buttons" di
我在玩这个想法: 在这个 block 中我有 2 作为按钮和 并尝试了 float荷兰国际集团他们让他们粘在一起。实现这种效果的主要思想是操纵 ul 的宽度/显示状态。或者只是菜单部分。 Log
这个问题在这里已经有了答案: How can I horizontally center an element? (134 个回答) 关闭 4 年前。
我遇到了一个 CSS 问题,需要帮助。我在目录中有许多不同大小的图像,我正在动态列出它们以显示以下 View :(我仅显示两个图像作为示例) 这是我的 HTML:
这个问题在这里已经有了答案: 关闭 9 年前。 Possible Duplicate: How can I make a horizontal ListView in Android? 我已经多次使
我是一名优秀的程序员,十分优秀!