Directional CSS box-shadow styling

I need to create a design that features cascading shadows. Here's my attempt:

box-shadow: -6px 0px 10px #514E49

However, the shadow appears in the opposite direction.

Adjusting the h-shadow parameter to 6px results in the shadow only being visible on the rightmost edge.

In an attempt to fix this, I followed Emil's advice and used inset, but it caused the v-shadow to display inset as well, appearing inside the box, which is not desired. Here is what happened:

Answer №1

Give this a try:

text-shadow:inset 4px 0px 8px #352F18;

Update:

text-shadow: 4px 0px 8px #352F18;
align:right;

http://jsfiddle.net/8B3Fh/5/

You need to rearrange the items in the menu

Answer №2

To steer clear of using float:right and flipping the menu, an alternative method is to apply a negative spread and increase the h-shadow as demonstrated below:

.box {
    background: #817E77;
    display: inline-block;
    width: 100px;
    height: 40px;
    box-shadow: inset 10px 0px 10px -4px #514E49;
    float:left;
}

Check out the jsFiddle illustration here

Answer №3

One effective solution for this issue is to utilize z-index, as it seems that the visibility of previously rendered divs is being obstructed by others.

Here's how you can implement it:

.box {
    ....insert your code here....
    float: right;
}

http://jsfiddle.net/ABC123/

Answer №4

Here is an alternative approach that doesn't require changing the menu order or relying on z-index: You can apply the box-shadow to a pseudo-element.

Check out the demo

Key CSS code:

li {
    overflow: hidden;
    position: relative;
    box-shadow: 6px 0px 10px #514E49;
    /* add other styles here */
}
li:not(:first-child):after {
    position: absolute;
    right: 100%; width: 100%; height: 100%;
    box-shadow: 6px 0px 10px #514E49;
    content: '';
}

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

button that decreases in size when clicked on

Currently, I am dealing with an element that functions as a button using a combination of Javascript and CSS. To better illustrate the issue, I will simplify the example by removing unnecessary details. The main problem lies in the fact that when this elem ...

Using jQuery to creatively manipulate background elements with dynamic CSS3 transformations

Hey everyone, I'm currently working on a project that involves creating a background effect using two images that move and fade into each other. I'm using transform translate with keyframe animation to achieve this effect. However, I've run ...

Transform CSS Selector into XPATH

Recently, I came across an interesting article about mapping CSS selectors to XPATH queries. Now, I'm on the lookout for any .NET libraries that can help with this mapping or conversion process. If you have any recommendations or suggestions on how to ...

CSS is effective when styling table elements such as 'tr' and 'td', but encounters issues when trying to include 'th'

I have a variety of tables on my website, most of them without borders. However, I want to add borders to some of them. In my CSS, I am using a specific class for those tables: table { padding: 2px; border-collapse: collapse; table-layout: auto; te ...

When it comes to adjusting the height of an element, there are two ways to go about it: using $(element).height

function adjustHeight(){ var headerHeight=$(element).find('.header').outerHeight(); console.log(headerHeight); var temp=$(window).height()-headerHeight; console.log(temp); $('.users ...

Showing information from a table for editing purposes with the use of HTML input tags

As I navigate my way through the complexities of HTML and PHP coding, I’m faced with a challenge in displaying database content on an editable table within my web page. Clicking the edit button should lead to a separate page where data can be modified. ...

Change an ASP page into an image format such as JPEG or PNG

Seeking assistance to convert my classic ASP page containing label controls styled with positioning to images in JPG or PNG format, and then send them using CDO. Using Dreamweaver for this task. Any help would be greatly appreciated. ...

excess margin running along the left side of each page

When visiting http://tadris3.ir/, one may notice a peculiar space on the left side of all pages. Can anyone assist in resolving this bothersome issue? https://i.sstatic.net/MsX1a.png ...

Styling Scrollbars in Datatables

I need assistance on styling a specific datatable scrollbar using Webkit. Below is the code snippet: id ::-webkit-scrollbar-track { background-color: transparent; border-radius: 5px; } id::-webkit-scrollbar { width: 13px; } ...

Ways to incorporate horizontal scrolling for a flex box container

I'm utilizing flexbox to design a horizontal slider in HTML. However, when using the code below: <!DOCTYPE html> <html lang="en> <head> <meta charset="UTF-8> <meta http-equiv="X-UA-Compatible" content="IE=edge> <met ...

Disabling the ability to edit the rightmost portion of an input number field

I am looking for something similar to this: https://i.stack.imgur.com/ZMoNf.jpg In this case, the % sign will be shown in the input field by default and cannot be changed or removed. The user is only able to modify the number to the left of the % sign. P ...

The div height set to 100% and using display:flex is experiencing issues in Chrome

Bootstrap 3.0 is utilized in the design. My goal is to have uniform height for all boxes, with the "more" link on the right box positioned correctly. However, the box ends before reaching the more link. Take a look at this JSFiddle example. Here is the H ...

Is there a way to prevent a Bootstrap alert from disappearing on its own?

I'm having trouble with my button's alert feature. When clicked, the alert should display and stay visible until it's closed. However, on my website, the alert quickly flashes on the screen every time the button is pressed. On my jsfiddle ...

Incrementing counters within nested div elements

Looking to implement a counter-increment feature on ordered lists. The goal is for each ol to pick up where the previous count left off. The functionality is successful when there are no separate wrapping divs around the ols. However, the issue arises whe ...

Header stabilization on scroll

On my webpage, I have a table header positioned in the middle of the page. However, due to the length of the page, I am looking for a way to make the header stay fixed at the top of the browser as the user scrolls down. My query is: Is there a method to k ...

Is it possible to dynamically convert percentages to pixels in real-time?

I am working on a project with a fluid percentage-based horizontal grid and I want to have the same vertical margins as my horizontal ones. This is the code I have: .block_12_24{ display:inline-block; vertical-align:top; width:48%; margin-right:2%; margi ...

Encountering Issues with Formatting InnerHtml Text using RegEx

Technology: React.js I have been working on a custom function in JavaScript to highlight specific words within a code block. The function seems to be functioning correctly, but the highlighting isn't staying after the function is completed. Any ideas ...

Is it possible to create a blurred effect on an image while preserving the clarity of text within

I have been attempting to create an effect where the image blurs and then reveals text. However, I have encountered issues where the image either blurs completely or behaves strangely. My code is behaving oddly, almost like it's giving a signal. (I&a ...

The grid image is refusing to fall into formation

I have been attempting to align the image in section-1 to the right side, but for some reason, it's not cooperating. I initially tried using flex-box, but I want the image to remain fixed on the right side of the screen without any movement. Floats ca ...

Triangle-shaped image mapping and interactive hover effects

I am attempting to create a simple hover effect using two triangles. One triangle should start below the other, and upon hovering, it should appear above the first triangle. The problem I am encountering is that the surrounding boxes are obstructing the e ...