A clipped icon on a rounded card? Moving overflow: hidden to an inner box fixed it. — cover illustration

A clipped icon on a rounded card? Moving overflow: hidden to an inner box fixed it.


A face pops out from the edge of the card. Even though I wanted to add such a small trick, I couldn't see just the top half of my face. The corners are now nicely rounded, but I don't have to cut them that far...

The key to fixing this is to separate the box into two parts.
What you cut out along the rounded corners is the "box inside." Place the pop-up decorations on the outside. In this article, we have prepared the HTML that can be used at hand to compare the same card shape before and after modification.

The target audience is people who are creating rounded corner cards using HTML and CSS, but whose icons and decorations are cut off on hover. It does not use JavaScript or libraries.

Comparison in Chrome. On the left, the face is cut out even if the z-index is set to 999999, and on the right, only the inside is cut out so you can see the whole face.
Actual screen of sample for explanation. The upper part of the face on the left is cut off, and the corners on the right remain rounded.

First, let's see where it breaks

For this explanation, I created a sample where the face moves upward by 44px. At first, it is left popping out. If you uncheck it and move the cursor over it, you can also compare the movements.

Open the demo in a larger view

Please also check "Set the z-index before modification to 999999". Even if you increase the stacking order, the face remains cut off in the middle.

Why doesn't it work even if I increase the z-index?

z-indexadjusts the stacking order of elements. On the other hand,overflow: hiddenis a specification that hides the contents that protrude from the box. With this card, even if you change the order in which you put the cards in front of you, the area that will be cut out will not change.

This sample places a face with position: absolute inside a card with position: relative. Because the face is positioned relative to the card, the card's clipping also affects it.

In terms of specifications,hiddenThis is a specification to clip the protruding content. The detailed movementsMDN overflow referenceYou can check it here.

What needs to be fixed is the box to cut out and the place to put the face.

The code from here is the changes. If you want to make it from scratch, follow the steps below.Completed version HTMLIf you save it, you can move it including specifying the size and color.

1. Remove overflow: hidden from outer box

Change the entire card specification as follows.position: relativeis left as it is the standard for face placement.

.card {
  position: relative;
  overflow: visible; /* 外にはみ出すことを許可 */
}

However, if this is all you do, the internal images and background may also protrude from the corners. Therefore, we will create a box specifically for the contents.

2. Wrap only the contents in a new box

card-face contains the clipped surface. Place mascot beside it, not inside it. This arrangement is the key.

<div class="card">
  <div class="card-face">
    <div class="banner" aria-hidden="true"></div>
    <div class="copy">カードの本文</div>
  </div>
  <span class="mascot" aria-hidden="true">•ᴗ•</span>
</div>
.card-face {
  border-radius: 24px;
  overflow: hidden; /* 角丸に沿って切り抜くのは中身だけ */
}

If you put mascot back inside card-face, the face will be clipped again.

3. Specify the distance the face moves

.mascot {
  position: absolute;
  right: 24px;
  top: 12px;
  z-index: 1;
  pointer-events: none;
  transition: transform .35s ease;
}
.card:hover .mascot,
.card:focus-within .mascot {
  transform: translateY(-44px) rotate(-8deg);
}
@media (prefers-reduced-motion: reduce) {
  .mascot { transition: none; }
}

translateY(-44px) moves it up 44px, and rotate(-8deg) tilts it slightly. pointer-events: none prevents this decorative element from blocking pointer interaction. Do not apply it to a button that needs to be clickable.

With :focus-within, the face also appears when you select a link inside the card with Tab. If reduced motion is enabled, it changes position without animation.

Download it and run it in your browser

If you are having trouble connecting the pieces, please use the completed version. The necessary HTML and CSS are combined into one file. No external images or packages need to be installed.

Save the completed HTML Save as ZIP

  1. Save the file.If it is a ZIP file, unzip it andexample.htmlOpen.
  2. Open in browser.Double-click the file. If the editor opens, right-click and choose a browser such as "Open with".
  3. Hover over the card.If the face sticks out and the top corner of the stripe remains rounded, it's a success. You can also use the keyboard by pressing the Tab key and selecting "View Results".
  4. Try changing the numbers.In a code editor such as VS Codeexample.htmlOpen the-44pxThe-60pxChange and save. Reload the browser and it will go up another 16px.

If you are in an environment without a cursor such as a smartphone, please use the checkbox in the comparison demo in this article. The minimal HTML to distribute is an example of hover and keyboard focus.

View all completed code
<!doctype html>
<html lang="ja">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>角丸と飛び出す飾りを両立する</title>
<style>
* { box-sizing: border-box; }
body { margin: 0; padding: 80px 24px; font-family: sans-serif; color: #293b36; }
.card { position: relative; max-width: 320px; margin: auto; overflow: visible; }
.card-face { border-radius: 24px; overflow: hidden; background: #f7f4eb; }
.banner { height: 100px; background: repeating-linear-gradient(135deg,#e0eee7 0 18px,#c6dfd1 18px 36px); }
.copy { padding: 24px; }
.copy h1 { font-size: 22px; }
.mascot { position: absolute; right: 24px; top: 12px; z-index: 1; width: 64px; height: 64px; display: grid; place-items: center; border: 2px solid #293b36; border-radius: 50%; background: #ffe49c; font-size: 28px; pointer-events: none; transition: transform .35s ease; }
.card:hover .mascot, .card:focus-within .mascot { transform: translateY(-44px) rotate(-8deg); }
a { color: #23644e; }
a:focus-visible { outline: 3px solid #23644e; outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .mascot { transition: none; } }
</style>
<div class="card">
  <div class="card-face">
    <div class="banner" aria-hidden="true"></div>
    <div class="copy">
      <h1>小さな実験</h1>
      <p>カードにカーソルを合わせるか、リンクを選択すると顔が飛び出します。</p>
      <a href="#result">結果を見る</a>
    </div>
  </div>
  <!-- 切り抜く箱の外側に、飾りを置く -->
  <span class="mascot" aria-hidden="true">•ᴗ•</span>
</div>
<p id="result">上の角丸を保ったまま、顔が外に出れば成功です。</p>
</html>

Still clipped? Check the next outer container

In Chrome, right-click the body of the card and select Inspect. The decorative face is specified to be clickable, so it is safe to trace it from the main text. Select the parent elements in order in "Elements" and select them in "Computed"overflowIf you search for , you can track which box is being cut out. Temporarily turn off the appropriate settings in "Styles" and check if the entire face is visible. Changes will be reverted by reloading, so edit the original CSS once you know the cause.

Even if you reposition the face, another box across the page may still be cut out. blindlyz-indexBefore increasing , check the following:

  • Is there a face left inside the card-face?Check the position of the closing tag.
  • Does an ancestor have overflow: hidden or overflow: clip?This also applies to parents of the card list. Consider a structure that only adds clipping to the contents that need to be cut out, instead of deleting all the necessary specifications all at once.
  • Is clip-path or mask doing the clipping?Since this is a different specification from overflow, it may not be possible to fix it with just the same modification.
  • You can see everything, but it goes into the back of the next card.This may be a stacking order issue rather than cropping. Also check the overlap between the outer cards.

Even if it becomes possible to pop out, the surrounding margin will not increase automatically. Make sure to leave enough space at the top of the card so it doesn't overlap the heading above or the button next to it.

You can keep both rounded corners and playfulness.

What I changed this time was not the flashy movement, but the role of the box. Determine the position on the outside. Cut out rounded corners on the inside. The face moves outside of it.

If you want to incorporate it into your own card, it will be easier to understand if you try it on one face first. If you can do it well, try changing the distance and tilt little by little to create a movement that suits your site.

If you want to play a little more,How to make a performance that pops out of a drawerTo.Web experimentsThere is also another device that you can try out by moving it.

Checked on November 8, 2026: the comparison demo and complete HTML example were tested in Chrome. Horizontal overflow and checkbox interaction were also checked at a viewport width of 390px. Safari, Firefox and physical smartphones were not tested.

Documents that confirmed specifications

This article is verified with an illustrative sample. This is not a reproduction of a personal failure story that occurred on an actual site. There are no affiliate links.