Tailwind CSS how to code pixel perfect design
Ok got it, I need to edit tailwind.config.js
and set custom sizes there. For example:
height: [
...
'278px': '278px',
...
]
So now this size can be set with <div clas="h-278px">...</div>
Update:
After completed many projects on top of TailwindCSS I learned that it's not very optimal to set spacing/w/h... in tailwind config if it's used only once. It's better to go with the custom class you can always use @apply in that class anyway.
Update 2021:
As of tailwind version 2.1 we can enable JIT and use arbitrary styles like this:
mb-[278px]
How can I specify exactly 600px width in Tailwind CSS?
If you configure your Tailwind install to run in just-in-time mode, and you are running tailwind 2.1+, you can use their arbitrary value support. https://tailwindcss.com/docs/just-in-time-mode
For example, I needed a width of 600px, here is how I specified it:
h-[600px]
Tailwind - How to customize padding such as px-10
You can add custom padding values as shown in their documentation
// tailwind.config.js
module.exports = {
theme: {
spacing: {
sm: '10px',
}
}
}
and use it as
<div class="px-sm"> .. <div/>
OR
Use your custom values inside class by using JIT mode
<div className="pl-[10px] pr-[10px]"> .. </div>
How to make pseudo line in tailwind?
I'm not sure if I understand your question well, but need to read tailwind docs to understand how tailwind works, so here is what I did I hope it's what you are looking for :
<script src="https://cdn.tailwindcss.com"></script>
<div class='h-screen w-screen'>
<div class="h-[400px] bg-green-300 w-[20px]"></div>
</div>
Related Topics
Trying to Do a CSS Transition on a Class Change
How to Inspect CSS Pseudo Classes with Firebug
Ionic - Ion-Item Text Is Not Vertically Centered When Ion-Icon Is Bigger
Why Can't I Decrease The Line-Height of This Text
How to Left Align Bootstrap 3 Dropdown Menu
Getting Image to Stretch a Div
Bootstrap4 Make All Input-Group-Addons Same Width
Get Button Text on to One Line
What's The Point of Gutters in CSS Grid Frameworks
Div with Margin-Left and Width:100% Overflowing on The Right Side
Material UI V1 - Set Table Column Widths
Best Practice to Manage All Asset Caching (Images, CSS, Js, Everything)
React Routes - Different Styling on Body CSS Tag
How to Use Font Awesome in Own CSS