mirror of
https://github.com/picocss/pico.git
synced 2025-04-23 01:46:14 -04:00
Docs: Adapt the DOM and styles for code blocks #36
This commit is contained in:
parent
d64bb2343d
commit
b40a9277f2
7 changed files with 108 additions and 28 deletions
|
@ -153,11 +153,13 @@
|
|||
<input type="password" name="password" placeholder="Password" aria-label="Password" autocomplete="current-password" required>
|
||||
<button type="submit" aria-label="Example button" onclick="event.preventDefault()">Login</button>
|
||||
</form>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>article</b> <i>data-theme</i>=<u>"light"</u>>
|
||||
…
|
||||
</<b>article</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<article data-theme="dark" aria-label="Forced dark theme example">
|
||||
<h4>Dark theme</h4>
|
||||
|
@ -166,11 +168,13 @@
|
|||
<input type="password" name="password" placeholder="Password" aria-label="Password" autocomplete="current-password" required>
|
||||
<button type="submit" aria-label="Example button" onclick="event.preventDefault()">Login</button>
|
||||
</form>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>article</b> <i>data-theme</i>=<u>"dark"</u>>
|
||||
…
|
||||
</<b>article</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Themes -->
|
||||
|
||||
|
@ -197,6 +201,7 @@
|
|||
</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><em>// Simplified example</em>
|
||||
<b>:root</b> {
|
||||
|
@ -204,6 +209,7 @@
|
|||
}
|
||||
</code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>There are 2 ways to customize your version of Pico.css:</p>
|
||||
<h4>Overriding CSS variables</h4>
|
||||
|
@ -368,6 +374,7 @@
|
|||
<div>3</div>
|
||||
<div>4</div>
|
||||
</div>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>div</b> <i>class</i>=<u>"grid"</u>>
|
||||
<<b>div</b>>1</<b>div</b>>
|
||||
|
@ -376,6 +383,7 @@
|
|||
<<b>div</b>>4</<b>div</b>>
|
||||
</<b>div</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Columns intentionally collapses below large devices <code>(<u>992px</u>)</code></p>
|
||||
<p>To go further, discover how to <a href="https://picocss.com/examples/bootstrap-grid/">merge Pico with the Bootstrap grid system</a>.</p>
|
||||
|
@ -562,6 +570,7 @@
|
|||
<h4>Heading 4</h4>
|
||||
<h5>Heading 5</h5>
|
||||
<h6>Heading 6</h6>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>h1</b>>Heading 1</<b>h1</b>>
|
||||
<<b>h2</b>>Heading 2</<b>h2</b>>
|
||||
|
@ -570,6 +579,7 @@
|
|||
<<b>h5</b>>Heading 5</<b>h5</b>>
|
||||
<<b>h6</b>>Heading 6</<b>h6</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Inside a <code><<b>hgroup</b>></code> all <code><i>margin-bottom</i></code> are collapsed and the <code>:last-child</code> is muted.</p>
|
||||
<article aria-label="Hgroup example">
|
||||
|
@ -577,12 +587,14 @@
|
|||
<h2>Heading 2</h2>
|
||||
<h3>Subtitle for heading 2</h3>
|
||||
</hgroup>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>hgroup</b>>
|
||||
<<b>h2</b>>Heading 2</<b>h2</b>>
|
||||
<<b>h3</b>>Subtitle for heading 2</<b>h3</b>>
|
||||
<<b>hgroup</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Inline text elements:</p>
|
||||
<article aria-label="Inline text examples">
|
||||
|
@ -610,11 +622,13 @@
|
|||
<a href="#" onclick="event.preventDefault()">Primary</a><br>
|
||||
<a href="#" onclick="event.preventDefault()" class="secondary">Secondary</a><br>
|
||||
<a href="#" onclick="event.preventDefault()" class="contrast">Contrast</a><br>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>a</b> <i>href</i>=<u>"#"</u>>Primary</<b>a</b>>
|
||||
<<b>a</b> <i>href</i>=<u>"#"</u> <i>class</i>=<u>"secondary"</u>>Secondary</<b>a</b>>
|
||||
<<b>a</b> <i>href</i>=<u>"#"</u> <i>class</i>=<u>"contrast"</u>>Contrast</<b>a</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Blockquote:</p>
|
||||
<article aria-label="Blockquote example">
|
||||
|
@ -624,6 +638,7 @@
|
|||
<cite>- Phasellus eget lacinia</cite>
|
||||
</footer>
|
||||
</blockquote>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>blockquote</b>>
|
||||
"Maecenas vehicula metus tellus, vitae congue turpis hendrerit non. Nam at dui sit amet ipsum cursus ornare."
|
||||
|
@ -632,6 +647,7 @@
|
|||
</<b>footer</b>>
|
||||
</<b>blockquote</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Typography -->
|
||||
|
||||
|
@ -644,39 +660,47 @@
|
|||
<article aria-label="Button example">
|
||||
<button aria-label="Button">Button</button>
|
||||
<input type="submit">
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>button</b>>Button</<b>button</b>>
|
||||
<<b>input</b> <i>type</i>=<u>"submit"</u>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Buttons are <code><i>width</i>: <u>100%</u>;</code> by default. Use <code><<b>a</b> <i>role</i>=<u>"button"></u></code> if you need an inline element.</p>
|
||||
<article aria-label="Inline buttons examples">
|
||||
<a href="#" onclick="event.preventDefault()" role="button">Link</a>
|
||||
<a href="#" onclick="event.preventDefault()" role="button">Link</a>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u>>Link</<b>a</b>>
|
||||
<<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u>>Link</<b>a</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Buttons come with <code>.secondary</code> and <code>.contrast</code> styles.</p>
|
||||
<article aria-label="Buttons styles examples">
|
||||
<a href="#" onclick="event.preventDefault()" role="button" class="secondary">Secondary</a>
|
||||
<a href="#" onclick="event.preventDefault()" role="button" class="contrast">Contrast</a>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u> <i>class</i>=<u>"secondary"</u>>Secondary</<b>a</b>>
|
||||
<<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u> <i>class</i>=<u>"contrast"</u>>Contrast</<b>a</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>And a classic <code>.outline</code> variant.</p>
|
||||
<article aria-label="Outline style examples">
|
||||
<a href="#" onclick="event.preventDefault()" role="button" class="outline">Primary</a>
|
||||
<a href="#" onclick="event.preventDefault()" role="button" class="secondary outline">Secondary</a>
|
||||
<a href="#" onclick="event.preventDefault()" role="button" class="contrast outline">Contrast</a>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u> <i>class</i>=<u>"outline"</u>>Primary</<b>a</b>>
|
||||
<<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u> <i>class</i>=<u>"secondary outline"</u>>Secondary</<b>a</b>>
|
||||
<<b>a</b> <i>href</i>=<u>"#"</u> <i>role</i>=<u>"button"</u> <i>class</i>=<u>"contrast outline"</u>>Contrast</<b>a</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Button -->
|
||||
|
||||
|
@ -705,6 +729,7 @@
|
|||
<small>We'll never share your email with anyone else.</small>
|
||||
<button type="submit" aria-label="Example button" onclick="event.preventDefault()">Submit</button>
|
||||
</form>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>form</b>>
|
||||
|
||||
|
@ -734,6 +759,7 @@
|
|||
|
||||
</<b>form</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Disabled and validation states:</p>
|
||||
<article aria-label="Validation states examples">
|
||||
|
@ -743,12 +769,14 @@
|
|||
<input type="text" placeholder="Disabled" aria-label="Disabled" disabled>
|
||||
<input type="text" value="Readonly" aria-label="Readonly" readonly>
|
||||
</form>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>input</b> <i>type</i>=<u>"text"</u> <i>placeholder</i>=<u>"Valid"</u> <i>aria-invalid</i>=<u>"false"</u>>
|
||||
<<b>input</b> <i>type</i>=<u>"text"</u> <i>placeholder</i>=<u>"Invalid"</u> <i>aria-invalid</i>=<u>"true"</u>>
|
||||
<<b>input</b> <i>type</i>=<u>"text"</u> <i>placeholder</i>=<u>"Disabled"</u> <i>disabled</i>>
|
||||
<<b>input</b> <i>type</i>=<u>"text"</u> <i>value</i>=<u>"Readonly"</u> <i>readonly</i>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p><code><<b>fieldset</b>></code> are unstyled and act as a container for radios and checkboxes providing a consistent <code><i>margin-bottom</i></code> for the set.</p>
|
||||
<p><code><i>role</i>=<u>"switch"</u></code> on a <code><i>type</i>=<u>"checkbox"</u></code> enable a custom switch.</p>
|
||||
|
@ -789,6 +817,7 @@
|
|||
Publish on my profile
|
||||
</label>
|
||||
</fieldset>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><em><!-- Select --></em>
|
||||
<<b>label</b> <i>for</i>=<u>"fruit"</u>>Fruit</<b>label</b>>
|
||||
|
@ -830,6 +859,7 @@
|
|||
</<b>label</b>>
|
||||
</<b>fieldset</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>You can change a checkbox to indeterminate state by setting the <code><i>indeterminate</i></code> property to <code><u>true</u></code></p>
|
||||
<article aria-label="Indeterminate checkbox example">
|
||||
|
@ -838,11 +868,13 @@
|
|||
Select all
|
||||
</label>
|
||||
<script>document.getElementById('indeterminate-checkbox').indeterminate = true;</script>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>script</b>>
|
||||
<i>document</i>.<b>getElementById</b>(<u>'indeterminate-checkbox'</u>).<i>indeterminate</i> = <u>true</u>;
|
||||
</<b>script</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Others input types:</p>
|
||||
<article aria-label="File browser, range slider, date, time, color examples">
|
||||
|
@ -861,6 +893,7 @@
|
|||
<label for="color">Color
|
||||
<input type="color" id="color" name="color" value="#0eaaaa">
|
||||
</label>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><em><!-- File browser --></em>
|
||||
<<b>label</b> <i>for</i>=<u>"file"</u>>File browser
|
||||
|
@ -887,6 +920,7 @@
|
|||
<<b>input</b> <i>type</i>=<u>"color"</u> <i>id</i>=<u>"color"</u> <i>name</i>=<u>"color"</u> <i>value</i>=<u>"#0eaaaa"</u>>
|
||||
</<b>label</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Form -->
|
||||
|
||||
|
@ -1024,6 +1058,7 @@
|
|||
<li>Cras sed libero aliquet, porta dolor quis, dapibus ipsum.</li>
|
||||
</ul>
|
||||
</details>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>details</b>>
|
||||
<<b>summary</b>>Collapsible elements 1</<b>summary</b>>
|
||||
|
@ -1038,6 +1073,7 @@
|
|||
</<b>ul</b>>
|
||||
</<b>details</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Accordions -->
|
||||
|
||||
|
@ -1083,6 +1119,7 @@
|
|||
<li><a href="#" onclick="event.preventDefault()">Link</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>nav</b>>
|
||||
<<b>ul</b>>
|
||||
|
@ -1095,6 +1132,7 @@
|
|||
</<b>ul</b>>
|
||||
</<b>nav</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p><code><<b>ul</b>></code> are automatically distributed horizontally.</p>
|
||||
<p><code><<b>li</b>></code> are unstyled and inlined.</p>
|
||||
|
@ -1125,6 +1163,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>nav</b>>
|
||||
<<b>ul</b>>
|
||||
|
@ -1138,6 +1177,7 @@
|
|||
</<b>ul</b>>
|
||||
</<b>nav</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>Inside <code><<b>aside</b>></code>, navs are stacked vertically.</p>
|
||||
<article aria-label="Vertical nav example">
|
||||
|
@ -1150,6 +1190,7 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>aside</b>>
|
||||
<<b>nav</b>>
|
||||
|
@ -1161,6 +1202,7 @@
|
|||
</<b>nav</b>>
|
||||
</<b>aside</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Nav -->
|
||||
|
||||
|
@ -1172,19 +1214,23 @@
|
|||
</hgroup>
|
||||
<article aria-label="Progress bar example">
|
||||
<progress value="25" max="100"></progress>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>progress</b> <i>value</i>=<u>"25</u>" <i>max</i>=<u>"100"</u>></<b>progress</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>You can change a progress bar to indeterminate state by setting the <code><i>indeterminate</i></code> property to <code><u>true</u></code></p>
|
||||
<article aria-label="Indeterminate progress bar example">
|
||||
<progress id="indeterminate-progress"></progress>
|
||||
<script>document.getElementById('indeterminate-progress').indeterminate = true;</script>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>script</b>>
|
||||
<i>document</i>.<b>getElementById</b>(<u>'indeterminate-progress'</u>).<i>indeterminate</i> = <u>true</u>;
|
||||
</<b>script</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Progress -->
|
||||
|
||||
|
@ -1197,10 +1243,12 @@
|
|||
<article aria-label="Loading buttons example">
|
||||
<button aria-busy="true">Please wait…</button>
|
||||
<button aria-busy="true" class="secondary"></button>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>button</b> <i>aria-busy</i>=<u>"true"</u>>Please wait…</<b>button</b>>
|
||||
<<b>button</b> <i>aria-busy</i>=<u>"true"</u> <i>class</i>=<u>"secondary"</u>></<b>button</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
<p>It can be applied to any block:</p>
|
||||
<article aria-busy="true"></article>
|
||||
|
@ -1208,8 +1256,9 @@
|
|||
<p>Or any text element:</p>
|
||||
<article aria-label="Loading paragraph example">
|
||||
<a href="#" aria-busy="true" onclick="event.preventDefault()">Generating link, please wait…</a>
|
||||
<pre><code><<b>a</b> <i>href</i>=<u>"#"</u> <i>aria-busy</i>=<u>"true"</u>>Generating link, please wait…</<b>a</b>></code></pre>
|
||||
|
||||
<footer class="code">
|
||||
<pre><code><<b>a</b> <i>href</i>=<u>"#"</u> <i>aria-busy</i>=<u>"true"</u>>Generating link, please wait…</<b>a</b>></code></pre>
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Loading -->
|
||||
|
||||
|
@ -1223,11 +1272,13 @@
|
|||
<p>Tooltip on a <a href="#" onclick="event.preventDefault()" data-tooltip="Tooltip">link</a></p>
|
||||
<p>Tooltip on <em data-tooltip="Tooltip">inline element</em></p>
|
||||
<p><button data-tooltip="Tooltip" aria-label="Example button">Tooltip on a button</button></p>
|
||||
<footer class="code">
|
||||
|
||||
<pre><code><<b>p</b>>Tooltip on a <<b>a</b> <i>href</i>=<u>"#"</u> <i>data-tooltip</i>=<u>"Tooltip"</u>>link</<b>a</b>></<b>p</b>>
|
||||
<<b>p</b>>Tooltip on <<b>em</b> <i>data-tooltip</i>=<u>"Tooltip"</u>>inline element</<b>em</b>></<b>p</b>>
|
||||
<<b>p</b>><<b>button</b> <i>data-tooltip</i>=<u>"Tooltip"</u>>Tooltip on a button</<b>button</b>></<b>p</b>></code></pre>
|
||||
|
||||
</footer>
|
||||
</article>
|
||||
</section><!-- ./ Docs: Tooltips -->
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue