Back to Freecodecamp

Step 10

curriculum/challenges/english/blocks/workshop-tailwind-cta-component/6858f3a67aa8580ff37016c7.md

latest1.4 KB
Original Source

--description--

If you adjust the width of the preview tab to the width identical to a mobile device again, you will notice the content is always sitting side-by-side. This is not what you want on mobile devices.

To fix that, add the class flex-col to the div. This will change the flex direction to column, so things will stack on top of each other.

Here's how to use the flex-col utility class:

html
<div class="flex flex-col">
  <element></element>
  <element></element>
</div>

--hints--

Your opening div element should have the utility class flex-col.

js
const firstDiv = document.querySelectorAll("div")[0];
assert.isTrue(firstDiv.classList.contains("flex-col"));

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>CTA component</title>
    <script src="https://cdn.tailwindcss.com"></script>
  </head>
  <body>
--fcc-editable-region--
    <div class="bg-indigo-600 text-white mt-8 p-4 md:w-1/2 mx-auto flex justify-around items-center">
      <div>
        <span>Soundflow</span>
        <h1>Discover New Music</h1>
        <p>Stream your favorite tracks and discover new artists.</p>
      </div>
       <div>
         <a href="#">Learn more</a>
        <a href="#">Start listening</a>
      </div>
    </div>
--fcc-editable-region--
  </body>
</html>