响应式,打字稿
Responsive, TypeScript
我想要 return 屏幕响应,只有显示加载图像的部分。
我该如何更改它,因为在我的代码中我输入了 [height] 和 [width] 来给它们一个尺寸,但我希望它们能够自动调整,如果在 CSS 中完成的话?
您可以使用 bootstrap col 或使用媒体查询进行响应
如果可以重写您的 html 代码并添加 col 就好了
<div class="row">
<div *ngIf="" class="col-sm-12>
/* .... */
</div>
</div>
或者使用媒体查询
@media only screen and (min-width: 1024px),
only screen and (min-device-width: 1024px) and (orientation:portrait),
only screen and (min-device-width: 1024px) and (orientation:landscape) {
#gallery {
width: 50% !important;
min-height: 300px;
}
}
@media only screen and (min-width: 450px) and (max-width: 1023px) and (orientation: landscape) {
#gallery {
min-height: 400px;
// max-height: 50% !important;
}
}
@media (max-width: 450px) {
#gallery {
// max-height: 50% !important;
// width
}
}
您可以使用 bootstrap col 或使用媒体查询进行响应 如果可以重写您的 html 代码并添加 col 就好了
<div class="row">
<div *ngIf="" class="col-sm-12>
/* .... */
</div>
</div>
或者使用媒体查询
@media only screen and (min-width: 1024px),
only screen and (min-device-width: 1024px) and (orientation:portrait),
only screen and (min-device-width: 1024px) and (orientation:landscape) {
#gallery {
width: 50% !important;
min-height: 300px;
}
}
@media only screen and (min-width: 450px) and (max-width: 1023px) and (orientation: landscape) {
#gallery {
min-height: 400px;
// max-height: 50% !important;
}
}
@media (max-width: 450px) {
#gallery {
// max-height: 50% !important;
// width
}
}