 Search
components/accordion: Accordion components/badge: Badge components/button: Button components/checkbox: Checkbox components/dialog: Dialog components/input: Input components/mark: Mark components/popover: Popover components/progress: Progress components/pre: Pre components/radio: Radio components/range: Range components/spinner: Spinner components/separator: Separator components/switch: Switch components/table: Table components/textarea: Textarea components/tooltip: Tooltip components/view: View components/typography: Typography plugins/plugin-nf: Nerd Font Plugin plugins/theme-catppuccin: Catppuccin Theme plugins/theme-everforest: Everforest Theme plugins/theme-gruvbox: Gruvbox Theme contributing/style-guide: Style Guide contributing/style-guide: ## CSS Units contributing/style-guide: ## Selectors contributing/style-guide: ## Documentation plugins/plugin-dev: Developing Plugins plugins/plugin-dev: ### Style Layers contributing/contributing: Contributing contributing/contributing: ## Local Development contributing/contributing: ## Issues contributing/contributing: ## Pull Requests installation/nextjs: Next.js installation/vite: Vite installation/astro: Astro installation/astro: ## Scoping installation/astro: ### Frontmatter Imports installation/astro: ### <style> tag installation/astro: ### Full Library Import plugins/theme-nord: Nord Theme start/ascii-boxes: ASCII Boxes plugins/theme-vitesse: Vitesse Theme start/changelog: Changelog start/installation: Installation start/intro: Introduction start/intro: ## Features start/plugins: Plugins start/plugins: ## Official Plugins start/plugins: ### Themes start/plugins: ## Community Plugins start/theming: Theming start/theming: ## CSS Variables start/theming: ### Font Styles start/theming: ### Colors start/theming: ### Light & Dark start/theming: ## Theme Plugins start/theming: ### Using Multiple Theme Accents start/tuis-vs-guis: TUIs vs GUIs start/tuis-vs-guis: ## Monospace Fonts start/tuis-vs-guis: ## Character Cells

Mark

Uses the <mark> HTML element to highlight text

1
2 <p>
3 This is a
4 <mark fg-="foreground0">paragraph</mark>
5 with
6 <mark fg-="background0" bg-="foreground2">highlighted</mark>
7 <mark bg-="background2">text</mark></p>
8

Import

@import '@webtui/css/components/mark.css';

Usage

<mark fg-="foreground1">highlight foreground</mark>
<mark bg-="background2">highlight background</mark>
<mark fg-="foreground2" bg-="background2"
    >highlight background and foreground</mark
>
<span is-="mark" fg-="..." bg-="...">highlight a different tag</span>

Examples

Use the fg- (foreground) and bg- (background) attributes to change the color and background color of the <mark>

1
2 <ul>
3 <li>fg- only: <mark fg-="foreground2">fg-="foreground1"</mark></li>
4 <li>bg- only: <mark bg-="background1">bg-="backrground1"</mark></li>
5 <li>fg- and bg-: <mark bg-="foreground1" fg-="background0">bg-="foreground1" fg-="background0"</mark></li>
6 </ul>
7

By default, fg-, and bg- match the base theme colors but can be extended with themes

Reference

Extending

To extend the Badge stylesheet, define a CSS rule on the components layer

@layer components {
    mark,
    [is-~='mark'] {
        &[bg-='red'] {
            background-color: red;
        }
        &[fg-='red'] {
            color: red;
        }
        &[bg-='blue'] {
            background-color: blue;
        }
        &[fg-='blue'] {
            color: blue;
        }

        /* ... */
    }
}

Scope

  • All elements with the is-~="mark" selector
  • All <mark> elements
mark,
[is-~='mark'] {
    /* ... */
}