# GT.fmt_url()


Format values as URL links.


Usage

``` python
GT.fmt_url(
    columns=None,
    rows=None,
    label=None,
    as_button=False,
    color="auto",
    show_underline="auto",
    button_fill="auto",
    button_width=None,
    button_outline=None,
    target="_blank",
)
```


With `fmt_url()`, input URL strings in the table body are transformed into HTML anchor elements (`<a>` tags). The URLs can be displayed as-is, with a static label, or with a label generated by a function. The links can also be styled as buttons with customizable colors and dimensions.


## Parameters


`columns: SelectExpr = None`  
The columns to target. Can either be a single column name or a series of column names provided in a list.

`rows: int | list[int] | None = None`  
In conjunction with `columns=`, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.

`label: str | Callable[[str], str] | None = None`  
An optional label to use for the link. If a string is provided, it will be used as the visible text for all links. If a callable is provided, it will be called with the URL string and should return the display label.

`as_button: bool = ``False`  
Should the link be styled as a button? By default this is `False`.

`color: str = ``"auto"`  
The color of the link text. The default `"auto"` uses `"#008B8B"` (dark cyan) for regular links and `"#FFFFFF"` (white) for buttons. Any CSS color name or hex value can be used.

`show_underline: str | bool = ``"auto"`  
Should the link be underlined? The default `"auto"` uses `True` for regular links and `False` for buttons. Set explicitly to `True` or `False` to override.

`button_fill: str = ``"auto"`  
The background color for button-style links. The default `"auto"` uses `"#4682B4"` (steel blue). Only used when `as_button=True`.

`button_width: str | None = None`  
The width of the button. Should be a CSS width string (e.g., `"150px"`). By default buttons size to their content.

`button_outline: str | None = None`  
The CSS outline for the button (e.g., `"2px solid #ccc"`). By default, a light gray outline is automatically added when the button fill color is very light, and hidden otherwise.

`target: str | None = ``"_blank"`  
The `target` attribute for the anchor element. Defaults to `"_blank"` to open links in a new tab. Set to `None` to open in the same tab.


## Returns


`GT`  
The GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.


## Examples

Using a subset of the [towny](data.towny.md#great_tables.data.towny) dataset, let's format the `website` column as URL links.


``` python
import polars as pl
from great_tables import GT, md, data

towny_top = (
    data.pl.towny
    .filter(pl.col("csd_type") == "city")
    .select("name", "website", "population_2021")
    .sort("population_2021", descending=True)
    .head(10)
)

(
    GT(towny_top)
    .tab_header(
        title=md("The 10 Largest Municipalities in `towny`"),
        subtitle="Population values taken from the 2021 census.",
    )
    .fmt_integer(columns="population_2021")
    .fmt_url(columns="website")
    .cols_label(
        name="Name",
        website="Site",
        population_2021="Population",
    )
)
```


<style>
#nmyhnipdab table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#nmyhnipdab thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#nmyhnipdab p { margin: 0; padding: 0; }
 #nmyhnipdab .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #nmyhnipdab .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #nmyhnipdab .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #nmyhnipdab .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #nmyhnipdab .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #nmyhnipdab .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nmyhnipdab .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #nmyhnipdab .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #nmyhnipdab .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #nmyhnipdab .gt_column_spanner_outer:first-child { padding-left: 0; }
 #nmyhnipdab .gt_column_spanner_outer:last-child { padding-right: 0; }
 #nmyhnipdab .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #nmyhnipdab .gt_spanner_row { border-bottom-style: hidden; }
 #nmyhnipdab .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #nmyhnipdab .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #nmyhnipdab .gt_from_md> :first-child { margin-top: 0; }
 #nmyhnipdab .gt_from_md> :last-child { margin-bottom: 0; }
 #nmyhnipdab .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #nmyhnipdab .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #nmyhnipdab .gt_indent_1 { text-indent: 5px; }
 #nmyhnipdab .gt_indent_2 { text-indent: calc(5px * 2); }
 #nmyhnipdab .gt_indent_3 { text-indent: calc(5px * 3); }
 #nmyhnipdab .gt_indent_4 { text-indent: calc(5px * 4); }
 #nmyhnipdab .gt_indent_5 { text-indent: calc(5px * 5); }
 #nmyhnipdab .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #nmyhnipdab .gt_row_group_first td { border-top-width: 2px; }
 #nmyhnipdab .gt_row_group_first th { border-top-width: 2px; }
 #nmyhnipdab .gt_striped { color: #333333; background-color: #F4F4F4; }
 #nmyhnipdab .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nmyhnipdab .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #nmyhnipdab .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #nmyhnipdab .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nmyhnipdab .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #nmyhnipdab .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #nmyhnipdab .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #nmyhnipdab .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #nmyhnipdab .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #nmyhnipdab .gt_left { text-align: left; }
 #nmyhnipdab .gt_center { text-align: center; }
 #nmyhnipdab .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #nmyhnipdab .gt_font_normal { font-weight: normal; }
 #nmyhnipdab .gt_font_bold { font-weight: bold; }
 #nmyhnipdab .gt_font_italic { font-style: italic; }
 #nmyhnipdab .gt_super { font-size: 65%; }
 #nmyhnipdab .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #nmyhnipdab .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #nmyhnipdab .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #nmyhnipdab .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #nmyhnipdab .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #nmyhnipdab .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="3" class="gt_heading gt_title gt_font_normal">The 10 Largest Municipalities in <code>towny</code></th>
</tr>
<tr class="gt_heading">
<th colspan="3" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Population values taken from the 2021 census.</th>
</tr>
<tr class="gt_col_headings">
<th id="name" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col">Name</th>
<th id="website" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col">Site</th>
<th id="population_2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Population</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_left">Toronto</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.toronto.ca](https://www.toronto.ca)</span></td>
<td class="gt_row gt_right">2,794,356</td>
</tr>
<tr>
<td class="gt_row gt_left">Ottawa</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://ottawa.ca](https://ottawa.ca)</span></td>
<td class="gt_row gt_right">1,017,449</td>
</tr>
<tr>
<td class="gt_row gt_left">Mississauga</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.mississauga.ca](https://www.mississauga.ca)</span></td>
<td class="gt_row gt_right">717,961</td>
</tr>
<tr>
<td class="gt_row gt_left">Brampton</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.brampton.ca](https://www.brampton.ca)</span></td>
<td class="gt_row gt_right">656,480</td>
</tr>
<tr>
<td class="gt_row gt_left">Hamilton</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.hamilton.ca](https://www.hamilton.ca)</span></td>
<td class="gt_row gt_right">569,353</td>
</tr>
<tr>
<td class="gt_row gt_left">London</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://london.ca](https://london.ca)</span></td>
<td class="gt_row gt_right">422,324</td>
</tr>
<tr>
<td class="gt_row gt_left">Markham</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.markham.ca](https://www.markham.ca)</span></td>
<td class="gt_row gt_right">338,503</td>
</tr>
<tr>
<td class="gt_row gt_left">Vaughan</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.vaughan.ca](https://www.vaughan.ca)</span></td>
<td class="gt_row gt_right">323,103</td>
</tr>
<tr>
<td class="gt_row gt_left">Kitchener</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.kitchener.ca](https://www.kitchener.ca)</span></td>
<td class="gt_row gt_right">256,885</td>
</tr>
<tr>
<td class="gt_row gt_left">Windsor</td>
<td class="gt_row gt_left"><span style="white-space:pre;">[https://www.citywindsor.ca](https://www.citywindsor.ca)</span></td>
<td class="gt_row gt_right">229,660</td>
</tr>
</tbody>
</table>


We can use a static label and disable underlines for a cleaner look, merging the URL column into the name column.


``` python
(
    GT(towny_top)
    .tab_header(
        title=md("The 10 Largest Municipalities in `towny`"),
        subtitle="Population values taken from the 2021 census.",
    )
    .fmt_integer(columns="population_2021")
    .fmt_url(columns="website", label="site", show_underline=False)
    .cols_merge(columns=["name", "website"], pattern="{0} ({1})")
    .cols_label(name="Name", population_2021="Population")
)
```


<style>
#hhxkpaqcqh table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#hhxkpaqcqh thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#hhxkpaqcqh p { margin: 0; padding: 0; }
 #hhxkpaqcqh .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #hhxkpaqcqh .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #hhxkpaqcqh .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #hhxkpaqcqh .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #hhxkpaqcqh .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #hhxkpaqcqh .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #hhxkpaqcqh .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #hhxkpaqcqh .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #hhxkpaqcqh .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #hhxkpaqcqh .gt_column_spanner_outer:first-child { padding-left: 0; }
 #hhxkpaqcqh .gt_column_spanner_outer:last-child { padding-right: 0; }
 #hhxkpaqcqh .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #hhxkpaqcqh .gt_spanner_row { border-bottom-style: hidden; }
 #hhxkpaqcqh .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #hhxkpaqcqh .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #hhxkpaqcqh .gt_from_md> :first-child { margin-top: 0; }
 #hhxkpaqcqh .gt_from_md> :last-child { margin-bottom: 0; }
 #hhxkpaqcqh .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #hhxkpaqcqh .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #hhxkpaqcqh .gt_indent_1 { text-indent: 5px; }
 #hhxkpaqcqh .gt_indent_2 { text-indent: calc(5px * 2); }
 #hhxkpaqcqh .gt_indent_3 { text-indent: calc(5px * 3); }
 #hhxkpaqcqh .gt_indent_4 { text-indent: calc(5px * 4); }
 #hhxkpaqcqh .gt_indent_5 { text-indent: calc(5px * 5); }
 #hhxkpaqcqh .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #hhxkpaqcqh .gt_row_group_first td { border-top-width: 2px; }
 #hhxkpaqcqh .gt_row_group_first th { border-top-width: 2px; }
 #hhxkpaqcqh .gt_striped { color: #333333; background-color: #F4F4F4; }
 #hhxkpaqcqh .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #hhxkpaqcqh .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #hhxkpaqcqh .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #hhxkpaqcqh .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #hhxkpaqcqh .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #hhxkpaqcqh .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #hhxkpaqcqh .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #hhxkpaqcqh .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #hhxkpaqcqh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #hhxkpaqcqh .gt_left { text-align: left; }
 #hhxkpaqcqh .gt_center { text-align: center; }
 #hhxkpaqcqh .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #hhxkpaqcqh .gt_font_normal { font-weight: normal; }
 #hhxkpaqcqh .gt_font_bold { font-weight: bold; }
 #hhxkpaqcqh .gt_font_italic { font-style: italic; }
 #hhxkpaqcqh .gt_super { font-size: 65%; }
 #hhxkpaqcqh .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #hhxkpaqcqh .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #hhxkpaqcqh .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #hhxkpaqcqh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #hhxkpaqcqh .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #hhxkpaqcqh .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="2" class="gt_heading gt_title gt_font_normal">The 10 Largest Municipalities in <code>towny</code></th>
</tr>
<tr class="gt_heading">
<th colspan="2" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Population values taken from the 2021 census.</th>
</tr>
<tr class="gt_col_headings">
<th id="name" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col">Name</th>
<th id="population_2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Population</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_left">Toronto (<span style="white-space:pre;">[site](https://www.toronto.ca)</span>)</td>
<td class="gt_row gt_right">2,794,356</td>
</tr>
<tr>
<td class="gt_row gt_left">Ottawa (<span style="white-space:pre;">[site](https://ottawa.ca)</span>)</td>
<td class="gt_row gt_right">1,017,449</td>
</tr>
<tr>
<td class="gt_row gt_left">Mississauga (<span style="white-space:pre;">[site](https://www.mississauga.ca)</span>)</td>
<td class="gt_row gt_right">717,961</td>
</tr>
<tr>
<td class="gt_row gt_left">Brampton (<span style="white-space:pre;">[site](https://www.brampton.ca)</span>)</td>
<td class="gt_row gt_right">656,480</td>
</tr>
<tr>
<td class="gt_row gt_left">Hamilton (<span style="white-space:pre;">[site](https://www.hamilton.ca)</span>)</td>
<td class="gt_row gt_right">569,353</td>
</tr>
<tr>
<td class="gt_row gt_left">London (<span style="white-space:pre;">[site](https://london.ca)</span>)</td>
<td class="gt_row gt_right">422,324</td>
</tr>
<tr>
<td class="gt_row gt_left">Markham (<span style="white-space:pre;">[site](https://www.markham.ca)</span>)</td>
<td class="gt_row gt_right">338,503</td>
</tr>
<tr>
<td class="gt_row gt_left">Vaughan (<span style="white-space:pre;">[site](https://www.vaughan.ca)</span>)</td>
<td class="gt_row gt_right">323,103</td>
</tr>
<tr>
<td class="gt_row gt_left">Kitchener (<span style="white-space:pre;">[site](https://www.kitchener.ca)</span>)</td>
<td class="gt_row gt_right">256,885</td>
</tr>
<tr>
<td class="gt_row gt_left">Windsor (<span style="white-space:pre;">[site](https://www.citywindsor.ca)</span>)</td>
<td class="gt_row gt_right">229,660</td>
</tr>
</tbody>
</table>


Button-styled links can be created with `as_button=True`.


``` python
(
    GT(towny_top)
    .fmt_integer(columns="population_2021")
    .fmt_url(
        columns="website",
        label=lambda x: x.replace("https://", "").replace("www.", ""),
        as_button=True,
        button_fill="steelblue",
        button_width="150px",
    )
    .cols_label(
        name="Name",
        website="Website",
        population_2021="Population",
    )
)
```


<style>
#thvabncirg table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#thvabncirg thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#thvabncirg p { margin: 0; padding: 0; }
 #thvabncirg .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #thvabncirg .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #thvabncirg .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #thvabncirg .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #thvabncirg .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #thvabncirg .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #thvabncirg .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #thvabncirg .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #thvabncirg .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #thvabncirg .gt_column_spanner_outer:first-child { padding-left: 0; }
 #thvabncirg .gt_column_spanner_outer:last-child { padding-right: 0; }
 #thvabncirg .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #thvabncirg .gt_spanner_row { border-bottom-style: hidden; }
 #thvabncirg .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #thvabncirg .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #thvabncirg .gt_from_md> :first-child { margin-top: 0; }
 #thvabncirg .gt_from_md> :last-child { margin-bottom: 0; }
 #thvabncirg .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #thvabncirg .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #thvabncirg .gt_indent_1 { text-indent: 5px; }
 #thvabncirg .gt_indent_2 { text-indent: calc(5px * 2); }
 #thvabncirg .gt_indent_3 { text-indent: calc(5px * 3); }
 #thvabncirg .gt_indent_4 { text-indent: calc(5px * 4); }
 #thvabncirg .gt_indent_5 { text-indent: calc(5px * 5); }
 #thvabncirg .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #thvabncirg .gt_row_group_first td { border-top-width: 2px; }
 #thvabncirg .gt_row_group_first th { border-top-width: 2px; }
 #thvabncirg .gt_striped { color: #333333; background-color: #F4F4F4; }
 #thvabncirg .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #thvabncirg .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #thvabncirg .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #thvabncirg .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #thvabncirg .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #thvabncirg .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #thvabncirg .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #thvabncirg .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #thvabncirg .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #thvabncirg .gt_left { text-align: left; }
 #thvabncirg .gt_center { text-align: center; }
 #thvabncirg .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #thvabncirg .gt_font_normal { font-weight: normal; }
 #thvabncirg .gt_font_bold { font-weight: bold; }
 #thvabncirg .gt_font_italic { font-style: italic; }
 #thvabncirg .gt_super { font-size: 65%; }
 #thvabncirg .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #thvabncirg .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #thvabncirg .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #thvabncirg .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #thvabncirg .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #thvabncirg .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

| Name | Website | Population |
|----|----|----|
| Toronto | <span style="white-space:pre;">[toronto.ca](https://www.toronto.ca)</span> | 2,794,356 |
| Ottawa | <span style="white-space:pre;">[ottawa.ca](https://ottawa.ca)</span> | 1,017,449 |
| Mississauga | <span style="white-space:pre;">[mississauga.ca](https://www.mississauga.ca)</span> | 717,961 |
| Brampton | <span style="white-space:pre;">[brampton.ca](https://www.brampton.ca)</span> | 656,480 |
| Hamilton | <span style="white-space:pre;">[hamilton.ca](https://www.hamilton.ca)</span> | 569,353 |
| London | <span style="white-space:pre;">[london.ca](https://london.ca)</span> | 422,324 |
| Markham | <span style="white-space:pre;">[markham.ca](https://www.markham.ca)</span> | 338,503 |
| Vaughan | <span style="white-space:pre;">[vaughan.ca](https://www.vaughan.ca)</span> | 323,103 |
| Kitchener | <span style="white-space:pre;">[kitchener.ca](https://www.kitchener.ca)</span> | 256,885 |
| Windsor | <span style="white-space:pre;">[citywindsor.ca](https://www.citywindsor.ca)</span> | 229,660 |
