小编Roh*_*ali的帖子

当角度2分量占据页面的整个宽度时如何修复?

我的角度2组件占据了页面的整个宽度.当我限制组件宽度时,其边距会拉伸到全宽.所以我不能带来其他组件.如何限制组件的宽度?我试过显示:内联,但没有用.尽管组件占用全宽,不允许任何东西来到这旁边.

import { Component } from '@angular/core';
import { Item }    from './../item';
import { ItemComponent }    from './ItemComponent';

@Component({
  selector: 'Item-Set',
  directives: [ItemComponent],
  template: '<div class="singleItem" *ngFor="let eachItem of itemList"><Item></Item></div>'
})

export class ItemSet{
  itemList: Item[];
  constructor(){
    this.itemList=ItemList;
  }
}
Run Code Online (Sandbox Code Playgroud)

在样式表中

.singleItem{
  width:300px;
}
Run Code Online (Sandbox Code Playgroud)

css angular

3
推荐指数
1
解决办法
4253
查看次数

标签 统计

angular ×1

css ×1