Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: update sample CSS for setting custom content width #1318

Merged
merged 2 commits into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions docs/user_guide/layout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,34 @@ The ``primary sidebar`` will snap to the left, the ``secondary sidebar`` will sn
- If one of the sidebars is not present, then the ``article content`` will be centered between the other sidebar and the side of the page.
- If neither sidebar is present, the ``article content`` will be in the middle of the page.

If you'd like the ``article content`` to take up more width than its default, use the ``max-width`` and ``flex-grow`` CSS variables with the ``.bd-content`` selector.
For example, to make the content grow to fit all available width, add a custom CSS rule like:
If you'd like the ``article content`` to take up more width than its default, use the ``max-width`` CSS property with the following selectors:

.. code-block:: css

.bd-content {
flex-grow: 1;
max-width: 100%;
.bd-main .bd-content .bd-article-container {
max-width: 100%; /* default is 60em */
}

The above rule will set the article content max width to the same width as the top navigation bar.
To truly use *all* of the available page width, you also need to set the following CSS rule:

.. code-block:: css

.bd-page-width {
max-width: 100%; /* default is 88rem */
}

This will affect both the article content and the top navigation bar.
drammock marked this conversation as resolved.
Show resolved Hide resolved

.. note::

If you use both of the custom CSS rules above, *be sure to keep them as separate
rules* in your CSS file.
If you combine them, the result will be a CSS selector that is *less specific*
than the two default rules in the theme, and your custom CSS will fail to
override the theme defaults.


Templates and components
========================

Expand Down