How to remove @ui.page padding or margin #499
-
Code: @ui.page('/login')
def loginPage(request: Request):
with ui.column().classes('bg-red window-width window-height'):
ui.button('Click') I added the ui.column, just so I can color the background red, to see the margin of the ui.page clearly, but it also happens without the ui.column. When I work with Vue and Quasar, I just modify the CSS of the div with the id #app, and the body, html to the CSS values of margin: 0, width: 100% and height: 100%. When I work in Nuxt 3, they name the div with id #app, instead of id, they use a class __nuxt, After all that, then I add the neccessary margins. This is so that I can have full control of how Final WordsI inspected the html in the browser, and I saw some hard-coded values. I found a div with the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
To avoid the padding, you can access the from nicegui import Client, ui
@ui.page('/')
def page(client: Client):
client.content.classes(remove='q-pa-md')
with ui.column().classes('bg-red window-width window-height'):
ui.button('Click')
ui.run() But once you have access to the @ui.page('/')
def page(client: Client):
client.layout.classes('bg-red')
ui.button('Click') See #411 for a discussion about how to set the page background color and the ongoing development of a nicer API. |
Beta Was this translation helpful? Give feedback.
-
🤯🔥🤖🥶😱👻 |
Beta Was this translation helpful? Give feedback.
-
For those coming in the future, the most elegant solution is now here:
from nicegui import ui
ui.query('.nicegui-content').classes('p-0')
ui.run() |
Beta Was this translation helpful? Give feedback.
To avoid the padding, you can access the
content
and remove theq-pa-md
class as follows:But once you have access to the
client
, you can also set the background color for thelayout
directly. This automatically fills the whole screen:See #411 for a discussion about how to set the page background color and the ongoing development of a nicer API.