首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >元素不等于使用Flex Box尾风CSS

元素不等于使用Flex Box尾风CSS
EN

Stack Overflow用户
提问于 2022-04-09 05:59:09
回答 2查看 414关注 0票数 2

我有一些区域,我想要有相同的元素。一边只是一个图像,而另一边有内容。我正在使用尾风CSS,并感到肯定,我有正确的类。div部分声明为Flex,而子元素的Flex基值为0,Flex增长为1,内容div仍然比我的图像div稍大一些。

代码语言:javascript
复制
 <section class="section-one flex flex-col-reverse md:flex-row-reverse">
  <div class="basis-0 grow p-6 text-center md:text-left md:flex md:flex-col md:justify-center md:items-center">
    <div>
      <h2 class="font-fraunces text-4xl mb-4 md:text-left md:max-w-md">Stand our to the right audience</h2>
      <p class="font-barlow text-gray-500 text-lg p-4 mb-6 md:max-w-md md:p-0">Using a collaborative formula of designers, researchers, photographers, videographers and copywriters, we'll build and extend your brand in digital places.</p>
      <div class="flex flex-col">
        <a href="#" class="font-fraunces uppercase z-1">Learn More</a>
        <span class="bg-rose-300/75 w-32 mx-auto h-4 rounded-full md:m-0"></span>
      </div>
    </div>
  </div>
  <div class="basis-0 grow">
    <img src="images/desktop/image-stand-out.jpg" alt="" class="w-full" />
  </div>
</section>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-04-09 14:04:04

如果您删除您的p-6类,并添加以下的div,它将工作。

代码语言:javascript
复制
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" integrity="sha512-wnea99uKIC3TJF7v4eKk4Y+lMz2Mklv18+r4na2Gn1abDRPPOeef95xTzdwGD9e6zXJBteMIhZ1+68QC5byJZw==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<section class="section-one flex flex-col-reverse md:flex-row-reverse">
  <div class="basis-0 grow remove-this-p-6 text-center md:text-left md:flex md:flex-col md:justify-center md:items-center">
    <div class="p-6"> <!-- add here your padding -->
      <h2 class="font-fraunces text-4xl mb-4 md:text-left md:max-w-md">Stand our to the right audience</h2>
      <p class="font-barlow text-gray-500 text-lg p-4 mb-6 md:max-w-md md:p-0">Using a collaborative formula of designers, researchers, photographers, videographers and copywriters, we'll build and extend your brand in digital places.</p>
      <div class="flex flex-col">
        <a href="#" class="font-fraunces uppercase z-1">Learn More</a>
        <span class="bg-rose-300/75 w-32 mx-auto h-4 rounded-full md:m-0"></span>
      </div>
    </div>
  </div>
  <div class="basis-0 grow">
    <img src="https://via.placeholder.com/500" alt="" class="w-full" />
  </div>
</section>

 <section class="section-one flex flex-col-reverse md:flex-row-reverse ">
  <div class="basis-0 grow">
    <img src="https://via.placeholder.com/500" alt="" class="w-full" />
  </div>
  <div class="basis-0 grow remove-this-p-6 text-center md:text-left md:flex md:flex-col md:justify-center md:items-center">
    <div class="p-6"><!-- add here your pading -->
      <h2 class="font-fraunces text-4xl mb-4 md:text-left md:max-w-md">Stand our to the right audience</h2>
      <p class="font-barlow text-gray-500 text-lg p-4 mb-6 md:max-w-md md:p-0">Using a collaborative formula of designers, researchers, photographers, videographers and copywriters, we'll build and extend your brand in digital places.</p>
      <div class="flex flex-col">
        <a href="#" class="font-fraunces uppercase z-1">Learn More</a>
        <span class="bg-rose-300/75 w-32 mx-auto h-4 rounded-full md:m-0"></span>
      </div>
    </div>
  </div>
</section>

票数 1
EN

Stack Overflow用户

发布于 2022-04-09 13:18:09

通过使用网格,您可以实现这一点。

我已经为您做了代码,请检查这里:https://play.tailwindcss.com/wldkQ1txrU

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71805620

复制
相关文章

相似问题

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