The image is having its box-shadow trimmed off

Here's how the image is supposed to look:

With box-shadow added to the code: Image

However, this is what it currently looks like and I am unsure of why and how to resolve it: Image

You'll notice that the box-shadow is cut off on all four sides of the image.

Any suggestions on how to fix this issue so that the image isn't being cut off?

View the full code here: https://jsfiddle.net/8mgvn40u/

.curtain {
  width: 550px;
  height: 250px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  background: #000000;
  box-sizing: border-box;
}

.jacketa {
  // CSS styles for .jacketa go here...
}
// More CSS styles...

@keyframes draw {
  // Keyframes animation for drawing path...
}

@keyframes flicker-1 {
  // Flicker animation keyframes...
}
 
<div class="curtain">

  <div class="split-wrap">
    <div class="j1">
      <div class="jacketa" title="[ Enjoy The Music ]">
        <svg class="coversvg" width="70" height="75.4" viewBox="0 0 47.96 51.66">
          <title>[ Enjoy The Music ]</title>
          <path class="back" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83" />
          <path class="front" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,
            // SVG path details...    
</div>

Answer №1

Due to overflow, the bow-shadow is getting cut-off (already mentioned). To resolve this issue, you can utilize transform to ensure that the shadows stay within the visible area.

Start by increasing the hidden overflow area and then decrease what lies inside. By making it smaller, it won't get clipped anymore.

Here's an example of implementing this idea with a short fixed involving: transform:scale(1.1) vs transform:scale(0.9), in order to maintain a close ratio to the initial layout size.

.curtain {
  width: 550px;
  height: 250px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  background: #000000;
  box-sizing: border-box;
}
.split-wrap{
transform:scale(1.1);
}
.jacketa {
  position: absolute;
  width: 180px;
  height: 180px;
  cursor: pointer;
  border-radius: 50%;
  background: #130e85;
  border: 3px solid #f91f6e;
  box-sizing: border-box;
  box-shadow: 0 0 20px 2px #f9066bf7;
  transform:scale(0.9);
   
}
.jacketa .coversvg {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
  cursor: pointer;
}
.jacketa .coversvg {
  width: 70px;
  height: 75.4px;
  fill: none;
  stroke-width: 4px;
  stroke-miterlimit: 10;
}

.jacketa .coversvg .back {
  stroke: #000;
  opacity: 0.15;
}

.jacketa .coversvg .front {
  stroke: #08f9ff;
  stroke-dasharray: 150;
  stroke-dashoffset: 1500;
  animation: draw 20s infinite linear, flicker-1 2s linear 2s infinite both;
}

@keyframes draw {
  100% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes flicker-1 {
  0%,
  100% {
    opacity: 1;
  }

  41.99% {
    opacity: 1;
  }

  42% {
    opacity: 0;
  }

  43% {
    opacity: 0;
  }

  43.01% {
    opacity: 1;
  }

  47.99% {
    opacity: 1;
  }

  48% {
    opacity: 0;
  }

  49% {
    opacity: 0;
  }

  49.01% {
    opacity: 1;
  }
}

.split-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 180px;
  height: 180px;
  margin: auto;
  border-radius: 50%;
  transition: 0.5s ease;
}

.j1 {
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: 5s ease;
}
.j2 {
  position: absolute;
  left: 50%;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: 5s ease;
}
.j2 .jacketa {
  right: 0;
  left: auto;
}
.curtain:hover .j1 {
  transform: translateX(-500%);
}
.curtain:hover .j2 {
  transform: translateX(500%);
}
<div class="curtain">

  <div class="split-wrap">
    <div class="j1">
      <div class="jacketa" title="[ Enjoy The Music ]">
        <svg class="coversvg" width="70" height="75.4" viewBox="0 0 47.96 51.66">
          <title>[ Enjoy The Music ]</title>
          <path class="back" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83" />
          <path class="front" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83" />
        </svg>
      </div>
    </div>
    <div class="j2">
      <div class="jacketa" title="[ Enjoy The Music ]">
        <svg class="coversvg" width="70" height="75.4" viewBox="0 0 47.96 51.66">
          <title>[ Enjoy The Music ]</title>
          <path class="back" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83" />
          <path class="front" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83" />
        </svg>
      </div>
    </div>
  </div>
</div>

Answer №2

The reason this is happening is because you applied overflow: hidden to both .j1 and .j2. Changing it to overflow: visible will resolve the issue with the box-shadow, but it may disrupt your curtain animation.

Another option is to increase the size of .j1 and .j2 using padding, so that the box-shadow does not overlap with them.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

CSS tables are not properly recognizing the class values within the table

This is the CSS I am working with: table { margin: 10px 0 20px 0; width: 100%; text-align: center; } table th { color: #38A4FC; padding-top: 5px; background-color: #f9f9f9; width: 200px; height: 30px; border: 1px solid #d7d7d7; border-bottom: none; } ...

Links in the navigation bar can be clicked on, however they are not visible when

The screenshot of the error The menu links in the mobile view aren't visible but clickable. As a novice in HTML and CSS, I'm facing an issue where the hamburger menu with z-index 1 is displayed correctly, but its content is not visible. This prob ...

When I tried to open a website using the "target=_blank" attribute on the Chrome mobile version for iPhone, I noticed some strange viewport behavior

[Update] I encountered the following issue: I once had a website. It functioned well, except when opened in a new tab with target "_blank." When accessing the site directly, everything appeared normal enter image description here However, when accessed ...

The div element is failing to occupy the entire page

I have encountered an issue where I created two small blocks, but they do not start from the screen edges. Instead, they take up space from the left, right, and top as well. Here is my code: HTML <body> <div id="header"></div> & ...

How can I dynamically unload a JavaScript file that was previously loaded with RequireJS? Alternatively, how can I handle exclusive dependencies or reset RequireJS?

I'm facing a dilemma with two JavaScript files that cannot be loaded simultaneously. One needs to be unloaded before the other can be loaded when a specific button is clicked. Here's an outline of my current approach: //pseudocode if user click ...

The xModal window will only pop up once, after which a page refresh is required

My modal window opens when a user clicks on a div, but I'm having an issue. The modal window doesn't reopen when I click on the div again. Here is my code: <div onclick="document.getElementById('id01').style.display='block&apos ...

Working with HTML5 canvas to draw multiple images

Here is the code I'm working with: http://jsfiddle.net/zyR9K/4/ var Enemies = { x: 25, y: 25, width: 20, height: 30, speed: 0.5, color: "#000", draw: function () { canvas.fillStyle = ...

Managing the height of a hero section with TailwindCSS and React.js

Embarking on my first website project using React and Tailwind has been an exciting learning experience. My vision is to showcase a Hero Section prominently at the top, with a Nav bar situated elegantly at the bottom of the screen. To bring this concept ...

How can I troubleshoot non-functional traffic lights in vue.js?

I've recently built a traffic light using vue.js, but unfortunately, it's not functioning as expected. The colors (red, yellow, and green) are supposed to change according to the time duration, but for some reason, this isn't happening. Can ...

Ways to conceal the image once the fixed navigation bar appears

I've been working on a website at After scrolling down the site, a fixed navigation bar appears. However, on this fixed navigation bar, I'd like to hide the logo navigation while still keeping it visible on the regular top navigation bar. https ...

Engage in a sequence of actions by tapping and retapping on a div element

Is there a way to toggle the color of an element from black to orange with a single click and back again with another click? Additionally, I have set up a hover effect in CSS that changes the color to orange when hovered over. In my current code, the elem ...

Which file is the optimal placement for the Bootstrap directory: 'header.php' or 'function.php'?

Having dabbled in WordPress Theme templates for a while, I've decided to try my hand at creating a theme from scratch. After uploading the Bootstrap features onto my server, I'm pondering whether it's better to call the Bootstrap.css files ...

The behavior of -webkit-border-radius differs from that of -moz-border-radius

My website is displaying differently on Safari compared to Firefox. I want the CSS to make it look consistent across both browsers. I understand that I could use two div boxes - one for the outline and one for the image. However, I prefer how Firefox only ...

The fixed header in IE8 is preventing the absolute positioned menu from displaying correctly

Here is some HTML and CSS code that showcases a fixed header and a menu that appears on hover: <style type="text/css"> .header { position: fixed; top: 0; width: 100%; height: 50px; background: #AAA; } ...

Is it possible to position a div relative to a div outside of its parent?

Can a div be positioned relative to another div that is not its parent? Consider this scenario: <div id="header"><!-- --></div> <div id="content"><!-- --></div> <div id="footer"><<!-- --></div> In ...

Verify whether the content within the Div has been modified

I am currently making changes to content within a <div> element. I would like to determine if the data in the <div> has been modified and, if so, save it in a session to persist on refresh. How can I verify if the data has been edited and then ...

Is it necessary to refresh the page in order to display the injected jQuery UI elements

I am currently developing a jQuery Plugin for a basic game. The game inserts all required HTML into the div where it is called and links its CSS file to the header. However, I have encountered an issue when trying to reload only specific elements, such as ...

several tables all set to the identical TD width

Using a css sheet, I have formatted two tables. The first table is used for filter/sort selection, while the second table is a scrollable data table. div#scrollTableContainer { width: auto; margin: 20px; /* just for presentation purposes * ...

What is the most efficient method for choosing a class with jQuery?

I'm dealing with a Bootstrap button: customtags/q_extras.py @register.filter(name='topic_check') def is_topic_followed(value, arg): try: topic = Topic.objects.get(id=int(value)) user = User.objects.get(id=int(arg)) ...

Masonry style attempted for posts but did not produce desired outcome

I've been experimenting with different methods to achieve a masonry style layout for my posts. So far, using float:left seems to work almost perfectly, but occasionally there are gaps between the posts. I'm on the lookout for a solid solution to ...