Tailwind Introduction - umrover/mrover-ros2 GitHub Wiki
CSS frameworks like Bootstrap and TailwindCSS are designed to reduce the need for writing separate .css files. Instead, styles can be applied directly in your HTML using predefined classes, making development more convenient.
Although this approach can be powerful, we donβt fully adopt it in this project to keep the learning curve low. Since Vue components combine HTML, JavaScript, and CSS in one file, managing styles is already relatively convenient.
That said, before jumping into <style scoped> to write something like:
margin-bottom: 1rem;You should consider using the spacing utility instead:
<div class="mb-3"></div>This keeps your code cleaner and more consistent with the rest of the project.
Throughout the codebase, youβll see classes like px-2 and m-3. These are Tailwind utility classes that control padding and margin. They provide a fast and readable way to apply spacing without writing custom CSS.
-
mβ margin -
pβ padding
-
tβ top -
bβ bottom -
sβ start -
eβ end -
xβ left and right (horizontal) -
yβ top and bottom (vertical) - (omitted) β all sides
-
0β 0 spacing -
1β 0.25rem -
2β 0.5rem -
3β 1rem -
4β 1.5rem -
5β 3rem -
autoβ auto margin (only form)
rem, or root element, is a measurement that corresponds to the font size of the root element. By default in most browsers:
html {
font-size: 16px;
}Therefore, in this case, 1rem = 16px, 0.5rem = 8px, etc.
| Class | Description |
|---|---|
m-3 |
Margin on all sides = 1rem |
pt-2 |
Padding top = 0.5rem |
py-0 |
Padding top & bottom = 0 |
ms-auto |
Margin start = auto |