tailwindcss outline

Outline can be of any random shape as it tries to wrap around content of the element.

2025-04-15

Written by: tdtc

tw中充斥了太多的outline!

Difference in sibling element position

Difference in style of different sides

The right posture

Outline can be of any random shape as it tries to wrap around content of the element.

In below code playground, you can see how the outline is rendered with random shape when applied on multiline text.

<div class="text-wrapper">
    This is test content <span class="highlight">to see how outline is shown when the content is wrapped</span> on multiple lines.
</div>
.text-wrapper {
  width: 200px;
}

.highlight {
  outline: 1px solid #ff77ab;
}

Ref