Vovchikan
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.
<main> with @inner_content in my layout
<main id="inner_content" class="bg-stone-300 h-full w-full flex flex-col">
<%= @inner_content %>
</main>
HTML in my LiveView module
~H"""
<div class="flex-1 bg-lime-500 border-2 rounded-xl p-2">
123
</div>
<div class="flex-1 bg-cinc-500 border-2 rounded-xl p-2">
123
</div>
"""
When i replacing @inner_conntent by this html from my LiveView module, all work fine, both divs shrink on all page’s width.
I’ve found “solution” from same question on this forum, but don’t understand it - Styling auto-injected phoenix div between layout and @inner_content?
I’ve tried 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
Trending in Questions
Hello everyone!
I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++.
Does anyone ...
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
Background
When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error:
* assembling mark...
New
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hi everyone :waving_hand:
I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
GazeIntoTheAbyss
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.
Vovchikan
i’m using root.html.heex. My code with
<%= @inner_content %>is from root.html.heex.I didn’t change app.html.heex after creating Phoenix app with
phx.new: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.
Vovchikan
root.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.Vovchikan
I will try, ty
Elixir_begginer
I think when the div is injected like that, the tailwind compiler runs before the div is injected, and doesnt add the css classes to the css file.
Try to add:
container: {:div, class: "my-class"}and in the app.css:
I hope that works, however im not able to check it now myself.
GazeIntoTheAbyss
I believe this is default generated in app.html.heex
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: