Hello, I’m trying to create my first page on Phoenix-Liveview. But TailWind classes doesn’t worked properly in my LiveView module. I’m trying to stretch <div> from my LiveView module, but LiveView adding nested div, and i don’t understand how to work with this.
def my_live_view do
quote do
use Phoenix.LiveView,
layout: {PayLaterWeb.Layouts, :app},
container: {:tr, class: "colorized h-full w-full flex flex-row bg-black"}
unquote(html_helpers())
end
end
Not sure if its related, but as you are new to Liveview its worth noting that core_components.ex has a bunch of components that all have Tailwind classes and can often mess with your layout if you are not aware of them and use the components.
Also you have app.html.heex and root.html.heex which both have <%= @inner_content %> tags, so not sure which one your code is from, but you mave have decided to work in one and not realise the other has divs and classes that effect your layout?
Easiest way to fix it from my experience is to inspect the page, find out which div is being created that you don’t want then search for it in your code editor. Ctrl + Shift + f in VScode is the solution for me whenever Liveview seems to be creating phantom divs/classes.
I have readed in docs about app.html.heex and root.html.heex layouts, but didn’t understand, why i need app.html.heex in Phoenix 1.7. So i decided not touch app.html.heex.
I deleted some code, which was for sidebar. At this code I have used my own and others components from core_components.ex, but the problem in still there.
If you haven’t changed this code, you will get a load of Tailwind from the flash_group core component that might be effecting your layout, as well as the main and div elements.
Try deleting the default code in app.html.heex and just leaving this to see if it fixes anything: