mirror of
https://github.com/picocss/pico.git
synced 2025-04-23 09:56:14 -04:00
docs: add documentation for $semantic-root-element
This commit is contained in:
parent
318bdd4793
commit
20869b20a2
5 changed files with 70 additions and 10 deletions
File diff suppressed because one or more lines are too long
|
@ -22,6 +22,15 @@
|
||||||
</hgroup>
|
</hgroup>
|
||||||
<p>Pico provides a <code>.classless</code> version (<a href="https://picocss.com/examples/classless/">example</a>).</p>
|
<p>Pico provides a <code>.classless</code> version (<a href="https://picocss.com/examples/classless/">example</a>).</p>
|
||||||
<p>In this version, <code><<b>header</b>></code>, <code><<b>main</b>></code>, and <code><<b>footer</b>></code> act as <a href="./containers.html">containers</a> to define a centered or a fluid viewport.</p>
|
<p>In this version, <code><<b>header</b>></code>, <code><<b>main</b>></code>, and <code><<b>footer</b>></code> act as <a href="./containers.html">containers</a> to define a centered or a fluid viewport.</p>
|
||||||
|
|
||||||
|
<pre><code><em>// Containers</em>
|
||||||
|
<b>body</b> > <b>header</b>,
|
||||||
|
<b>body</b> > <b>main</b>,
|
||||||
|
<b>body</b> > <b>footer</b> {
|
||||||
|
<em>…</em>
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
<p><strong>Usage:</strong></p>
|
<p><strong>Usage:</strong></p>
|
||||||
<p>Use the default <code>.classless</code> version if you need centered viewports:</p>
|
<p>Use the default <code>.classless</code> version if you need centered viewports:</p>
|
||||||
<pre><code><<b>link</b> <i>rel</i>=<u>"stylesheet</u>" <i>href</i>=<u>"css/pico.classless.min.css"</u>></code></pre>
|
<pre><code><<b>link</b> <i>rel</i>=<u>"stylesheet</u>" <i>href</i>=<u>"css/pico.classless.min.css"</u>></code></pre>
|
||||||
|
@ -37,8 +46,35 @@
|
||||||
<<b>link</b> <i>rel</i>=<u>"stylesheet"</u> <i>href</i>=<u>"https://unpkg.com/@picocss/pico@latest/css/pico.fluid.classless.min.css"</u>>
|
<<b>link</b> <i>rel</i>=<u>"stylesheet"</u> <i>href</i>=<u>"https://unpkg.com/@picocss/pico@latest/css/pico.fluid.classless.min.css"</u>>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
|
<p>If you need to customize the default parent (<code><<b>body</b>></code>) for <code><<b>header</b>></code>, <code><<b>main</b>></code>, and <code><<b>footer</b>></code>, you can recompile Pico by defining another CSS selector.</p>
|
||||||
|
<p>Useful for <a href="https://reactjs.org/">React</a>, <a href="https://reactjs.org/">Gatsby</a> or <a href="https://nextjs.org/">Next.js</a>.</p>
|
||||||
|
|
||||||
|
<pre><code><em>/* Custom Class-less version for React */</em>
|
||||||
|
|
||||||
|
<em>// Set the root element</em>
|
||||||
|
<i>$semantic-root-element</i>: <u>"#root"</u>;
|
||||||
|
|
||||||
|
<em>// Enable <header>, <main>, <footer> inside $semantic-root-element as containers</em>
|
||||||
|
<i>$enable-semantic-container</i>: <u>true</u>;
|
||||||
|
|
||||||
|
<em>// Enable .classes</em>
|
||||||
|
<i>$enable-classes</i>: <u>false</u>;
|
||||||
|
|
||||||
|
<em>// Import Pico</em>
|
||||||
|
<b>@import</b> <u>"@picocss/pico/scss/pico"</u>;</code></pre>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<p>The code above will compile Pico with the containers defined like this:</p>
|
||||||
|
|
||||||
|
<pre><code><em>// Containers</em></em>
|
||||||
|
<i>#root</i> > <b>header</b>,
|
||||||
|
<i>#root</i> > <b>main</b>,
|
||||||
|
<i>#root</i> > <b>footer</b> {
|
||||||
|
<em>…</em>
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
${require('./_footer.html')}
|
${require('./_footer.html')}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
// Config
|
// Config
|
||||||
// ––––––––––––––––––––
|
// ––––––––––––––––––––
|
||||||
|
|
||||||
// Enable <header>, <main>, <footer> inside <body> as a container
|
// Set the root element for $enable-semantic-container and $enable-responsive-spacings
|
||||||
|
$semantic-root-element: "body" !default;
|
||||||
|
|
||||||
|
// Enable <header>, <main>, <footer> inside $semantic-root-element as containers
|
||||||
$enable-semantic-container: false !default;
|
$enable-semantic-container: false !default;
|
||||||
|
|
||||||
// Enable .container and .container-fluid
|
// Enable .container and .container-fluid
|
||||||
$enable-class-container: true !default;
|
$enable-class-container: true !default;
|
||||||
|
|
||||||
// Enable a centered viewport for <header>, <main>, <footer> inside <body>
|
// Enable a centered viewport for <header>, <main>, <footer> inside $enable-semantic-container
|
||||||
// Fluid layout if disabled
|
// Fluid layout if disabled
|
||||||
$enable-viewport: true !default;
|
$enable-viewport: true !default;
|
||||||
|
|
||||||
|
@ -32,9 +35,6 @@ $enable-transitions: true !default;
|
||||||
// Enable overriding with !important
|
// Enable overriding with !important
|
||||||
$enable-important: true !default;
|
$enable-important: true !default;
|
||||||
|
|
||||||
// Set the root element for $enable-semantic-container and $enable-responsive-spacings
|
|
||||||
$semantic-root-element: "body" !default;
|
|
||||||
|
|
||||||
// Responsive
|
// Responsive
|
||||||
// ––––––––––––––––––––
|
// ––––––––––––––––––––
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Config
|
// Config
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|
||||||
// Enable <header>, <main>, <footer> inside <body> as a container
|
// Enable <header>, <main>, <footer> inside $semantic-root-element as containers
|
||||||
$enable-semantic-container: true;
|
$enable-semantic-container: true;
|
||||||
|
|
||||||
// Enable .classes
|
// Enable .classes
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Config
|
// Config
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|
||||||
// Enable <header>, <main>, <footer> inside <body> as a container
|
// Enable <header>, <main>, <footer> inside $semantic-root-element as containers
|
||||||
$enable-semantic-container: true;
|
$enable-semantic-container: true;
|
||||||
|
|
||||||
// Enable a centered viewport for <header>, <main>, <footer> inside <body>
|
// Enable a centered viewport for <header>, <main>, <footer> inside $enable-semantic-container
|
||||||
$enable-viewport: false;
|
$enable-viewport: false;
|
||||||
|
|
||||||
// Enable .classes
|
// Enable .classes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue