mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
176 lines
8.3 KiB
HTML
176 lines
8.3 KiB
HTML
---
|
|
layout: default
|
|
title: Ghost UI · Making publishing beautiful.
|
|
---
|
|
|
|
<header class="page-header">
|
|
<a class="menu-button" href="#"><span class="sr-only">Menu</span></a>
|
|
<h2>Home</h2>
|
|
</header>
|
|
|
|
<section class="page-content">
|
|
|
|
<div class="bs-docs-section">
|
|
<h1 id="buttons">Buttons</h1>
|
|
|
|
<h2 id="buttons-options">Options</h2>
|
|
<p>Use any of the available button classes to quickly create a styled button.</p>
|
|
<div class="bs-example">
|
|
<button type="button" class="btn btn-default">Default</button>
|
|
<button type="button" class="btn btn-blue">Blue</button>
|
|
<button type="button" class="btn btn-green">Green</button>
|
|
<button type="button" class="btn btn-red">Red</button>
|
|
<button type="button" class="btn btn-link">Link</button>
|
|
</div>
|
|
{% highlight html %}
|
|
<!-- Standard button -->
|
|
<button type="button" class="btn btn-default">Default</button>
|
|
|
|
<!-- Provides extra visual weight and identifies the Blue action in a set of buttons -->
|
|
<button type="button" class="btn btn-blue">Blue</button>
|
|
|
|
<!-- Indicates a Greenful or positive action -->
|
|
<button type="button" class="btn btn-green">Green</button>
|
|
|
|
<!-- Indicates a Redous or potentially negative action -->
|
|
<button type="button" class="btn btn-red">Red</button>
|
|
|
|
<!-- Deemphasize a button by making it look like a link while maintaining button behavior -->
|
|
<button type="button" class="btn btn-link">Link</button>
|
|
{% endhighlight %}
|
|
|
|
<h2 id="buttons-sizes">Sizes</h2>
|
|
<p>Fancy larger or smaller buttons? Add <code>.btn-lg</code>, <code>.btn-sm</code>, or <code>.btn-xs</code> for additional sizes.</p>
|
|
<div class="bs-example">
|
|
<p>
|
|
<button type="button" class="btn btn-blue btn-lg">Large button</button>
|
|
<button type="button" class="btn btn-default btn-lg">Large button</button>
|
|
</p>
|
|
<p>
|
|
<button type="button" class="btn btn-blue">Default button</button>
|
|
<button type="button" class="btn btn-default">Default button</button>
|
|
</p>
|
|
<p>
|
|
<button type="button" class="btn btn-blue btn-sm">Small button</button>
|
|
<button type="button" class="btn btn-default btn-sm">Small button</button>
|
|
</p>
|
|
</div>
|
|
{% highlight html %}
|
|
<p>
|
|
<button type="button" class="btn btn-blue btn-lg">Large button</button>
|
|
<button type="button" class="btn btn-default btn-lg">Large button</button>
|
|
</p>
|
|
<p>
|
|
<button type="button" class="btn btn-blue">Default button</button>
|
|
<button type="button" class="btn btn-default">Default button</button>
|
|
</p>
|
|
<p>
|
|
<button type="button" class="btn btn-blue btn-sm">Small button</button>
|
|
<button type="button" class="btn btn-default btn-sm">Small button</button>
|
|
</p>
|
|
{% endhighlight %}
|
|
|
|
<p>Create block level buttons—those that span the full width of a parent— by adding <code>.btn-block</code>.</p>
|
|
<div class="bs-example">
|
|
<div class="well" style="max-width: 400px; margin: 0 auto 10px;">
|
|
<button type="button" class="btn btn-blue btn-lg btn-block">Block level button</button>
|
|
<button type="button" class="btn btn-default btn-lg btn-block">Block level button</button>
|
|
</div>
|
|
</div>
|
|
{% highlight html %}
|
|
<button type="button" class="btn btn-blue btn-lg btn-block">Block level button</button>
|
|
<button type="button" class="btn btn-default btn-lg btn-block">Block level button</button>
|
|
{% endhighlight %}
|
|
|
|
|
|
<h2 id="buttons-active">Active state</h2>
|
|
<p>Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. For <code><button></code> elements, this is done via <code>:active</code>. For <code><a></code> elements, it's done with <code>.active</code>. However, you may use <code>.active</code> on <code><button></code>s should you need to replicate the active state programmatically.</p>
|
|
|
|
<h3>Button element</h3>
|
|
<p>No need to add <code>:active</code> as it's a pseudo-class, but if you need to force the same appearance, go ahead and add <code>.active</code>.</p>
|
|
<p class="bs-example">
|
|
<button type="button" class="btn btn-blue btn-lg active">Blue button</button>
|
|
<button type="button" class="btn btn-default btn-lg active">Button</button>
|
|
</p>
|
|
{% highlight html %}
|
|
<button type="button" class="btn btn-blue btn-lg active">Blue button</button>
|
|
<button type="button" class="btn btn-default btn-lg active">Button</button>
|
|
{% endhighlight %}
|
|
|
|
<h3>Anchor element</h3>
|
|
<p>Add the <code>.active</code> class to <code><a></code> buttons.</p>
|
|
<p class="bs-example">
|
|
<a href="#" class="btn btn-blue btn-lg active" role="button">Blue link</a>
|
|
<a href="#" class="btn btn-link btn-lg active" role="button">Link</a>
|
|
</p>
|
|
{% highlight html %}
|
|
<a href="#" class="btn btn-blue btn-lg active" role="button">Blue link</a>
|
|
<a href="#" class="btn btn-link btn-lg active" role="button">Link</a>
|
|
{% endhighlight %}
|
|
|
|
|
|
<h2 id="buttons-disabled">Disabled state</h2>
|
|
<p>Make buttons look unclickable by fading them back 50%.</p>
|
|
|
|
<h3>Button element</h3>
|
|
<p>Add the <code>disabled</code> attribute to <code><button></code> buttons.</p>
|
|
<p class="bs-example">
|
|
<button type="button" class="btn btn-blue btn-lg" disabled="disabled">Blue button</button>
|
|
<button type="button" class="btn btn-default btn-lg" disabled="disabled">Button</button>
|
|
</p>
|
|
{% highlight html %}
|
|
<button type="button" class="btn btn-lg btn-blue" disabled="disabled">Blue button</button>
|
|
<button type="button" class="btn btn-default btn-lg" disabled="disabled">Button</button>
|
|
{% endhighlight %}
|
|
|
|
<div class="bs-callout bs-callout-Red">
|
|
<h4>Cross-browser compatibility</h4>
|
|
<p>If you add the <code>disabled</code> attribute to a <code><button></code>, Internet Explorer 9 and below will render text gray with a nasty text-shadow that we cannot fix.</p>
|
|
</div>
|
|
|
|
<h3>Anchor element</h3>
|
|
<p>Add the <code>.disabled</code> class to <code><a></code> buttons.</p>
|
|
<p class="bs-example">
|
|
<a href="#" class="btn btn-blue btn-lg disabled" role="button">Blue link</a>
|
|
<a href="#" class="btn btn-default btn-lg disabled" role="button">Link</a>
|
|
</p>
|
|
{% highlight html %}
|
|
<a href="#" class="btn btn-blue btn-lg disabled" role="button">Blue link</a>
|
|
<a href="#" class="btn btn-default btn-lg disabled" role="button">Link</a>
|
|
{% endhighlight %}
|
|
<p>
|
|
We use <code>.disabled</code> as a utility class here, similar to the common <code>.active</code> class, so no prefix is required.
|
|
</p>
|
|
<div class="bs-callout bs-callout-warning">
|
|
<h4>Link functionality caveat</h4>
|
|
<p>This class uses <code>pointer-events: none</code> to try to disable the link functionality of <code><a></code>s, but that CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 11. So to be safe, use custom JavaScript to disable such links.</p>
|
|
</div>
|
|
<div class="bs-callout bs-callout-warning">
|
|
<h4>Context-specific usage</h4>
|
|
<p>While button classes can be used on <code><a></code> and <code><button></code> elements, only <code><button></code> elements are supported within our nav and navbar components.</p>
|
|
</div>
|
|
|
|
|
|
<h2 id="buttons-tags">Button tags</h2>
|
|
<p>Use the button classes on an <code><a></code>, <code><button></code>, or <code><input></code> element.</p>
|
|
<form class="bs-example">
|
|
<a class="btn btn-default" href="#" role="button">Link</a>
|
|
<button class="btn btn-default" type="submit">Button</button>
|
|
<input class="btn btn-default" type="button" value="Input">
|
|
<input class="btn btn-default" type="submit" value="Submit">
|
|
</form>
|
|
{% highlight html %}
|
|
<a class="btn btn-default" href="#" role="button">Link</a>
|
|
<button class="btn btn-default" type="submit">Button</button>
|
|
<input class="btn btn-default" type="button" value="Input">
|
|
<input class="btn btn-default" type="submit" value="Submit">
|
|
{% endhighlight %}
|
|
|
|
<div class="bs-callout bs-callout-warning">
|
|
<h4>Cross-browser rendering</h4>
|
|
<p>As a best practice, <strong>we highly recommend using the <code><button></code> element whenever possible</strong> to ensure matching cross-browser rendering.</p>
|
|
<p>Among other things, there's <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=697451">a bug in Firefox <30</a> that prevents us from setting the <code>line-height</code> of <code><input></code>-based buttons, causing them to not exactly match the height of other buttons on Firefox.</p>
|
|
</div>
|
|
</div>
|
|
|
|
</section> |