52
loading...
This website collects cookies to deliver better user experience
style={{}}
. You also have to write your styles differently. Since these are Javascript objects that we are injecting into our JSX, we have to write our styles in camelCase. background-color: red;
== {{backgroundColor: “red”}}
Having to declare the whole property and its value can make your code very congested and harder to read. Tailwind uses a class name that represents that property. These class names are shorter and have set values to help with readability concerns and constancy. m-8
(margin: 2 rem
). Much simpler.div
that had a border-style: solid; border-width: 2px;
max-width: 100%
and had a box-shadow
all i would have to do is:<div className="width-full border-solid border-2 shadow">
Hi there!
</div>
padding
to a div
but don’t remember the class name or sizes all you have to do is type padding
in the search bar and it will take you directly to that section of the documentation. I use this life line every time I develop to double check my class names and also see what values are available for each property.