Skip to main content

HtmlStyles

Python port of npm package html-styles.

List of known HTML tag default styles.

What is this?

This is a list of default styles for HTML tags as defined by W3C specification.

Install

pip install html-styles

Use

from HtmlStyles import html_styles
from itertools import chain


def get_tag_style(style):

    return dict(
        chain(
            *map(
                dict.items,
                [
                    {y: x["style"].get(style) for y in x["selectorText"].split(",")}
                    for x in list(
                        filter(lambda x: x["style"].get(style) is not None, html_styles)
                    )
                ],
            )
        )
    )


print(get_tag_style("display"))

print(get_tag_style("white-space"))

Yields:

{'[hidden]': 'none', ' area': 'none', ' base': 'none', ' basefont': 'none', ' datalist': 'none', ' head': 'none', ' link': 'none', ' meta': 'none', '\nnoembed': 'none', ' noframes': 'none', ' param': 'none', ' rp': 'none', ' script': 'none', ' source': 'none', ' style': 'none', ' template': 'none', ' track': 'none', ' title': 'none', 'embed[hidden]': 'inline', 'input[type=hidden i]': 'none', 'html': 'block', ' body': 'block', 'address': 'block', ' blockquote': 'block', ' center': 'block', ' div': 'block', ' figure': 'block', ' figcaption': 'block', ' footer': 'block', ' form': 'block', ' header': 'block', ' hr': 'block', '\nlegend': 'block', ' listing': 'block', ' main': 'block', ' p': 'block', ' plaintext': 'block', ' pre': 'block', ' xmp': 'block', 'dialog:not([open])': 'none', 'slot': 'contents', 'ruby': 'ruby', 'rt': 'ruby-text', 'article': 'block', ' aside': 'block', ' h1': 'block', ' h2': 'block', ' h3': 'block', ' h4': 'block', ' h5': 'block', ' h6': 'block', ' hgroup': 'block', ' nav': 'block', ' section': 'block', 'dir': 'block', ' dd': 'block', ' dl': 'block', ' dt': 'block', ' ol': 'block', ' ul': 'block', 'li': 'list-item', 'table': 'table', 'caption': 'table-caption', 'colgroup': 'table-column-group', ' colgroup[hidden]': 'table-column-group', 'col': 'table-column', ' col[hidden]': 'table-column', 'thead': 'table-header-group', ' thead[hidden]': 'table-header-group', 'tbody': 'table-row-group', ' tbody[hidden]': 'table-row-group', 'tfoot': 'table-footer-group', ' tfoot[hidden]': 'table-footer-group', 'tr': 'table-row', ' tr[hidden]': 'table-row', 'td': 'table-cell', ' th': 'table-cell', ' td[hidden]': 'table-cell', ' th[hidden]': 'table-cell', 'table > form': 'none', ' thead > form': 'none', ' tbody > form': 'none', ' tfoot > form': 'none', ' tr > form': 'none', 'fieldset': 'block'}
{'listing': 'pre', ' plaintext': 'pre', ' pre': 'pre', ' xmp': 'pre', 'pre[wrap]': 'pre-wrap', 'nobr': 'nowrap', 'nobr wbr': 'normal', 'td[nowrap]': 'nowrap', ' th[nowrap]': 'nowrap', 'table': 'initial', 'textarea': 'pre-wrap'}

License

GPL © Riverside Healthcare Ported from html-styles MIT © Mario Nebl

Metadata

Release files for html-styles 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html-styles 0.1.2
File Size Uploaded Provenance Actions
html-styles-0.1.2.tar.gz 19.6 kB Without provenance Details for html-styles-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for html-styles 0.1.2
File Interpreter ABI Platform Actions
html_styles-0.1.2-py3-none-any.whl Python 3 none any Details for html_styles-0.1.2-py3-none-any.whl

Total release size: 38.6 kB

Release files / html-styles-0.1.2.tar.gz

Download URL html-styles-0.1.2.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c5a4a1b40210bbb1df44d701e526cad40f009a4c84f0c4884ce19616d56e9d80
BLAKE2b-256 checksum
How to use checksums
742d1428419f5d605a5f74a550cd935b959f3ccc1d14cf228857d322dedbab1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.2 Linux/5.13.0-1014-azure

Release files / html_styles-0.1.2-py3-none-any.whl

Download URL html_styles-0.1.2-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f67efb5155629a909ee4440ded03592abcfc582ac1ed221cc944989fbd0b5a68
BLAKE2b-256 checksum
How to use checksums
583ddf9b0aa03fced1a1dd1841093ab4c80cfd126adc3af8a177caa852edd925
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.2 Linux/5.13.0-1014-azure

Security for html-styles 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page