Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Incorrect conversion for vertical-align #10

Description

@Azmisov

For vertical-align, the two numeric values it can take are percentage and length.

  • Length in this case is offset from text's baseline
  • Percentage is offset from baseline as a percentage of line height
    So to correctly convert them you need to calculate line height. Unfortunately, getComputedStyle for line-height can return "normal" (appears to be "px" for all other cases). Perhaps a way to convert "normal" could be to measure something like:
getCreatedElementHeight(document.body, {
    lineHeight: el_styles.lineHeight, 
    fontFamily: el_styles.fontFamily, 
    fontSize: el_styles.fontSize
});

Though that may not be entirely reliable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions