Skip to main content

List of HTML tag default styles.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

html-styles-0.1.2.tar.gz (19.6 kB view hashes)

Uploaded Source

Built Distribution

html_styles-0.1.2-py3-none-any.whl (19.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page