我的 md-card 组件有问题
<md-card>
<img height="200" width="200" md-card-image src="/resources/{{odd?.image?.path}}" />
<md-card-content>
<button md-button>{{odd?.object?.name}}</button>
</md-card-content>
</md-card>
我有这段代码,它创建了一张卡片,里面有一张图片,图片下面有一些文字。 我希望图像的大小为 200x200,并且我希望卡片将图像完全包裹起来,但恰恰相反,卡片填满了页面的整个宽度,因此图像会拉伸(stretch)到卡片的大小
如果我从 img 标签中删除 md-card-image 属性,它会以 200x200 显示图像,但 md-card 仍然被拉伸(stretch)。
我怎样才能保持我想要的图像大小并使 md-card 环绕它?
最佳答案
您需要使用 css
来调整您的 md-card
来源:Here
PS: its better to use
box-sizing: border-box;
so you can get the exact width...
关于html - Angular Material 2 md-卡宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45276757/