The title is rewritten as: Vuetify's v-img automatically adjusts according to the container size, not according to the src size
P粉511896716
P粉511896716 2023-08-25 11:52:29
0
1
507
<p>Vuetify’s documentation about <code>v-img</code> is as follows: </p> <blockquote> <p>v-img will automatically resize itself based on the size of its src, maintaining the correct aspect ratio. You can limit the size using the height and max-height properties. </p> </blockquote> <p>However, it will automatically resize itself based on the size of the container or the size of <code>max-height</code>, whichever is smaller. It does not resize itself based on the size of the source file - in the example below, the image's src size is 256x256. </p> <p>Example: https://codepen.io/nullism/pen/bGWVreK</p> <p>Is this a bug in Veutify, or is there a problem with the documentation, or am I missing a property? </p> <p>Thank you very much for your help! </p> <p><strong>Update</strong>: It looks like the normal <code><img/></code> tag works as expected: https://codepen.io/nullism/pen /OJmyjvw</p>
P粉511896716
P粉511896716

reply all(1)
P粉790819727

As far as I understand, you want the size of the image to be less than 256 x 256, then you can add the attribute max-width="256" max-heigth="256"

<d id="app">
  <v-app id="inspire">
    <v-main>
      <v-container>
        <v-card>
          <v-card-text>
            <v-img max-width="256" max-heigth="256"
              src="https://www.redditstatic.com/icon.png"
            ></v-img>
          </v-card-text>
        </v-card>
      </v-container>
    </v-main>
  </v-app>
</div>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!