How to remove the white border located to the right of the left-drawer element #4558
-
code like below: ui.add_css('''
.custom-tabs .q-tab__indicator {
display: none !important;
}
.custom-tabs .q-tab__label {
font-size: 20px !important;
color: #ffff !important;
}
.custom-tabs .q-tab--active,
.custom-tabs .q-tab.q-tab--active,
.custom-tabs .q-tab[aria-selected="true"] {
background-color: #449DEE !important;
}
.custom-tabs {
width: 100% !important;
}
.q-page {
width: 100% !important;
background-color: #F4F9FD !important;
}
.q-drawer {
border: none !important;
width: 260px !important;
background-color: #65B6FF !important;
height: 100%;
}
''')
ui.label('page-1').classes('text-black text-2xl font-bold')
with ui.header().classes('item-center place-content-between').style('background-color: white'):
header_title = ui.label('测试').classes('place-self-center').style('font-size: 24px; color:#65B6FF')
ui.icon('menu').classes('text-blue-500').on('click', lambda: left_drawer.toggle())
with ui.left_drawer(top_corner=True) as left_drawer:
ui.image('/static/images/[email protected]').classes('w-[206px] h-[46px] place-self-start') I modify |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @lucasli0121, Can you please reduce your code example to the bare minimum to reproduce the problem? This allows us (and others that might visit this discussion in the future) to recognize the problem more easily. I guess Thanks! |
Beta Was this translation helpful? Give feedback.
-
@lucasli0121 solved it from root cause. No need CSS hack to override width using !important TL-DR: Quasar needs to know the width. Simply set CSS is nightmare for it, and things will break. Let it know via Notice how the style Reference: https://quasar.dev/layout/drawer#qdrawer-api from nicegui import ui
ui.add_css('''
.custom-tabs .q-tab__indicator {
display: none !important;
}
.custom-tabs .q-tab__label {
font-size: 20px !important;
color: #ffff !important;
}
.custom-tabs .q-tab--active,
.custom-tabs .q-tab.q-tab--active,
.custom-tabs .q-tab[aria-selected="true"] {
background-color: #449DEE !important;
}
.custom-tabs {
width: 100% !important;
}
.q-page {
width: 100% !important;
background-color: #F4F9FD !important;
}
.q-drawer {
border: none !important;
/* width: 260px !important; */ /* Don't set width here, it will be set in the left_drawer .props() */
background-color: #65B6FF !important;
height: 100%;
}
''')
ui.label('page-1').classes('text-black text-2xl font-bold')
with ui.header().classes('item-center place-content-between').style('background-color: white'):
header_title = ui.label('测试').classes('place-self-center').style('font-size: 24px; color:#65B6FF')
ui.icon('menu').classes('text-blue-500').on('click', lambda: left_drawer.toggle())
with ui.left_drawer(top_corner=True).props("width=260") as left_drawer:
ui.image('/static/images/[email protected]').classes('w-[206px] h-[46px] place-self-start')
ui.run() |
Beta Was this translation helpful? Give feedback.
@lucasli0121 solved it from root cause. No need CSS hack to override width using !important
TL-DR: Quasar needs to know the width. Simply set CSS is nightmare for it, and things will break. Let it know via
.props("width=260")
Notice how the style
padding-left: 300px;
andleft: 300px
is set and unset when the left drawer is shown / hidden based on browser width? Yes, it is because it is Quasar setting it. This is why we need to tell Quasar what width we are setting.Reference:
quasarframework/quasar#15148
https://quasar.dev/layout/drawer#qdrawer-api