Skip to content

Latest commit

 

History

History

writing-mode

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Get the CSS writing-mode status of the element

npm version Workflow status

Demo

Examples

<script type="importmap">
  {
    "imports": {
      "@w0s/writing-mode": "..."
    }
  }
</script>
<script type="module">
  import WritingMode from '@w0s/writing-mode';

  const writingMode = new WritingMode(document.querySelector('p'));

  const value = writingMode.value; // 'vertical-rl'
  const horizontal = writingMode.isHorizontal(); // false
  const vertical = writingMode.isVertical(); // true
</script>

<p style="writing-mode: vertical-rl">text</p>

Constructor

new WritingMode(
  element: HTMLElement
)

Parameters

element [required]
Target element

Methods

get value(): 'horizontal-tb' | 'vertical-rl' | 'vertical-lr' | 'sideways-rl' | 'sideways-lr'
Get the value of writing-mode
isHorizontal(): boolean
Whether the element is horizontal or not
isVertical(): boolean
Whether the element is vertical or not