What causes html elements to lose their border-radius when they are being dragged?

Why did the element lose its border-radius when I dragged them? It seems like the element is cutting into the background to fill the four corners. Click here to see

CSS class for item:

.list_item_pic {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 3vh;
  background-size: cover;
  transition: all ease 0.3s;
}

CSS class for container:

.playlist_display_area {
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
  width: calc(100%);
  height: 60vh;
  padding: 0 10px;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, 28vh);
  grid-template-rows: repeat(2, 28vh);
  /* grid-template-columns: repeat(auto-fill, minmax(28vh, auto));
  grid-template-rows: repeat(auto-fill, minmax(28vh, auto)); */
  grid-auto-flow: column;
  display: grid;
}

React JSX code snippet:

<div className="playlist_display_area">
            {playLists?.map((playlist) => {
              const songs = playlist.songs;
              let listBg = songs[songs.length - 1]?.AlbmPic;
              listBg = listBg || this.trackBoxBgArr[getRandomInt(0, 5)];
              return (
                <div
                  key={playlist.listId}
                  className={`list_item_pic ${playlist.boxSize}`}
                  onContextMenu={(e) =>
                    this.onContextMenu(e, playlist, playLists)
                  }
                  draggable="true"
                  onDragStart={() => this.handleDragStart(playlist.listId)}
                  onDrop={(e) => this.ondrop(e, playlist.listId)}
                  onDragOver={(e) => this.handleDragover(e)}
                  style={{ backgroundImage: listBg }}
                >
                  <div className="list_inside_label">{playlist.name}</div>
                </div>
              );
            })}
          </div>

View without picture

Answer №1

It seems that in this particular scenario

className={`list_item_pic ${playlist.boxSize}`}

The playlist.boxSize property is likely affecting the border radius of the element.

To avoid this, you can simply switch the order of the classes like so:

className={`${playlist.boxSize} list_item_pic`}

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

Some Firebase functions are being blocked by CORS policy restrictions

When working with FireBase cloud functions, I encountered a CORS policy error that only occurs with certain methods. For instance, my GET and POST requests work perfectly fine, but when attempting to delete or edit an object, the CORS policy error immediat ...

Can you explain the distinction between HashRouter and BrowserRouter within React?

Learning programming can be a challenge, especially when trying to decipher official documentation. I recently came across an article discussing the differences between React Router 4 The author delves into the differences between <HashRouter> and ...

Building a vertically expanding search box using HTML and CSS

I am working on creating an expandable search box for a navbar. The goal is to have the search box expand when the user clicks on it, revealing another input box with a different name input. I would like to have two search boxes, stacked one under the othe ...

Revamp the UI Framework's CSS to accommodate the latest Web Components

I've implemented Grommet as the UI Framework for my React page. However, I encountered a situation where certain web components, like a web chat control, are not covered by Grommet's CSS. What is the simplest way to style these additional web com ...

How can I modify CSS styles in AngularJS with Bootstrap UI?

Utilizing bootstrap UI in conjunction with AngularJS directives, I am looking to customize the default styles that bootstrap applies to its elements. Is it recommended to target the HTML contents within the template? Referring to the examples provided in ...

trouble with padding on cards using vue-bootstrap

I have been working on creating a card component with Vue Bootstrap, but I've run into an issue. The card header and body seem to have excessive padding around them. If I remove the b-card element and only use b-card-header and b-card-body, it looks l ...

Bug encountered in ReactJS with Material-UI integration

Encountering an error while working on a basic app with two routes, one for '/' and the other for '/search', utilizing material-ui components. The issue arises when navigating to '/search', triggering the following error: De ...

Syncing OrbitControls rotation with camera rotation for improved navigation

Currently utilizing @react-three/fiber to incorporate first person controls (WASD & cursor keys) along with OrbitControls for scene navigation. Mirroring PointerLockControls, I've successfully implemented the WASD controls by updating the target vecto ...

Showing various records dynamically with AngularJS

I have some AngularJS Code below where I am currently adding four records to roleList. However, I would like to be able to add any number of records to roleList. Is there a way for me to achieve this? $scope.roleList = [ {"companyName": "Company 01" ...

The styled component is not reflecting the specified theme

I have a suspicion that the CSS transition from my Theme is not being applied to a styled component wrapped in another function, but I can't pinpoint the exact reason. I obtained the Basic MUI Dashboard theme from this source and here. Initially, inte ...

Centering a table horizontally using CSS when its position is set to absolute

I currently have 5 HTML pages with identical code. The code snippet looks like this: <div id='generic'> </div> All 5 pages are linked to an external CSS file that contains the following styling: <style> #generic { ...

There is an error in the TypeScript code where it is not possible to assign a string or

I'm struggling to resolve a typescript error. Upon checking the console log, I noticed that the regions returned by Set are an array of strings, which aligns perfectly with the region type in my state. Why isn't this setup working as expected? S ...

Endless visual possibilities and converting three-dimensional content with the help of HTML, CSS, JavaScript, and Bootstrap

Can you assist me in creating infinite images and implementing a 3D translation similar to this link [https://public.work/] I am using HTML, CSS, JS, and Bootstrap 5 Your feedback would be highly appreciated. If there are alternative methods to achieve t ...

RequestDispatcher.forward() does not work when servlet is invoked through an Ajax POST request

My login page involves user authentication through the firebase and sending the request to a servlet. When I click the submit button with correct credentials, the firebase authentication works, the servlet is called but an error is displayed in the browser ...

Tips for adjusting inner margins on ion-card elements in Ionic 4

Currently, I am attempting to create a card that contains text with specific spacing from the border. My first attempt involved setting padding for the card, but I found that the top and bottom spacing was too large. In my second attempt, I decided n ...

The method of altering a menu link in WordPress using jQuery varies according to whether the user is logged in or not

I need to update the last link on my menu. When a user is logged in, it should display a profile link; otherwise, it should show a sign-up link. ...

Guidelines for calculating the CRC of binary data using JQuery, javascript, and HTML5

Can you please assist me with the following issue? Issue: I am currently reading file content using the HTML5 FileReaderAPI's ReadAsArrayBuffer function. After storing this buffer in a variable, I now need to compute the CRC (Cyclic Redundancy Check) ...

Arranging divs with CSS positioning

I struggle with positioning divs, especially in this particular situation. I am attempting to position boxes in the following layout: _ ___ _ |_|| ||_| _ | | |_||___| Is there a way to avoid manually defining pixel positions for each box and ins ...

What is the best way to display a single image across multiple devices?

I'm just starting out in the world of mobile development and I have a burning question on my mind. If I want to display an image at 100% width and height on any mobile phone screen, what should be the ideal size for that picture? What are some typic ...

Customize Autocomplete nested styles with Material UI version 4.11.0

I'm currently attempting to customize the input styling for the autocomplete component. I have managed to override some of the styles in the theme, but I am struggling to remove the underline from the input field. Even after inspecting it in the devto ...