首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法使用顺风css进行图像响应

无法使用顺风css进行图像响应
EN

Stack Overflow用户
提问于 2021-06-03 15:08:17
回答 2查看 7.7K关注 0票数 3

这里是代码:)

代码语言:javascript
运行
复制
<div>
  <div class="w-full m-4 rounded-xl flex flex-wrap shadow-md border-2 place-self-center">
    <div class="flex flex-1">
      <img class="object-cover overflow-hidden rounded-tl-xl rounded-bl-xl" src="https://images.unsplash.com/photo-1522071820081-009f0129c71c?ixlib=rb-1.2.1&ixqx=4ciQ7zshM1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2850&q=80" alt="image">
    </div>
    <div class="flex flex-1 flex-col justify-evenly p-6">
      <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
        <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" />
        </svg>
      </div>
      <h2 class="object-cover text-gray-800 font-extrabold text-4xl">Deliver what your customers <br> want every time</h2>
      <p class="text-gray-600">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries.</p>
      <div class="w-96 flex justify-between">
        <div>
          <p class="text-purple-800 font-bold text-3xl">24/7</p>
          <p class="text-gray-600">Delivery</p>
        </div>
        <div>
          <p class="text-purple-800 font-bold text-3xl">99.9%</p>
          <p class="text-gray-600">Pepperoni</p>
        </div>
        <div>
          <p class="text-purple-800 font-bold text-3xl">100k+</p>
          <p class="text-gray-600">Calories</p>
        </div>
      </div>
    </div>
  </div>
</div>

我想让我的形象有反应。当我折叠屏幕大小时,图像也在折叠,而我想要使图像和整个容器相对于屏幕大小收缩。

有人能帮帮我吗。我是新的顺风css。

(谢谢:)

EN

回答 2

Stack Overflow用户

发布于 2021-06-03 15:17:53

删除flex-wrap并使用sm:flex-row flex-col在移动屏幕上使用flex-direction: column

您还可以将min-w-0添加到第二列,以便能够缩小它。

演示

票数 3
EN

Stack Overflow用户

发布于 2022-05-03 13:31:13

您可以使用aspect-ratio

代码语言:javascript
运行
复制
<div class="aspect-w-16 aspect-h-9">
    <img class="w-full" src='url' alt="" />
</div>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67824005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档