The box shadow feature does not function properly when the position is set to sticky

Applying position sticky to th and td in the example below seems to be causing issues with the box shadow not working.

Can anyone provide insights on why this is happening?

<div class="overflow-x-auto lg:overflow-visible">
  <div>
    <table class="border-collapse table-fixed w-[1000px] lg:table-auto lg:w-full border border-grey-200">
      <thead class="bg-grey-200">
        <th class="sticky left-0 top-0 p-4 z-10 shadow-grey w-[116px] lg:w-[140px] bg-grey-200"></th>
        <th class="p-4 align-middle text-body-30-m text-left" v-for="(header, headerIndex) in data.headerColumns" :key="headerIndex">
          {{ header }}
        </th>
      </thead>
      <tbody>
        <tr class="border border-b-grey-200" v-for="(row, rowIndex) in data.rows" :key="rowIndex">
          <td class="border border-r-grey-200 align-top" :class="
                  cell.icon
                    ? `grid p-4 justify-center border-0`
                    : cell.image
                    ? `text-center p-4 sticky left-0 shadow-grey bg-white z-10 w-[116px] lg:w-[140px] `
                    : cell.text
                    ? `text-left p-4 pr-8`
                    : `p-4`
                " v-for="(cell, cellIndex) in row.cells" :key="cellIndex">
            <div v-if="!cell.text && !cell.icon && cell.image && cell.link" class="grid grid-flow-row gap-3">
              <img :src="cell.image" :alt="cell.altText" />
              <span>{{ cell.link }}</span>
            </div>
            <span v-if="!cell.image && !cell.link && !cell.text"><smyths-icons
                    v-if="cell.icon"
                    :name="cell.icon"
                    size="24"
                    color="#008540"
                  ></smyths-icons
                ></span>
            <span v-if="!cell.image && !cell.link && !cell.icon">{{
                  cell.text
                }}</span>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

Answer №1

To give an element a shadow using the Tailwind library, simply include the shadow keyword in the class declaration as shown below:

<th class="sticky left-0 top-0 p-4 z-10 shadow shadow-grey w-[116px] lg:w-[140px] bg-grey-200"></th>

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

Share information from Vuex getter to component property

I'm seeking a way to retrieve data from the Vuex config state and pass it as a prop to a component for an autocomplete feature. I am struggling with the correct syntax to achieve this. My attempts so far have been unsuccessful. Would it be necessary ...

The absence of FontAwesome Icons is apparent

In the <head> section of my code, I include the following: <script href="https://kit.fontawesome.com/a076d05399.js"></script> Within some of my buttons, I have the following code: <div class="scroll-up-btn"> ...

Reasons for aligning inline elements with input boxes

I am facing a challenge with aligning a series of inline elements, each containing an input text box, within a single row. The number and labels of these input boxes can vary as they are dynamically loaded via AJAX. The width of the div housing these inli ...

Disappearance of logo div causes video to vanish

Hey there fellow coders! I'm facing a little issue. I'm attempting to replicate my webpage on another page, but every time I try to remove the logo, the video disappears as well. It's quite puzzling. I have the code in place, but it seems l ...

What is the best way to retrieve a style property from a <style> tag using JavaScript?

Is there a way to retrieve CSS properties set in the <style> tag in JavaScript, rather than just those set in the element's style attribute? For example: <style> div{background:red;} </style> How can I access these styles, such ...

The DateRangePicker feature is unable to identify dates from the carbon library

Utilizing Vue.js ( Vue-Tables https://www.npmjs.com/package/vue-tables ) in conjunction with laravel. The data is successfully being displayed, however the daterangepicker () is not sorting as expected. Regardless of the interval set, the records fail to d ...

Aligning text and lists using Bootstrap on both desktop and mobile devices

I want to format a text with a list similar to the images provided https://i.stack.imgur.com/6giDH.png for desktop and tablet view, but for mobile display I would like it to look like this https://i.stack.imgur.com/7zSXi.png This is my current approach ...

Having trouble getting Tailwindcss to work with Next.js - what could be causing the configuration issue?

Why is tailwind not displaying correctly in my next.js project? I'm concerned that there might be a problem with my settings. In the styles folder, I have a file called tailwind.css @tailwind base; /* Write your own custom base styles here */ /* S ...

Unable to eliminate top margin in Bootstrap 3 affix feature

Struggling to locate the source of the margin-top when utilizing the affix plugin on my Navbar. You can view [my website here] for better understanding. Should I be implementing Javascript to solve this issue? My current skills in that area are not very ...

Can you explain the functionality of dismissing a Bootstrap alert?

In this example, we can see how Bootstrap handles dismissible alerts: <div class="alert alert-warning alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidde ...

Various image dimensions cause divs to shift unevenly

Here is the current setup: <div class="row"> <div class="col-md-4 content-column"> <img class="btn-center btn-desktop" src="images/buttons/btn-desktop.svg" alt="desktop button"> <h2 class="btn-deskt ...

How to apply hover effect to an image within a div using TailwindCSS

Is there a way to animate only the image and not the entire card (div) when hovering over it? I want specifically for the image to perform an animation, such as bounce effect. I'm using next/image for displaying the image. Can this animation be achie ...

I am experiencing issues with the functionality of the Search Button in my code

I am experiencing an issue with the Search Button in my Search Form. I created the Search form using only html and pure CSS to test whether JS is necessary for a Search form with Drop Down Filter! Do I need to incorporate some JS code or is it feasible to ...

Hide only the table that is being clicked on, not all tables

Essentially, I am using document.querySelectorAll() to retrieve an array of div elements. In my function, handleClick(), each time the button is clicked, I want to hide the table associated with that specific button. This is the current situation: https:/ ...

Eliminate inner margin from the canvas of a bar chart created with ChartJS

I am looking to use Chart.js to create a single stacked bar chart that visualizes progress towards a specific financial goal. I have added a dotted line on top of the chart to represent this goal amount. The issue I am facing is that there is unwanted pad ...

Utilizing Bootstrap 4 columns to control the height of a separate column

Is there a way in CSS to make one column in a bootstrap grid determine the height of another column within the same row? For example, consider the following scenario: <div class="row"> <div class="col col-sm-6" id="column1"> <!-- an e ...

Tips for positioning text on the left and right sides of a div in HTML styling

I am struggling with positioning two pieces of text within a div. Despite having some styling already in place, the text is currently displaying one after the other on the left-hand side. I want to position one piece of text to the left and another to the ...

What is the best way to integrate data-bs-toggle into my code?

I am currently exploring the use of data-bs-toggle with Bootstrap, but as a newcomer to the framework, I might be missing something essential in my setup. When attempting to implement data-bs-toggle, I notice that my autocomplete suggestions only include d ...

Is it normal for Tailwind animation to loop twice when transitioning between pages in Next.js?

I'm currently utilizing react-hot-toast for displaying alerts and animating them during page transitions. The animation involves a double fade-in effect when transitioning between pages. In my project, I've integrated tailwindcss-animate within ...

Is there a way to access the scrolling element on the current webpage?

When the route changes, I need to locate the element with scrolling functionality on the new page and scroll it to the top using window.scrollTo(0,0). How can I achieve this? Here is my current code snippet: if (process.client) { router.afterEach((to, ...