- Published on
A Complete Guide To Make A Stock page With Tailwind CSS

- What is Tailwind CSS?
- The description of Stock page ui component
- Why use Tailwind CSS to build a Stock page ui component?
- The preview of Stock page ui component
- The source code of Stock page ui component
- How to build a Stock page with Tailwind CSS?
- Install tailwind css of verion 2.0.2
- All the unility class needed to build a Stock page component
- 70 steps to build a Stock page component with Tailwind CSS
- Conclusion
What is Tailwind CSS?
Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.
The description of Stock page ui component
Inspired by google finance
Why use Tailwind CSS to build a Stock page ui component?
- It can make the building process of Stock page ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Stock page component file.
The preview of Stock page ui component
Free download of the Stock page's source code
The source code of Stock page ui component
<header class="text-gray-100 bg-white body-font shadow w-full">
<div class="container mx-auto flex flex-wrap flex-col md:flex-row items-center">
<a class="">
<img src="https://i.imgur.com/K6AIhk2.png" style="height: 40px; margin-top: 10px; margin-bottom: 10px;" alt="logo">
</a>
</nav>
<div class="lg:w-2/5 inline-flex lg:justify-end ml-5 lg:ml-0">
<input type="search" name="serch" placeholder="Search for stock, ETF" class="bg-gray-100 h-10 px-5 pr-10 rounded-full text-sm focus:outline-none">
<button type="submit" class="absolute right-0 top-0 mt-3 mr-4">
<svg class="h-4 w-4 fill-current" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 56.966 56.966" style="enable-background:new 0 0 56.966 56.966;" xml:space="preserve" width="512px" height="512px">
<path d="M55.146,51.887L41.588,37.786c3.486-4.144,5.396-9.358,5.396-14.786c0-12.682-10.318-23-23-23s-23,10.318-23,23 s10.318,23,23,23c4.761,0,9.298-1.436,13.177-4.162l13.661,14.208c0.571,0.593,1.339,0.92,2.162,0.92 c0.779,0,1.518-0.297,2.079-0.837C56.255,54.982,56.293,53.08,55.146,51.887z M23.984,6c9.374,0,17,7.626,17,17s-7.626,17-17,17 s-17-7.626-17-17S14.61,6,23.984,6z"/>
</svg>
</button>
</div>
</div>
</header>
<header class="flex-none flex h-16 bg-gray-100 border-t px-4 items-center">
<h1 class="font-semibold text-lg">My Portfolio</h1>
</header>
<div class="flex items-center bg-gray-100 text-gray-800">
<div class="p-4 w-full">
<div class="grid grid-cols-12 gap-4">
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-white
bg-indigo-700
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
삼성전자
</a>
</div></div>
<div class="font-bold text-lg">₩91,000.00</div>
<span class="text-red-500">▲ 2.48%</span>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-white
bg-black
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Tesla Inc
</a>
</div></div>
<div class="font-bold text-lg">$880.02</div>
<span class="text-gray-500">- 0.00%</span>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-black
ring-black ring-2
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
KOSPI
</a>
</div></div>
<div class="font-bold text-lg">3,148.45</div>
<span class="text-blue-500">▼ 0.12%</span>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded">
<div id="empty-cover-art" class="py-5 h-full rounded sm:w-full text-center opacity-50 md:border-solid md:border-2 md:border-gray-400">
<center><svg width="48" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg></center>
<div class="">
Create New
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-cover bg-center h-auto text-white py-24 px-10 object-fill" style="background-image: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSxJPlSKDyfGg_WEpda49DZyo_fSKrdmxoIaqosNxD_luNQ0QaDKRqnU6CWEB8)">
<div class="md:w-1/2">
<p class="font-bold text-sm uppercase">FINANCE NEWS - <a href="#" class="inline-block rounded-full text-black
ring-black ring-2
text-xs font-bold bg-white
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Nifty_50
</a></p>
<p class="text-lg font-bold">Traders' Guide: Nifty has to hold above 14,300 level to witness fresh rally</p>
<p class="text-sm mb-10 leading-none">The Economic Times - 29min ago</p>
</div>
</div>
<header class="flex-none flex h-16 bg-gray-100 border-t px-4 items-center">
<h1 class="font-semibold text-lg">Compare market</h1>
</header>
<header class="flex-none flex bg-gray-100 px-4 items-center">
<a href="#" class="inline-block rounded-full text-blue-700
bg-blue-100
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
United States
</a>
<a href="#" class="inline-block rounded-full text-black
text-xs
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Asia
</a>
<a href="#" class="inline-block rounded-full text-black
text-xs
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Europe
</a>
<a href="#" class="inline-block rounded-full text-black
text-xs
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Currency
</a>
<a href="#" class="inline-block rounded-full text-black
text-xs
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Crypto
</a>
</header>
<div class="flex items-center bg-gray-100 text-gray-800">
<div class="p-4 w-full">
<div class="grid grid-cols-12 gap-4">
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-black
text-xs font-bold ">
Dow Jones
</a>
</div></div>
<div class="font-bold text-lg">31,097.97</div>
<span class="text-gray-500">- 0.00%</span>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-black
text-xs font-bold ">
S&P 500
</a>
</div></div>
<div class="font-bold text-lg">3,824.68</div>
<span class="text-gray-500">- 0.00%</span>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-black
text-xs font-bold ">
NASDAQ
</a>
</div></div>
<div class="font-bold text-lg">13,201.98</div>
<span class="text-red-500">▲ 1.03%</span>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded">
<div id="empty-cover-art" class="py-3 h-full rounded sm:w-full text-center opacity-50 md:border-solid md:border-2 md:border-gray-400">
<center><svg width="48" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z" />
</svg></center>
<div class="">
See More
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<header class="flex-none flex h-16 bg-gray-100 border-t px-4 items-center">
<h1 class="font-semibold text-lg">Most Followed</h1>
</header>
<div class="flex items-center bg-gray-100 text-gray-800">
<div class="p-4 w-full">
<div class="grid grid-cols-12 gap-4">
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-white
bg-indigo-700
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
005930
</a>
</div></div>
<div class="font-bold text-lg">23.6K </div>
<div class="text-gray-300 text-sm">Followers</div>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-white
bg-black
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
AAPL
</a>
</div></div>
<div class="font-bold text-lg">13.8K </div>
<div class="text-gray-300 text-sm">Followers</div>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-white
bg-black
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
TSLA
</a>
</div></div>
<div class="font-bold text-lg">23.6K </div>
<div class="text-gray-300 text-sm">Followers</div>
</div>
</div>
</div>
<div class="col-span-12 sm:col-span-6 md:col-span-3">
<div class="flex flex-row bg-white shadow-sm rounded p-4">
<div class="flex flex-col flex-grow ml-4">
<div class="text-sm text-gray-500">
<div class="col-span-12 lg:col-span-8">
<a href="#" class="inline-block rounded-full text-white
bg-yellow-700
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
GOOGL
</a>
</div></div>
<div class="font-bold text-lg">7.74K </div>
<div class="text-gray-300 text-sm">Followers</div>
</div>
</div>
</div></div></div></div>
<header class="flex-none flex h-16 bg-gray-100 border-t px-4 items-center">
<h1 class="font-semibold text-lg">Market Status</h1>
</header>
<header class="flex-none flex bg-gray-100 px-4 items-center">
<a href="#" class="inline-block rounded-full text-blue-700
bg-blue-100
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Hot
</a>
<a href="#" class="inline-block rounded-full text-black
text-xs
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Upside
</a>
<a href="#" class="inline-block rounded-full text-black
text-xs
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
Downside
</a>
</header>
<ul class="flex flex-col bg-gray-100 p-4">
<li class="border-gray-400 flex flex-row mb-2">
<div class="select-none cursor-pointer bg-white rounded-md flex flex-1 items-center p-4 transition duration-200 ease-in-out transform hover:-translate-y-1 hover:shadow">
<div class="flex-1 pl-1 mr-16">
<div class="font-medium">Company A</div>
<div class="text-gray-600 text-sm"> <a href="#" class="inline-block rounded-full text-white
bg-yellow-700
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
COMPA
</a> </div>
</div>
<div class="text-red-500 ">↑ 3.45%</div>
</div>
</li>
<li class="border-gray-400 flex flex-row mb-2">
<div class="select-none cursor-pointer bg-white rounded-md flex flex-1 items-center p-4 transition duration-200 ease-in-out transform hover:-translate-y-1 hover:shadow">
<div class="flex-1 pl-1 mr-16">
<div class="font-medium">Company B</div>
<div class="text-gray-600 text-sm"> <a href="#" class="inline-block rounded-full text-white
bg-pink-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
COMPB
</a> </div>
</div>
<div class="text-gray-500 ">- 0.0%</div>
</div>
</li>
<li class="border-gray-400 flex flex-row mb-2">
<div class="select-none cursor-pointer bg-white rounded-md flex flex-1 items-center p-4 transition duration-200 ease-in-out transform hover:-translate-y-1 hover:shadow">
<div class="flex-1 pl-1 mr-16">
<div class="font-medium">Company C</div>
<div class="text-blue-500 text-sm"> <a href="#" class="inline-block rounded-full text-white
bg-blue-500
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1 ">
COMPC
</a> </div>
</div>
<div class="text-blue-500 ">↓ 56.78%</div>
</div>
</li>
</ul>
How to build a Stock page with Tailwind CSS?
Install tailwind css of verion 2.0.2
Use the script
html tag to import the script of Tailwind CSS of the version 2.0.2
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to build a Stock page component
text-gray-100
bg-white
w-full
mx-auto
flex
flex-wrap
flex-col
md:flex-row
lg:w-2/5
inline-flex
ml-5
lg:ml-0
bg-gray-100
h-10
px-5
pr-10
text-sm
absolute
right-0
top-0
mt-3
mr-4
h-4
w-4
flex-none
h-16
border-t
px-4
text-lg
text-gray-800
p-4
grid
grid-cols-12
gap-4
flex-row
flex-grow
ml-4
text-gray-500
inline-block
text-white
text-xs
mr-1
md:mr-2
mb-2
px-2
md:px-4
py-1
text-red-500
text-blue-500
py-5
h-full
sm:w-full
text-center
md:border-solid
md:border-2
md:border-gray-400
bg-cover
bg-center
h-auto
py-24
px-10
md:w-1/2
mb-10
py-3
text-gray-300
border-gray-400
flex-1
pl-1
mr-16
text-gray-600
70 steps to build a Stock page component with Tailwind CSS
Control the text color of an element to gray-100 using the
text-gray-100
utilities.Control the background color of an element to white using the
bg-white
utilities.Use
w-full
to set an element to a 100% based width.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container at only medium screen sizes.Use
lg:w-2/5
to set an element to a fixed width(2/5) at only large screen sizes.Use
inline-flex
to create an inline flex container that flows with text.Control the margin on left side of an element to 1.25rem using the
ml-5
utilities.Control the margin on left side of an element to 0rem at only large screen sizes using the
lg:ml-0
utilities.Control the background color of an element to gray-100 using the
bg-gray-100
utilities.Use
h-10
to set an element to a fixed height(2.5rem).Control the horizontal padding of an element to 1.25rem using the
px-5
utilities.Control the padding on right side of an element to 2.5rem using the
pr-10
utilities.Control the text color of an element to sm using the
text-sm
utilities.Use
absolute
to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.Use the
right-0
utilities to set the right position of a positioned element to 0rem.Use the
top-0
utilities to set the top position of a positioned element to 0rem.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Control the margin on right side of an element to 1rem using the
mr-4
utilities.Use
h-4
to set an element to a fixed height(1rem).Use
w-4
to set an element to a fixed width(1rem).Use
flex
to create a block-level flex container.Use
h-16
to set an element to a fixed height(4rem).Control the border color of an element to t using the
border-t
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the text color of an element to gray-800 using the
text-gray-800
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Use
grid
to create a grid container.Use
grid
to create a grid container.To specify the width between columns, you can use the
gap-4
utilities.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Control the margin on left side of an element to 1rem using the
ml-4
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.Use
inline-block
utilities to wrap the element to prevent the text inside from extending beyond its parent.Control the text color of an element to white using the
text-white
utilities.Control the text color of an element to xs using the
text-xs
utilities.Control the margin on right side of an element to 0.25rem using the
mr-1
utilities.Control the margin on right side of an element to 0.5rem at only medium screen sizes using the
md:mr-2
utilities.Control the margin on bottom side of an element to 0.5rem using the
mb-2
utilities.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the horizontal padding of an element to 1rem at only medium screen sizes using the
md:px-4
utilities.Control the vertical padding of an element to 0.25rem using the
py-1
utilities.Control the text color of an element to red-500 using the
text-red-500
utilities.Control the text color of an element to blue-500 using the
text-blue-500
utilities.Control the vertical padding of an element to 1.25rem using the
py-5
utilities.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Use
w-full
to set an element to a 100% based width at only small screen sizes.Control the text color of an element to center using the
text-center
utilities.Control the border color of an element to solid using the
md:border-solid
utilities at only medium screen sizes.Control the border color of an element to 0.5rem using the
md:border-2
utilities at only medium screen sizes.Control the border color of an element to gray-400 using the
md:border-gray-400
utilities at only medium screen sizes.Control the background color of an element to cover using the
bg-cover
utilities.Control the background color of an element to center using the
bg-center
utilities.Use
h-auto
to set an element to a fixed height(auto).Control the vertical padding of an element to 6rem using the
py-24
utilities.Control the horizontal padding of an element to 2.5rem using the
px-10
utilities.Use
md:w-1/2
to set an element to a fixed width(1/2) at only medium screen sizes.Control the margin on bottom side of an element to 2.5rem using the
mb-10
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the text color of an element to gray-300 using the
text-gray-300
utilities.Control the border color of an element to gray-400 using the
border-gray-400
utilities.Use
flex
to create a block-level flex container.Set the left padding of an element to 0.25rem using the
pl-1
utilities classControl the margin on right side of an element to 4rem using the
mr-16
utilities.Control the text color of an element to gray-600 using the
text-gray-600
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Stock page components, learn and follow along to implement your own components.