:sequential_nav: both .. _tutorial_frontend: Make it look like a site ======================== So far the site works but reads as an admin demo. In this short chapter you will add a small stylesheet, render the CMS menu as a real top navigation, and replace the unstyled body in ``base.html`` with a proper layout. Goal ---- At the end of this chapter, an anonymous visitor lands on a homepage with a navigation bar containing **Home**, **About**, and **Menu**. Pages share a visual style. The coffee cards look like cards. 1. A minimal stylesheet ----------------------- Create ``coffeeshop/static/coffeeshop/site.css``: .. code-block:: css :root { --ink: #2b1d12; --paper: #faf6f1; --accent: #a4673e; } body { font-family: system-ui, sans-serif; margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; } header.site-header { background: var(--ink); color: var(--paper); padding: 1rem 2rem; display: flex; align-items: center; gap: 2rem; } header.site-header a { color: inherit; text-decoration: none; } nav.site-nav ul { list-style: none; display: flex; gap: 1.5rem; margin: 0; padding: 0; } main { max-width: 56rem; margin: 2rem auto; padding: 0 1rem; } .coffee-card { border: 1px solid var(--accent); border-radius: 6px; padding: 1rem 1.25rem; margin: 1rem 0; background: white; } .coffee-card h3 { margin: 0 0 .25rem; } .coffee-card .price { font-weight: bold; color: var(--accent); } You do not have to type this — copy any starter stylesheet you like. The point is that styling is ordinary CSS. Run ``python manage.py collectstatic --noinput`` if your project serves static files via Django's staticfiles app. During development with ``DEBUG = True`` you usually do not need to. 2. Render the navigation from CMS pages --------------------------------------- The CMS menu is a *template tag*. Edit ``coffeesite/templates/base.html`` to import it and use it inside the header. .. code-block:: html+django :emphasize-lines: 1,7,13-18 {% load cms_tags sekizai_tags menu_tags static %} {% page_attribute "page_title" %} – Coffee Roaster {% render_block "css" %} {% cms_toolbar %}
{% block content %} {% placeholder "Body" %} {% endblock %}
{% render_block "js" %} The four numbers on ``{% show_menu %}`` control how deep and how many levels the menu shows. Defaults are sane. The full list of menu tags is in :doc:`/reference/navigation`. The default ``menu/menu.html`` template renders ``
  • `` items — only nested levels bring their own ``