Published on

The 5 Really Obvious Ways To Create A Politico Clone Layout With Tailwind CSS Better That You Ever Did

Tags
Politico Clone Layout

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that allows developers to quickly and easily create custom user interfaces. It provides a set of pre-defined CSS classes that can be used to style HTML elements. By using Tailwind CSS, developers can save time and effort in writing CSS code from scratch.

The description of Politico Clone Layout ui component

Politico is a popular news website that covers politics, policy, and the government. The Politico Clone Layout ui component is a replica of the website's homepage layout. It includes a header with a navigation menu, a main content area with featured articles, and a sidebar with additional content.

Why use Tailwind CSS to create a Politico Clone Layout ui component?

Tailwind CSS provides a set of pre-defined CSS classes that can be used to create complex user interfaces quickly and easily. By using Tailwind CSS, developers can save time and effort in writing CSS code from scratch. Additionally, Tailwind CSS is highly customizable, which means that developers can easily modify the styles to match the design of their website.

The preview of Politico Clone Layout ui component.

To create a Politico Clone Layout with Tailwind CSS, we will use a combination of HTML and CSS code. The final result will look like the following:

Free download of the Politico Clone Layout's source code

The source code of Politico Clone Layout ui component.

To create the Politico Clone Layout ui component, we will use Tailwind CSS classes to style the HTML elements. The source code for the layout is as follows:

<html>
    <head>
        <title>Politico Clone</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=yes">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="css/core.min.css">
    </head>
    <body class="relative">
        
        <div class="w-full border-b flex flex-row flex-wrap items-center p-1">
            <div class="w-1/5 p-3">
                <button class="text-2xl font-thin text-gray-600"><i class="fa fa-bars"></i></button>
            </div>
            <div class="w-3/5 p-3">
                <center><img class="w-1/4" src="https://static.politico.com/11/3c/2571c0ab455e91bf81dc4bab93a6/politico-logo.png"></center>
            </div>
            <div class="w-1/5 flex flex-row flex-wrap">
                <ul class="w-3/4 flex flex-row flex-wrap text-xs font-semibold">
                    <li class="mx-3"><a href="">MAGAZINE</a></li>
                    <li class="mx-3"><a href="">THE AGENDA</a></li>
                    <li class="mx-3"><a href="">PRO</a></li>
                </ul>
                <div class="w-1/4 text-lg text-gray-600"><a href=""><i class="fa fa-search"></i></a></div>
            </div>
        </div>

        <div class="w-full md:w-2/5 mx-auto">
            <div class="mx-5 my-3 text-sm">
            <a href="" class=" text-red-600 font-bold tracking-widest">CORONAVIRUS</a>
            </div>
            <div class="w-full text-gray-800 text-4xl px-5 font-bold leading-none">
                Kemp and Bottoms hurl insults at each other in Georgia mask feud
            </div>
            
            <div class="w-full text-gray-500 px-5 pb-5 pt-2">
               The war of words comes after the governor sued the Atlanta mayor over her city’s mask mandate.
            </div>
            
            <div class="mx-5">
            <img src="https://static.politico.com/dims4/default/fcd6d6a/2147483647/resize/1920x/quality/90/?url=https%3A%2F%2Fstatic.politico.com%2F22%2F87%2F2259ffd444678054896b9fa32b4d%2Fgettyimages-1221513169.jpg">
            </div>
            
            <div class="w-full text-gray-600 text-normal mx-5">
                <p class="border-b py-3">Georgia Gov. Brian Kemp speaks to the media during a press conference. | Kevin C. Cox/Getty Images</p>
            </div>
            
            <div class="w-full text-gray-600 font-thin italic px-5 pt-3">
                By <strong class="text-gray-700">Quint Forgey</strong><br>
                07/17/2020 09:57 AM EDT<br>
                Updated: 07/17/2020 10:33 AM EDT
            </div>
            
            <div class="px-5 w-full mx-auto">
                <p class="my-5">Georgia Gov. Brian Kemp and Atlanta Mayor Keisha Lance Bottoms hurled insults at one another Friday, as their legal battle over whether to mandate masks in the state’s capital city entered its second day.</p>
                <p class="my-5">During dueling appearances at a Capitol news briefing and in an interview with CNN, the Republican governor and the Democratic mayor both accused the other’s office of playing politics amid a pandemic that continues to ravage communities across Georgia.</p>
                <p class="my-5">Updating members of the media on the state’s coronavirus response, Kemp defended his decision to sue Atlanta’s mayor and city council in an effort to block local officials there from enforcing an order requiring residents to wear a mask in public.</p>
                <p class="my-5">“Mayor Bottoms’ mask mandate cannot be enforced, but her decision to shutter businesses and undermine economic growth is devastating,” Kemp told reporters in Atlanta, likening his administration’s legal action to “sending in the National Guard.”</p>
                <p class="my-5">“I refuse to sit back and watch as disastrous policies threaten the lives and livelihoods of our citizens,” he said. “We will fight to stop reckless actions and put people over pandemic politics.”</p>
                <p class="my-5">Meanwhile, on CNN, Bottoms dismissed Kemp’s unfolding criticism as “propaganda” and “completely inaccurate,” and called the escalating controversy over face coverings “very bizarre, quite frankly.”</p>
                <p class="my-5">Bottoms also charged that the governor’s lawsuit was politically motivated, remarking that she did not “think it was happenstance” that Kemp pursued litigation one day after President Donald Trump visited Atlanta.</p>
                <p class="my-5">Furthermore, Bottoms alleged the lawsuit represented an act of “personal retaliation.” She noted that other Georgia cities had imposed similar mask orders, and said the governor “sued us personally. He did not sue the city of Atlanta. He filed suit against myself and our city council personally.”</p>
                <p class="my-5">The high-profile clash between two of Georgia’s top leaders came after Kemp issued a statewide order Wednesday banning local mask mandates. But Bottoms said her city’s order requiring face coverings would continue to apply, provoking Kemp to file his lawsuit in state court Thursday.</p>
                <p class="my-5">The feud has served to further elevate the national profile of Bottoms, who revealed this month that she had tested positive for Covid-19 and has attained greater public prominence due to reports that she is being vetted for the role of running mate to presumptive Democratic presidential nominee Joe Biden.</p>
                <p class="my-5">As for Kemp, the rift with Bottoms has dredged up earlier criticisms of his management of Georgia’s coronavirus outbreak.</p>
                <p class="my-5">The governor lifted his stay-at-home order at the end of April after memorably admitting earlier in the month that he had just learned asymptomatic infected people could spread the disease, and state officials were caught misrepresenting Covid-19 reporting data in May.</p>
                <p class="my-5">Kemp’s latest opposition to Bottoms’ order, at a time when even the Trump administration is encouraging deference to local coronavirus directives, has drawn significant criticism. It also diverges from the approaches of Republican governors in Southern states including Alabama, Arkansas and Texas, who have issued statewide mask mandates in recent days.</p>
                <p class="my-5">Kemp’s own lieutenant governor, Republican Geoff Duncan, appeared reluctant to offer a full-throated defense of the governor’s lawsuit Friday, instead repeatedly emphasizing the importance of mask-wearing.</p>
                <p class="my-5">“I hope we move past it,” Duncan told CNN of the ongoing controversy, adding that the “whole conversation around the mandate doesn’t help us get through this. It becomes a distraction [from] the health and well-being of 11 million Georgians.”</p>
                <p class="my-5">Although elected officials averse to mask mandates argue Americans should be able to make their own assessments regarding their safety, public health experts have warned that Covid-19 remains a highly contagious disease — and that those not wearing masks risk infecting other, potentially more vulnerable, people.</p>
            </div>
        </div>
        
        <div class="absolute w-full text-right text-sm bottom-0 p-3 mx-auto text-gray-400">
            Made with <i class="text-red-300 fa fa-heart"></i> By <a href="https://timelydevs.com">Timely Systems</a>
        </div>
    </body>
</html>

How to create a Politico Clone Layout with Tailwind CSS?

To create a Politico Clone Layout with Tailwind CSS, follow these steps:

Step 1: Set up the HTML structure

The first step is to set up the HTML structure of the layout. This includes creating a header, main content area, and sidebar. Here is an example of the HTML code:

<header class="bg-white shadow">
  <div class="container mx-auto px-4">
    <nav class="flex items-center justify-between flex-wrap py-6">
      <div class="flex items-center flex-shrink-0 mr-6">
        <a href="#" class="font-bold text-xl text-gray-900">Politico Clone</a>
      </div>
      <div class="block lg:hidden">
        <button class="flex items-center px-3 py-2 border rounded text-gray-500 border-gray-600 hover:text-gray-900 hover:border-gray-900">
          <svg class="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Menu</title><path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/></svg>
        </button>
      </div>
      <div class="w-full block flex-grow lg:flex lg:items-center lg:w-auto">
        <div class="text-sm lg:flex-grow">
          <a href="#" class="block mt-4 lg:inline-block lg:mt-0 text-gray-900 hover:text-gray-900 mr-4">
            Home
          </a>
          <a href="#" class="block mt-4 lg:inline-block lg:mt-0 text-gray-900 hover:text-gray-900 mr-4">
            Politics
          </a>
          <a href="#" class="block mt-4 lg:inline-block lg:mt-0 text-gray-900 hover:text-gray-900">
            Policy
          </a>
        </div>
        <div>
          <a href="#" class="inline-block text-sm px-4 py-2 leading-none border rounded text-gray-900 border-gray-900 hover:border-transparent hover:text-white hover:bg-gray-900 mt-4 lg:mt-0">Subscribe</a>
        </div>
      </div>
    </nav>
  </div>
</header>

<main class="container mx-auto px-4 py-6">
  <div class="flex flex-wrap -mx-4">
    <div class="w-full lg:w-3/5 px-4">
      <div class="flex flex-wrap -mx-4">
        <div class="w-full md:w-1/2 px-4">
          <div class="bg-white rounded-lg shadow-lg overflow-hidden">
            <img class="w-full h-48 object-cover" src="https://source.unsplash.com/random/800x600" alt="Article Image">
            <div class="p-4">
              <h2 class="text-xl font-bold mb-2"><a href="#" class="hover:text-gray-900">Article Title</a></h2>
              <p class="text-gray-700 text-base">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec pharetra felis. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
            </div>
          </div>
        </div>
        <div class="w-full md:w-1/2 px-4">
          <div class="bg-white rounded-lg shadow-lg overflow-hidden">
            <img class="w-full h-48 object-cover" src="https://source.unsplash.com/random/800x600" alt="Article Image">
            <div class="p-4">
              <h2 class="text-xl font-bold mb-2"><a href="#" class="hover:text-gray-900">Article Title</a></h2>
              <p class="text-gray-700 text-base">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec pharetra felis. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="w-full lg:w-2/5 px-4">
      <div class="bg-white rounded-lg shadow-lg overflow-hidden">
        <img class="w-full h-48 object-cover" src="https://source.unsplash.com/random/800x600" alt="Article Image">
        <div class="p-4">
          <h2 class="text-xl font-bold mb-2"><a href="#" class="hover:text-gray-900">Article Title</a></h2>
          <p class="text-gray-700 text-base">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec pharetra felis. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
        </div>
      </div>
    </div>
  </div>
</main>

<aside class="container mx-auto px-4 py-6">
  <div class="bg-white rounded-lg shadow-lg overflow-hidden">
    <div class="p-4">
      <h2 class="text-xl font-bold mb-2">Sidebar Title</h2>
      <p class="text-gray-700 text-base">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec pharetra felis. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
    </div>
  </div>
</aside>

Step 2: Add Tailwind CSS classes

Next, we will add Tailwind CSS classes to style the HTML elements. Here is an example of the CSS code:

/* Header */
.bg-white {
  background-color: #fff;
}
.shadow {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.container {
  width: 100%;
  padding-right: 1rem;
  padding-left: 1rem;
  margin-right: auto;
  margin-left: auto;
}
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.flex-wrap {
  flex-wrap: wrap;
}
.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
.flex-shrink-0 {
  flex-shrink: 0;
}
.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}
.text-gray-900 {
  color: #1a202c;
}
.block {
  display: block;
}
.mr-6 {
  margin-right: 1.5rem;
}
.hidden {
  display: none;
}
.border {
  border-width: 1px;
}
.rounded {
  border-radius: 0.25rem;
}
.text-gray-500 {
  color: #718096;
}
.border-gray-600 {
  border-color: #4a5568;
}
.hover\:text-gray-900:hover {
  color: #1a202c;
}
.hover\:border-gray-900:hover {
  border-color: #1a202c;
}
.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.inline-block {
  display: inline-block;
}
.leading-none {
  line-height: 1;
}
.border-transparent {
  border-color: transparent;
}
.bg-gray-900 {
  background-color: #1a202c;
}
.hover\:bg-gray-900:hover {
  background-color: #1a202c;
}
.mt-4 {
  margin-top: 1rem;
}
.lg\:inline-block {
  display: inline-block;
}
.lg\:mt-0 {
  margin-top: 0;
}
.lg\:flex-grow {
  flex-grow: 1;
}
.lg\:items-center {
  align-items: center;
}
.lg\:w-auto {
  width: auto;
}
.lg\:hidden {
  display: none;
}
.lg\:block {
  display: block;
}
.lg\:flex {
  display: flex;
}
.lg\:justify-between {
  justify-content: space-between;
}
.lg\:py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
.lg\:text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.lg\:mt-0 {
  margin-top: 0;
}

/* Main Content */
.h-48 {
  height: 12rem;
}
.object-cover {
  object-fit: cover;
}
.text-gray-700 {
  color: #4a5568;
}
.md\:w-1\/2 {
  width: 50%;
}
.p-4 {
  padding: 1rem;
}

/* Sidebar */
aside {
  margin-top: 3rem;
}

Step 3: Preview and modify the layout

Finally, we can preview the layout and modify the styles as needed. By using Tailwind CSS classes, we can easily modify the styles of the layout without having to write CSS code from scratch.

Conclusion

In conclusion, Tailwind CSS is a powerful tool for creating custom user interfaces quickly and easily. By using Tailwind CSS, developers can save time and effort in writing CSS code from scratch. Additionally, Tailwind CSS is highly customizable, which means that developers can easily modify the styles to match the design of their website. By following the steps outlined in this article, you can create a Politico Clone Layout with Tailwind CSS in no time.