How to change default <main> element generated by TailwindCSS installation on Ruby on Rails?

81 Views Asked by At

Apparently, if one installs TailwindCSS on Ruby on Rails, this will generate a html element with a series of classes that centers in a very strange way all the views you have in the app.

<main class="container mx-auto mt-28 px-5 flex">

The above element appears in every view after one installs TailwindCSS. What would be the best approach to customize/remove this element?

Would be also grateful if anyone can also explain why they choose to spawn this element. On their github, someone created an issue about this, but their response wasn't very clear to me: " is added in order to centralize the content". Thank you.

1

There are 1 best solutions below

2
smathy On

Really not sure what the issue is here, the main tag has a clear semantic, classically people would have things like a "container" or "content" div but now they can use main instead, Rails adds it in order to give a top level tag for styling/containing the main content of a page, feel free to restyle it however you please, or remove it if you don't need it.