category: CSS

tag: CSS, Tailwind, customization

Posted on: May 6th 2021, 11:26pm

Last modified: May 6th 2021, 11:26pm

First at index.html,
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet"
        href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap">
    <link href="/css/tailwind.css" rel="stylesheet">
</head>

<body class="bg-gray-300 font-headline m-0 tracking-tight">
    <div class="bg-gray-100 lg:grid lg:grid-cols-2 2xl:grid-cols-5">
        <div class="px-8 py-12 max-w-md mx-auto sm:max-w-xl lg:px-12 lg:py-24 lg:max-w-full xl:mr-0 2xl:col-span-2">
            <div class="xl:max-w-xl">
                <img class="h-10" src="/image/logo.svg" alt="workcation">
                <img class="w-full mt-6 rounded-lg shadow-xl sm:mt-8 sm:h-64 sm:w-full sm:object-cover object-center lg:hidden"
                    src="/image/beach-work.jpg" alt="Woman workcationing on the beach">
                <h1 class="mt-6 text-2xl font-bold text-gray-900 sm:mt-8 sm:text-4xl lg:text-3xl xl:text-4xl">You can
                    work
                    from
                    anywhere.
                    <span class="text-indigo-500 block">Take advantage of it.</span>
                </h1>
                <p class="mt-2 text-gray-600 sm:mt-4 sm:text-xl">
                    Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae ipsum asperiores veniam at
                    cumque
                    numquam maxime obcaecati reprehenderit vitae commodi.
                </p>

                <div class="mt-4 sm:mt-6 sm:text-base">
                    <a href="#" class="btn px-10 ">Book
                        your escape
                    </a>
                </div>
            </div>

        </div>

        <div class="hidden lg:block relative 2xl:col-span-3">
            <img class="absolute inset-0 w-full h-full object-cover object-center" src="/image/beach-work.jpg"
                alt="Woman workcationing on the beach">
        </div>
    </div>

</body>

</html>

Then at tailwind.config.js file,
module.exports = {
  purge: [],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {
      colors: {
        brand: {
          DEFAULT: "#0fa9e6",
          light: "#3fbaeb",
          dark: "#0c87b8",
        },
      },
      fontFamily: {
        headline: "Poppins, sans-serif",
      },
    },
  },
  variants: {
    extend: {
      backgroundColor: ["active"],
      fontSize: ["hover"],
    },
  },
  plugins: [],
};

Recommended

HTML markdown cheatsheetInstall netlify cli globallyCustomizing font family and color in Tailwind.cssGenerate full version of tailwind.config.js fileEnable variant in the config file for Tailwind.cssSetup Tailwind workflowUsing @apply with Complex ClassesCustom animation in Tailwind.cssGradient in TailwindLoop through JSON object