Jump to content

Tailwind CSS

From Simple English Wikipedia, the free encyclopedia
Tailwind CSS logo since v1


Tailwind CSS is an open source CSS library, and their main feature is that they use utility CSS classes that can be mixed and matched and unlike most other CSS libraries such as Bootstrap, there is no predefined classes.[1][2]

Tailwind CSS examples

[change | change source]

To make a button in Tailwind CSS you would use this HTML code:

<!--The style and script tags at the top are for offline mode users-->
<style>
    /* ! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com */*,
::after,
::before {
 box-sizing:border-box;
 border-width:0;
 border-style:solid;
 border-color:#e5e7eb
}
::after,
::before {
 --tw-content:''
}
:host,
html {
 line-height:1.5;
 -webkit-text-size-adjust:100%;
 -moz-tab-size:4;
 tab-size:4;
 font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
 font-feature-settings:normal;
 font-variation-settings:normal;
 -webkit-tap-highlight-color:transparent
}
body {
 margin:0;
 line-height:inherit
}
hr {
 height:0;
 color:inherit;
 border-top-width:1px
}
abbr:where([title]) {
 -webkit-text-decoration:underline dotted;
 text-decoration:underline dotted
}
h1,
h2,
h3,
h4,
h5,
h6 {
 font-size:inherit;
 font-weight:inherit
}
a {
 color:inherit;
 text-decoration:inherit
}
b,
strong {
 font-weight:bolder
}
code,
kbd,
pre,
samp {
 font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
 font-feature-settings:normal;
 font-variation-settings:normal;
 font-size:1em
}
small {
 font-size:80%
}
sub,
sup {
 font-size:75%;
 line-height:0;
 position:relative;
 vertical-align:baseline
}
sub {
 bottom:-.25em
}
sup {
 top:-.5em
}
table {
 text-indent:0;
 border-color:inherit;
 border-collapse:collapse
}
button,
input,
optgroup,
select,
textarea {
 font-family:inherit;
 font-feature-settings:inherit;
 font-variation-settings:inherit;
 font-size:100%;
 font-weight:inherit;
 line-height:inherit;
 color:inherit;
 margin:0;
 padding:0
}
button,
select {
 text-transform:none
}
[type=button],
[type=reset],
[type=submit],
button {
 -webkit-appearance:button;
 background-color:transparent;
 background-image:none
}
:-moz-focusring {
 outline:auto
}
:-moz-ui-invalid {
 box-shadow:none
}
progress {
 vertical-align:baseline
}
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
 height:auto
}
[type=search] {
 -webkit-appearance:textfield;
 outline-offset:-2px
}
::-webkit-search-decoration {
 -webkit-appearance:none
}
::-webkit-file-upload-button {
 -webkit-appearance:button;
 font:inherit
}
summary {
 display:list-item
}
blockquote,
dd,
dl,
figure,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
p,
pre {
 margin:0
}
fieldset {
 margin:0;
 padding:0
}
legend {
 padding:0
}
menu,
ol,
ul {
 list-style:none;
 margin:0;
 padding:0
}
dialog {
 padding:0
}
textarea {
 resize:vertical
}
input::placeholder,
textarea::placeholder {
 opacity:1;
 color:#9ca3af
}
[role=button],
button {
 cursor:pointer
}
:disabled {
 cursor:default
}
audio,
canvas,
embed,
iframe,
img,
object,
svg,
video {
 display:block;
 vertical-align:middle
}
img,
video {
 max-width:100%;
 height:auto
}
[hidden] {
 display:none
}
*,
::before,
::after {
 --tw-border-spacing-x:0;
 --tw-border-spacing-y:0;
 --tw-translate-x:0;
 --tw-translate-y:0;
 --tw-rotate:0;
 --tw-skew-x:0;
 --tw-skew-y:0;
 --tw-scale-x:1;
 --tw-scale-y:1;
 --tw-pan-x: ;
 --tw-pan-y: ;
 --tw-pinch-zoom: ;
 --tw-scroll-snap-strictness:proximity;
 --tw-gradient-from-position: ;
 --tw-gradient-via-position: ;
 --tw-gradient-to-position: ;
 --tw-ordinal: ;
 --tw-slashed-zero: ;
 --tw-numeric-figure: ;
 --tw-numeric-spacing: ;
 --tw-numeric-fraction: ;
 --tw-ring-inset: ;
 --tw-ring-offset-width:0px;
 --tw-ring-offset-color:#fff;
 --tw-ring-color:rgb(59 130 246 / 0.5);
 --tw-ring-offset-shadow:0 0 #0000;
 --tw-ring-shadow:0 0 #0000;
 --tw-shadow:0 0 #0000;
 --tw-shadow-colored:0 0 #0000;
 --tw-blur: ;
 --tw-brightness: ;
 --tw-contrast: ;
 --tw-grayscale: ;
 --tw-hue-rotate: ;
 --tw-invert: ;
 --tw-saturate: ;
 --tw-sepia: ;
 --tw-drop-shadow: ;
 --tw-backdrop-blur: ;
 --tw-backdrop-brightness: ;
 --tw-backdrop-contrast: ;
 --tw-backdrop-grayscale: ;
 --tw-backdrop-hue-rotate: ;
 --tw-backdrop-invert: ;
 --tw-backdrop-opacity: ;
 --tw-backdrop-saturate: ;
 --tw-backdrop-sepia: 
}
::backdrop {
 --tw-border-spacing-x:0;
 --tw-border-spacing-y:0;
 --tw-translate-x:0;
 --tw-translate-y:0;
 --tw-rotate:0;
 --tw-skew-x:0;
 --tw-skew-y:0;
 --tw-scale-x:1;
 --tw-scale-y:1;
 --tw-pan-x: ;
 --tw-pan-y: ;
 --tw-pinch-zoom: ;
 --tw-scroll-snap-strictness:proximity;
 --tw-gradient-from-position: ;
 --tw-gradient-via-position: ;
 --tw-gradient-to-position: ;
 --tw-ordinal: ;
 --tw-slashed-zero: ;
 --tw-numeric-figure: ;
 --tw-numeric-spacing: ;
 --tw-numeric-fraction: ;
 --tw-ring-inset: ;
 --tw-ring-offset-width:0px;
 --tw-ring-offset-color:#fff;
 --tw-ring-color:rgb(59 130 246 / 0.5);
 --tw-ring-offset-shadow:0 0 #0000;
 --tw-ring-shadow:0 0 #0000;
 --tw-shadow:0 0 #0000;
 --tw-shadow-colored:0 0 #0000;
 --tw-blur: ;
 --tw-brightness: ;
 --tw-contrast: ;
 --tw-grayscale: ;
 --tw-hue-rotate: ;
 --tw-invert: ;
 --tw-saturate: ;
 --tw-sepia: ;
 --tw-drop-shadow: ;
 --tw-backdrop-blur: ;
 --tw-backdrop-brightness: ;
 --tw-backdrop-contrast: ;
 --tw-backdrop-grayscale: ;
 --tw-backdrop-hue-rotate: ;
 --tw-backdrop-invert: ;
 --tw-backdrop-opacity: ;
 --tw-backdrop-saturate: ;
 --tw-backdrop-sepia: 
}
.sr-only {
 position:absolute;
 width:1px;
 height:1px;
 padding:0;
 margin:-1px;
 overflow:hidden;
 clip:rect(0, 0, 0, 0);
 white-space:nowrap;
 border-width:0
}
.mx-auto {
 margin-left:auto;
 margin-right:auto
}
.mt-4 {
 margin-top:1rem
}
.block {
 display:block
}
.flex {
 display:flex
}
.inline-flex {
 display:inline-flex
}
.hidden {
 display:none
}
.h-10 {
 height:2.5rem
}
.h-5 {
 height:1.25rem
}
.h-8 {
 height:2rem
}
.w-10 {
 width:2.5rem
}
.w-5 {
 width:1.25rem
}
.w-full {
 width:100%
}
.max-w-screen-xl {
 max-width:1280px
}
.flex-col {
 flex-direction:column
}
.flex-wrap {
 flex-wrap:wrap
}
.items-center {
 align-items:center
}
.justify-center {
 justify-content:center
}
.justify-between {
 justify-content:space-between
}
.space-x-3 > :not([hidden]) ~ :not([hidden]) {
 --tw-space-x-reverse:0;
 margin-right:calc(0.75rem * var(--tw-space-x-reverse));
 margin-left:calc(0.75rem * calc(1 - var(--tw-space-x-reverse)))
}
.rounded {
 border-radius:0.25rem
}
.rounded-lg {
 border-radius:0.5rem
}
.border {
 border-width:1px
}
.border-gray-100 {
 --tw-border-opacity:1;
 border-color:rgb(243 244 246 / var(--tw-border-opacity))
}
.border-gray-200 {
 --tw-border-opacity:1;
 border-color:rgb(229 231 235 / var(--tw-border-opacity))
}
.bg-blue-700 {
 --tw-bg-opacity:1;
 background-color:rgb(29 78 216 / var(--tw-bg-opacity))
}
.bg-gray-50 {
 --tw-bg-opacity:1;
 background-color:rgb(249 250 251 / var(--tw-bg-opacity))
}
.bg-white {
 --tw-bg-opacity:1;
 background-color:rgb(255 255 255 / var(--tw-bg-opacity))
}
.p-2 {
 padding:0.5rem
}
.p-4 {
 padding:1rem
}
.px-3 {
 padding-left:0.75rem;
 padding-right:0.75rem
}
.py-2 {
 padding-top:0.5rem;
 padding-bottom:0.5rem
}
.text-sm {
 font-size:0.875rem;
 line-height:1.25rem
}
.font-medium {
 font-weight:500
}
.text-gray-500 {
 --tw-text-opacity:1;
 color:rgb(107 114 128 / var(--tw-text-opacity))
}
.text-gray-900 {
 --tw-text-opacity:1;
 color:rgb(17 24 39 / var(--tw-text-opacity))
}
.text-white {
 --tw-text-opacity:1;
 color:rgb(255 255 255 / var(--tw-text-opacity))
}
.hover\:bg-gray-100:hover {
 --tw-bg-opacity:1;
 background-color:rgb(243 244 246 / var(--tw-bg-opacity))
}
.focus\:outline-none:focus {
 outline:2px solid transparent;
 outline-offset:2px
}
.focus\:ring-2:focus {
 --tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
 --tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
 box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
}
.focus\:ring-gray-200:focus {
 --tw-ring-opacity:1;
 --tw-ring-color:rgb(229 231 235 / var(--tw-ring-opacity))
}
@media (min-width: 768px) {
 .md\:mt-0 {
  margin-top:0px
 }
 .md\:block {
  display:block
 }
 .md\:hidden {
  display:none
 }
 .md\:w-auto {
  width:auto
 }
 .md\:flex-row {
  flex-direction:row
 }
 .md\:space-x-8 > :not([hidden]) ~ :not([hidden]) {
  --tw-space-x-reverse:0;
  margin-right:calc(2rem * var(--tw-space-x-reverse));
  margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))
 }
 .md\:border-0 {
  border-width:0px
 }
 .md\:bg-transparent {
  background-color:transparent
 }
 .md\:bg-white {
  --tw-bg-opacity:1;
  background-color:rgb(255 255 255 / var(--tw-bg-opacity))
 }
 .md\:p-0 {
  padding:0px
 }
 .md\:text-blue-700 {
  --tw-text-opacity:1;
  color:rgb(29 78 216 / var(--tw-text-opacity))
 }
 .md\:hover\:bg-transparent:hover {
  background-color:transparent
 }
 .md\:hover\:text-blue-700:hover {
  --tw-text-opacity:1;
  color:rgb(29 78 216 / var(--tw-text-opacity))
 }
}
.rtl\:space-x-reverse:where([dir="rtl"],
[dir="rtl"] *) > :not([hidden]) ~ :not([hidden]) {
 --tw-space-x-reverse:1
}
@media (prefers-color-scheme: dark) {
 .dark\:border-gray-700 {
  --tw-border-opacity:1;
  border-color:rgb(55 65 81 / var(--tw-border-opacity))
 }
 .dark\:bg-gray-800 {
  --tw-bg-opacity:1;
  background-color:rgb(31 41 55 / var(--tw-bg-opacity))
 }
 .dark\:bg-gray-900 {
  --tw-bg-opacity:1;
  background-color:rgb(17 24 39 / var(--tw-bg-opacity))
 }
 .dark\:text-gray-400 {
  --tw-text-opacity:1;
  color:rgb(156 163 175 / var(--tw-text-opacity))
 }
 .dark\:text-white {
  --tw-text-opacity:1;
  color:rgb(255 255 255 / var(--tw-text-opacity))
 }
 .dark\:hover\:bg-gray-700:hover {
  --tw-bg-opacity:1;
  background-color:rgb(55 65 81 / var(--tw-bg-opacity))
 }
 .dark\:hover\:text-white:hover {
  --tw-text-opacity:1;
  color:rgb(255 255 255 / var(--tw-text-opacity))
 }
 .dark\:focus\:ring-gray-600:focus {
  --tw-ring-opacity:1;
  --tw-ring-color:rgb(75 85 99 / var(--tw-ring-opacity))
 }
}
@media (min-width: 768px) {
 @media (prefers-color-scheme: dark) {
  .md\:dark\:bg-gray-900 {
   --tw-bg-opacity:1;
   background-color:rgb(17 24 39 / var(--tw-bg-opacity))
  }
  .md\:dark\:text-blue-500 {
   --tw-text-opacity:1;
   color:rgb(59 130 246 / var(--tw-text-opacity))
  }
  .md\:dark\:hover\:bg-transparent:hover {
   background-color:transparent
  }
  .md\:dark\:hover\:text-blue-500:hover {
   --tw-text-opacity:1;
   color:rgb(59 130 246 / var(--tw-text-opacity))
  }
 }
}

</style>
<script src="https://cdn.tailwindcss.com"></script>
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
  Button
</button>

This will create a slightly rounded button that is filled in blue with the text "Button" inside it.

Result:

Tailwindbutton

To make a navbar in Tailwind CSS you would use this HTML code:

<!--The style and script tags at the top are for offline mode users-->
<style>
    /* ! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com */*,
::after,
::before {
 box-sizing:border-box;
 border-width:0;
 border-style:solid;
 border-color:#e5e7eb
}
::after,
::before {
 --tw-content:''
}
:host,
html {
 line-height:1.5;
 -webkit-text-size-adjust:100%;
 -moz-tab-size:4;
 tab-size:4;
 font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
 font-feature-settings:normal;
 font-variation-settings:normal;
 -webkit-tap-highlight-color:transparent
}
body {
 margin:0;
 line-height:inherit
}
hr {
 height:0;
 color:inherit;
 border-top-width:1px
}
abbr:where([title]) {
 -webkit-text-decoration:underline dotted;
 text-decoration:underline dotted
}
h1,
h2,
h3,
h4,
h5,
h6 {
 font-size:inherit;
 font-weight:inherit
}
a {
 color:inherit;
 text-decoration:inherit
}
b,
strong {
 font-weight:bolder
}
code,
kbd,
pre,
samp {
 font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
 font-feature-settings:normal;
 font-variation-settings:normal;
 font-size:1em
}
small {
 font-size:80%
}
sub,
sup {
 font-size:75%;
 line-height:0;
 position:relative;
 vertical-align:baseline
}
sub {
 bottom:-.25em
}
sup {
 top:-.5em
}
table {
 text-indent:0;
 border-color:inherit;
 border-collapse:collapse
}
button,
input,
optgroup,
select,
textarea {
 font-family:inherit;
 font-feature-settings:inherit;
 font-variation-settings:inherit;
 font-size:100%;
 font-weight:inherit;
 line-height:inherit;
 color:inherit;
 margin:0;
 padding:0
}
button,
select {
 text-transform:none
}
[type=button],
[type=reset],
[type=submit],
button {
 -webkit-appearance:button;
 background-color:transparent;
 background-image:none
}
:-moz-focusring {
 outline:auto
}
:-moz-ui-invalid {
 box-shadow:none
}
progress {
 vertical-align:baseline
}
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
 height:auto
}
[type=search] {
 -webkit-appearance:textfield;
 outline-offset:-2px
}
::-webkit-search-decoration {
 -webkit-appearance:none
}
::-webkit-file-upload-button {
 -webkit-appearance:button;
 font:inherit
}
summary {
 display:list-item
}
blockquote,
dd,
dl,
figure,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
p,
pre {
 margin:0
}
fieldset {
 margin:0;
 padding:0
}
legend {
 padding:0
}
menu,
ol,
ul {
 list-style:none;
 margin:0;
 padding:0
}
dialog {
 padding:0
}
textarea {
 resize:vertical
}
input::placeholder,
textarea::placeholder {
 opacity:1;
 color:#9ca3af
}
[role=button],
button {
 cursor:pointer
}
:disabled {
 cursor:default
}
audio,
canvas,
embed,
iframe,
img,
object,
svg,
video {
 display:block;
 vertical-align:middle
}
img,
video {
 max-width:100%;
 height:auto
}
[hidden] {
 display:none
}
*,
::before,
::after {
 --tw-border-spacing-x:0;
 --tw-border-spacing-y:0;
 --tw-translate-x:0;
 --tw-translate-y:0;
 --tw-rotate:0;
 --tw-skew-x:0;
 --tw-skew-y:0;
 --tw-scale-x:1;
 --tw-scale-y:1;
 --tw-pan-x: ;
 --tw-pan-y: ;
 --tw-pinch-zoom: ;
 --tw-scroll-snap-strictness:proximity;
 --tw-gradient-from-position: ;
 --tw-gradient-via-position: ;
 --tw-gradient-to-position: ;
 --tw-ordinal: ;
 --tw-slashed-zero: ;
 --tw-numeric-figure: ;
 --tw-numeric-spacing: ;
 --tw-numeric-fraction: ;
 --tw-ring-inset: ;
 --tw-ring-offset-width:0px;
 --tw-ring-offset-color:#fff;
 --tw-ring-color:rgb(59 130 246 / 0.5);
 --tw-ring-offset-shadow:0 0 #0000;
 --tw-ring-shadow:0 0 #0000;
 --tw-shadow:0 0 #0000;
 --tw-shadow-colored:0 0 #0000;
 --tw-blur: ;
 --tw-brightness: ;
 --tw-contrast: ;
 --tw-grayscale: ;
 --tw-hue-rotate: ;
 --tw-invert: ;
 --tw-saturate: ;
 --tw-sepia: ;
 --tw-drop-shadow: ;
 --tw-backdrop-blur: ;
 --tw-backdrop-brightness: ;
 --tw-backdrop-contrast: ;
 --tw-backdrop-grayscale: ;
 --tw-backdrop-hue-rotate: ;
 --tw-backdrop-invert: ;
 --tw-backdrop-opacity: ;
 --tw-backdrop-saturate: ;
 --tw-backdrop-sepia: 
}
::backdrop {
 --tw-border-spacing-x:0;
 --tw-border-spacing-y:0;
 --tw-translate-x:0;
 --tw-translate-y:0;
 --tw-rotate:0;
 --tw-skew-x:0;
 --tw-skew-y:0;
 --tw-scale-x:1;
 --tw-scale-y:1;
 --tw-pan-x: ;
 --tw-pan-y: ;
 --tw-pinch-zoom: ;
 --tw-scroll-snap-strictness:proximity;
 --tw-gradient-from-position: ;
 --tw-gradient-via-position: ;
 --tw-gradient-to-position: ;
 --tw-ordinal: ;
 --tw-slashed-zero: ;
 --tw-numeric-figure: ;
 --tw-numeric-spacing: ;
 --tw-numeric-fraction: ;
 --tw-ring-inset: ;
 --tw-ring-offset-width:0px;
 --tw-ring-offset-color:#fff;
 --tw-ring-color:rgb(59 130 246 / 0.5);
 --tw-ring-offset-shadow:0 0 #0000;
 --tw-ring-shadow:0 0 #0000;
 --tw-shadow:0 0 #0000;
 --tw-shadow-colored:0 0 #0000;
 --tw-blur: ;
 --tw-brightness: ;
 --tw-contrast: ;
 --tw-grayscale: ;
 --tw-hue-rotate: ;
 --tw-invert: ;
 --tw-saturate: ;
 --tw-sepia: ;
 --tw-drop-shadow: ;
 --tw-backdrop-blur: ;
 --tw-backdrop-brightness: ;
 --tw-backdrop-contrast: ;
 --tw-backdrop-grayscale: ;
 --tw-backdrop-hue-rotate: ;
 --tw-backdrop-invert: ;
 --tw-backdrop-opacity: ;
 --tw-backdrop-saturate: ;
 --tw-backdrop-sepia: 
}
.sr-only {
 position:absolute;
 width:1px;
 height:1px;
 padding:0;
 margin:-1px;
 overflow:hidden;
 clip:rect(0, 0, 0, 0);
 white-space:nowrap;
 border-width:0
}
.mx-auto {
 margin-left:auto;
 margin-right:auto
}
.mt-4 {
 margin-top:1rem
}
.block {
 display:block
}
.flex {
 display:flex
}
.inline-flex {
 display:inline-flex
}
.hidden {
 display:none
}
.h-10 {
 height:2.5rem
}
.h-5 {
 height:1.25rem
}
.h-8 {
 height:2rem
}
.w-10 {
 width:2.5rem
}
.w-5 {
 width:1.25rem
}
.w-full {
 width:100%
}
.max-w-screen-xl {
 max-width:1280px
}
.flex-col {
 flex-direction:column
}
.flex-wrap {
 flex-wrap:wrap
}
.items-center {
 align-items:center
}
.justify-center {
 justify-content:center
}
.justify-between {
 justify-content:space-between
}
.space-x-3 > :not([hidden]) ~ :not([hidden]) {
 --tw-space-x-reverse:0;
 margin-right:calc(0.75rem * var(--tw-space-x-reverse));
 margin-left:calc(0.75rem * calc(1 - var(--tw-space-x-reverse)))
}
.rounded {
 border-radius:0.25rem
}
.rounded-lg {
 border-radius:0.5rem
}
.border {
 border-width:1px
}
.border-gray-100 {
 --tw-border-opacity:1;
 border-color:rgb(243 244 246 / var(--tw-border-opacity))
}
.border-gray-200 {
 --tw-border-opacity:1;
 border-color:rgb(229 231 235 / var(--tw-border-opacity))
}
.bg-blue-700 {
 --tw-bg-opacity:1;
 background-color:rgb(29 78 216 / var(--tw-bg-opacity))
}
.bg-gray-50 {
 --tw-bg-opacity:1;
 background-color:rgb(249 250 251 / var(--tw-bg-opacity))
}
.bg-white {
 --tw-bg-opacity:1;
 background-color:rgb(255 255 255 / var(--tw-bg-opacity))
}
.p-2 {
 padding:0.5rem
}
.p-4 {
 padding:1rem
}
.px-3 {
 padding-left:0.75rem;
 padding-right:0.75rem
}
.py-2 {
 padding-top:0.5rem;
 padding-bottom:0.5rem
}
.text-sm {
 font-size:0.875rem;
 line-height:1.25rem
}
.font-medium {
 font-weight:500
}
.text-gray-500 {
 --tw-text-opacity:1;
 color:rgb(107 114 128 / var(--tw-text-opacity))
}
.text-gray-900 {
 --tw-text-opacity:1;
 color:rgb(17 24 39 / var(--tw-text-opacity))
}
.text-white {
 --tw-text-opacity:1;
 color:rgb(255 255 255 / var(--tw-text-opacity))
}
.hover\:bg-gray-100:hover {
 --tw-bg-opacity:1;
 background-color:rgb(243 244 246 / var(--tw-bg-opacity))
}
.focus\:outline-none:focus {
 outline:2px solid transparent;
 outline-offset:2px
}
.focus\:ring-2:focus {
 --tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
 --tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
 box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
}
.focus\:ring-gray-200:focus {
 --tw-ring-opacity:1;
 --tw-ring-color:rgb(229 231 235 / var(--tw-ring-opacity))
}
@media (min-width: 768px) {
 .md\:mt-0 {
  margin-top:0px
 }
 .md\:block {
  display:block
 }
 .md\:hidden {
  display:none
 }
 .md\:w-auto {
  width:auto
 }
 .md\:flex-row {
  flex-direction:row
 }
 .md\:space-x-8 > :not([hidden]) ~ :not([hidden]) {
  --tw-space-x-reverse:0;
  margin-right:calc(2rem * var(--tw-space-x-reverse));
  margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))
 }
 .md\:border-0 {
  border-width:0px
 }
 .md\:bg-transparent {
  background-color:transparent
 }
 .md\:bg-white {
  --tw-bg-opacity:1;
  background-color:rgb(255 255 255 / var(--tw-bg-opacity))
 }
 .md\:p-0 {
  padding:0px
 }
 .md\:text-blue-700 {
  --tw-text-opacity:1;
  color:rgb(29 78 216 / var(--tw-text-opacity))
 }
 .md\:hover\:bg-transparent:hover {
  background-color:transparent
 }
 .md\:hover\:text-blue-700:hover {
  --tw-text-opacity:1;
  color:rgb(29 78 216 / var(--tw-text-opacity))
 }
}
.rtl\:space-x-reverse:where([dir="rtl"],
[dir="rtl"] *) > :not([hidden]) ~ :not([hidden]) {
 --tw-space-x-reverse:1
}
@media (prefers-color-scheme: dark) {
 .dark\:border-gray-700 {
  --tw-border-opacity:1;
  border-color:rgb(55 65 81 / var(--tw-border-opacity))
 }
 .dark\:bg-gray-800 {
  --tw-bg-opacity:1;
  background-color:rgb(31 41 55 / var(--tw-bg-opacity))
 }
 .dark\:bg-gray-900 {
  --tw-bg-opacity:1;
  background-color:rgb(17 24 39 / var(--tw-bg-opacity))
 }
 .dark\:text-gray-400 {
  --tw-text-opacity:1;
  color:rgb(156 163 175 / var(--tw-text-opacity))
 }
 .dark\:text-white {
  --tw-text-opacity:1;
  color:rgb(255 255 255 / var(--tw-text-opacity))
 }
 .dark\:hover\:bg-gray-700:hover {
  --tw-bg-opacity:1;
  background-color:rgb(55 65 81 / var(--tw-bg-opacity))
 }
 .dark\:hover\:text-white:hover {
  --tw-text-opacity:1;
  color:rgb(255 255 255 / var(--tw-text-opacity))
 }
 .dark\:focus\:ring-gray-600:focus {
  --tw-ring-opacity:1;
  --tw-ring-color:rgb(75 85 99 / var(--tw-ring-opacity))
 }
}
@media (min-width: 768px) {
 @media (prefers-color-scheme: dark) {
  .md\:dark\:bg-gray-900 {
   --tw-bg-opacity:1;
   background-color:rgb(17 24 39 / var(--tw-bg-opacity))
  }
  .md\:dark\:text-blue-500 {
   --tw-text-opacity:1;
   color:rgb(59 130 246 / var(--tw-text-opacity))
  }
  .md\:dark\:hover\:bg-transparent:hover {
   background-color:transparent
  }
  .md\:dark\:hover\:text-blue-500:hover {
   --tw-text-opacity:1;
   color:rgb(59 130 246 / var(--tw-text-opacity))
  }
 }
}

</style>
<script src="https://cdn.tailwindcss.com"></script>
<nav class="bg-white border-gray-200 dark:bg-gray-900">
  <div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
    <a href="https://v1.tailwindcss.com" class="flex items-center space-x-3 rtl:space-x-reverse">
        <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNjIgMzMi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5LjkyMiAyNDYuOTMgMjEuODIyIDI0Ni45MyAxNS4wMkMyNDYuOTMgMTEuNDQ4IDI1MC4wMDggOS4yMDU5NiAyNTMuODg0IDkuMjA1OTZDMjU3IDkuMjA1OTYgMjU5LjU4NCAxMC42NSAyNjAuOTE0IDEzLjE1OEwyNTcuNDU2IDE1LjA5NkMyNTYuNzcyIDEzLjYxNCAyNTUuNDQyIDEyLjkzIDI1My44ODQgMTIuOTNDMjUyLjQwMiAxMi45MyAyNTEuMTEgMTMuNTc2IDI1MS4xMSAxNC45NDRaIiBmaWxsPSJ3aGl0ZSIvPjwvc3ZnPgo=" class="h-8" alt="Tailwind CSS Logo" />
    </a>
    <button data-collapse-toggle="navbar-default" type="button" class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-default" aria-expanded="false">
        <span class="sr-only">Open main menu</span>
        <svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15"/>
        </svg>
    </button>
    <div class="hidden w-full md:block md:w-auto" id="navbar-default">
      <ul class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
        <li>
          <a href="#" class="block py-2 px-3 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0 dark:text-white md:dark:text-blue-500" aria-current="page">Home</a>
        </li>
        <li>
          <a href="#" class="block py-2 px-3 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">About</a>
        </li>
        <li>
          <a href="#" class="block py-2 px-3 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Services</a>
        </li>
        <li>
          <a href="#" class="block py-2 px-3 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Pricing</a>
        </li>
        <li>
          <a href="#" class="block py-2 px-3 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Contact</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

This will create a navbar with the Tailwind CSS logo with the selected page being blue (in this case home) and the rest being white on the navbar.

Result:

Tailwindnavbar

References

[change | change source]
  1. Gerchev, Ivaylo (2022). Tailwind CSS. Sebastopol: O'Reilly Media. ISBN 978-1-0981-4099-1. OCLC 1314257318.
  2. Rappin, Noel (2021). Modern CSS with Tailwind flexible styling without the fuss. Raleigh. ISBN 978-1-68050-857-4. OCLC 1277046918.{{cite book}}: CS1 maint: location missing publisher (link)