figoyouwei / taipy_success

This is a sample code that tests the deployment on heroku
2 stars 2 forks source link

How to center navbar with tgb #16

Closed figoyouwei closed 2 months ago

figoyouwei commented 2 months ago

Hi,

I know how to center navbar with Markdown, but how to do it with tgb? Please check, thanks. https://github.com/figoyouwei/taipy_success/blob/main/apps/yfin/pages/home.py

Screenshot 2024-09-11 at 16 03 33
AlexandreSajus commented 2 months ago

Here is an example that works:

In main.py:

from taipy import Gui
import taipy.gui.builder as tgb

with tgb.Page() as root_page:
    tgb.navbar(class_name="navbar")
    tgb.text("# Multi-page application", mode="md")

with tgb.Page() as page_1:
    tgb.text("## This is page 1", mode="md")
with tgb.Page() as page_2:
    tgb.text("## This is page 2", mode="md")

pages = {"/": root_page, "page1": page_1, "page2": page_2}
Gui(pages=pages).run()

In main.css:

.navbar {
    margin: auto;
}
figoyouwei commented 2 months ago

Thanks.