|
| 1 | ++++ |
| 2 | +author = "Hugo Authors" |
| 3 | +title = "HTML and CSS only tabs" |
| 4 | +date = "2022-05-15" |
| 5 | +description = "Sample article showcasing shortcodes for HTML/CSS only tabs" |
| 6 | +tags = [ |
| 7 | + "markdown", |
| 8 | + "css", |
| 9 | + "html", |
| 10 | +] |
| 11 | +categories = [ |
| 12 | + "themes", |
| 13 | + "syntax", |
| 14 | +] |
| 15 | +series = ["Themes Guide"] |
| 16 | +aliases = ["migrate-from-jekyl"] |
| 17 | ++++ |
| 18 | + |
| 19 | +## Basic shortcodes |
| 20 | + |
| 21 | +The following content: |
| 22 | + |
| 23 | +```markdown |
| 24 | +{{</* tabgroup */>}} |
| 25 | + {{</* tab name="Hello" */>}} |
| 26 | + Hello World! |
| 27 | + {{</* /tab */>}} |
| 28 | + |
| 29 | + {{</* tab name="Goodbye" */>}} |
| 30 | + Goodbye Everybody! |
| 31 | + {{</* /tab */>}} |
| 32 | +{{</* /tabgroup */>}} |
| 33 | +``` |
| 34 | + |
| 35 | +Will generate: |
| 36 | + |
| 37 | +{{< tabgroup >}} |
| 38 | + {{< tab name="Hello" >}} |
| 39 | + Hello World! |
| 40 | + {{< /tab >}} |
| 41 | + |
| 42 | + {{< tab name="Goodbye" >}} |
| 43 | + Goodbye Everybody! |
| 44 | + {{< /tab >}} |
| 45 | +{{< /tabgroup >}} |
| 46 | + |
| 47 | +## Right alighment |
| 48 | + |
| 49 | +You can also align the tabs to the right: |
| 50 | + |
| 51 | +```markdown |
| 52 | +{{</* tabgroup align="right" */>}} |
| 53 | + {{</* tab name="Hello" */>}} |
| 54 | + Hello World! |
| 55 | + {{</* /tab */>}} |
| 56 | + |
| 57 | + {{</* tab name="Goodbye" */>}} |
| 58 | + Goodbye Everybody! |
| 59 | + {{</* /tab */>}} |
| 60 | +{{</* /tabgroup */>}} |
| 61 | +``` |
| 62 | + |
| 63 | +Giving you this look: |
| 64 | + |
| 65 | +{{< tabgroup align="right" >}} |
| 66 | + {{< tab name="Hello" >}} |
| 67 | + Hello World! |
| 68 | + {{< /tab >}} |
| 69 | + |
| 70 | + {{< tab name="Goodbye" >}} |
| 71 | + Goodbye Everybody! |
| 72 | + {{< /tab >}} |
| 73 | +{{< /tabgroup >}} |
| 74 | + |
| 75 | +## Markdown content |
| 76 | + |
| 77 | +Any valid markdown can be used inside the tab: |
| 78 | + |
| 79 | +~~~markdown |
| 80 | +{{</* tabgroup align="right" style="code" */>}} |
| 81 | + {{</* tab name="Ruby" */>}} |
| 82 | + |
| 83 | +```ruby |
| 84 | +puts 'Hello' |
| 85 | +``` |
| 86 | + |
| 87 | + {{</* /tab */>}} |
| 88 | + {{</* tab name="Python" */>}} |
| 89 | + |
| 90 | +```python |
| 91 | +print('Hello') |
| 92 | +``` |
| 93 | + |
| 94 | + {{</* /tab */>}} |
| 95 | + {{</* tab name="JavaScript" */>}} |
| 96 | + |
| 97 | +```js |
| 98 | +console.log('Hello') |
| 99 | +``` |
| 100 | + |
| 101 | + {{</* /tab */>}} |
| 102 | +{{</* /tabgroup */>}} |
| 103 | + |
| 104 | +~~~ |
| 105 | + |
| 106 | +And you get this lovely content: |
| 107 | + |
| 108 | +{{< tabgroup align="right" style="code" >}} |
| 109 | + {{< tab name="Ruby" >}} |
| 110 | + |
| 111 | +```ruby |
| 112 | +puts 'Hello' |
| 113 | +``` |
| 114 | + |
| 115 | + {{< /tab >}} |
| 116 | + {{< tab name="Python" >}} |
| 117 | + |
| 118 | +```python |
| 119 | +print('Hello') |
| 120 | +``` |
| 121 | + |
| 122 | + {{< /tab >}} |
| 123 | + {{< tab name="JavaScript" >}} |
| 124 | + |
| 125 | +```js |
| 126 | +console.log('Hello') |
| 127 | +``` |
| 128 | + |
| 129 | + {{< /tab >}} |
| 130 | +{{< /tabgroup >}} |
| 131 | + |
| 132 | +In this case `style="code"` makes it look a little nicer for scenarios where |
| 133 | +your content purely a code block. |
0 commit comments