Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hoangitk/5c6288c218d08cc787168e62105961f6 to your computer and use it in GitHub Desktop.
Save hoangitk/5c6288c218d08cc787168e62105961f6 to your computer and use it in GitHub Desktop.
[How to draw diagonal line in html table] #css

How to draw diagonal line in html table

.table-editor td.diagonal:after { content: ""; position: absolute; z-index: 0; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255,255,255,.5); background-size: cover; clip-path: polygon(0% 0%, 0% 100%, 100% 100%); /tl-br/ /clip-path: polygon(100% 0%, 0% 0%, 0% 100%);/ /bl-tr/ }


- 2: use sgv,  just only diagonal line 👍
```css
svg {
position: absolute;
width: 100%;
height: 100%;
}
<svg viewBox="0 0 10 10" preserveAspectRatio="none">
 <line x1="0" y1="0" x2="10" y2="10" stroke="black" stroke-width="0.2" />
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment