css - 验证 : fit v-image within the screen size

标签 css vue.js

My vue page have a photo gallery, and when a photo is selected, the dialog will jump out by setting the selectedCard.
虽然图像不适合屏幕大小。
我尝试在任何可能的地方将 css 的最大高度或宽度设置为 100%,但它们都不起作用。
如何修复我的 css,以便无需滚动即可在屏幕上查看整个图像?
屏幕截图:只能显示一半图像 only half of the image can be shown

//Dialog component    
<template>
  <v-dialog :value="selectedCard" scrollable fullscreen hide-overlay>
    <v-card v-if="selectedCard">
      <v-container grid-list-sm fluid>
        <v-layout align-space-around row fill-height>
          <v-flex id="mainCardPanel">
            <v-layout align-space-around column fill-height>
              <v-flex xs12>
                <MyCard class="mainCard" :card="selectedCard"></MyCard>
              </v-flex>
              <v-flex xs12>
                <v-btn> SomeButton </v-btn>
              </v-flex>
            </v-layout>
          </v-flex>
        </v-layout>
      </v-container>
    </v-card>
  </v-dialog>
</template>
// MyCard component
<template>
  <v-card flat tile class="d-flex justify-center" >
    <v-img :contain="true" :src=card.imageUrlHiRes
        :lazy-src=card.imageUrl class="grey lighten-2 Card">
      <template v-slot:placeholder>
        <v-layout fill-height align-center justify-center ma-0>
          <v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
        </v-layout>
      </template>
    </v-img>
  </v-card>
</template>

最佳答案

尝试使用 vh 作为图像高度。 也许这可能有效:

img {
  height:100vh;
}

关于css - 验证 : fit v-image within the screen size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58212632/

相关文章:

html - 将 CSS 类分配给完整的 <tr> 但不是 <td> 标签之一

javascript - Vue 组件版本控制,这样的事情可能吗?

javascript - Vue.js - "Bind" Bootstrap 模态到 Vue 模型

javascript - TypeError : Object(. ..) 不是 Vue 中的函数

javascript - 将多个属性绑定(bind)到 Vuetify 中的文本字段标签

javascript - 去除 active LI 下的 UL 背景

css - 背景图像 Bootstrap 无全屏

css - 小数和百分比行高有什么区别

css - 为什么我的 stylesheet_link_tag 在 Rails 4 中返回语法错误?

css - 将 Assets 图像路径作为动态内联样式背景图像 url (Nuxt.js)