Conceal top shadow with box shadow

I've been through about 10 questions on this topic and couldn't find a solution that fits my specific situation.

Here's an example I created:

http://jsfiddle.net/Y4uHm/4/

I'm trying to hide the shadow at the top of the content box. Not sure if I'm approaching it the right way, or if there's a better method than using backgrounds for side shadows. Any suggestions would be greatly appreciated!

Here's some code:

HTML code

<div class="container-wrapper">
   Your header content goes here
 </div>
 <div class="container-wrapper breadcrumbz">
   <div class="pusher"></div> <!-- Just for experimental purposes -->
   <div class="content">
      There should be no shadow on top of this block
   </div>
 </div>    

CSS

body {
    background: #4ca8cb;
}
.container-wrapper {
    margin: 0 auto;
    max-width: 500px;
    padding:0 50px;
}

.breadcrumbz {
   background: url('https://dl.dropboxusercontent.com/u/14562883/shadowline.png') no-repeat top center;
}
.pusher {
    height: 14px;
}
.content {
    box-shadow: 0px 0px 3px 1px #555;
    background-color: #e7eaeb;
    height: 200px;
}

Update

I managed to solve the issue by moving the bottom block "under" using CSS properties like position:relative and negative margins.

You can see the updated solution here: http://jsfiddle.net/Y4uHm/7/

Answer №1

you have the option to utilize the :before pseudoelement

        .section {
            background-color: #e7eaeb;
            height: 200px;
            position: relative;
        }
        .section::before {
            content: "";
            position: absolute;
            width: 100%;
            height: 198px;
            background-color: transparent;
            z-index: -1;
            box-shadow: 0px 0px 3px 1px black;
            top: 2px;
        }

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

Change all lowercase characters to uppercase in the font file

: I recently created a .ttf font file, but unfortunately only included capital characters. Is there a tool or simple method I could use to automatically create lowercase versions of each letter? For instance, when typing "hello" the font should display ...

CSS Rules with Lower Specificity Will Take Precedence Over Rules with Higher Specific

Currently, I am enrolled in an online web development course and have been working on creating webpages to grasp the concepts of HTML and CSS. However, I encountered an issue where the font-family rules in my p and h3 elements were overriding the font-fami ...

Display a substitute image if there is no internet connection available to load the Google Map Canvas

I have a WebApp that runs locally, but it's possible that users may not always have access to 3G/WiFi when using the app. This means that the Google Map will not load without an internet connection since it requires the web API. In order to provide a ...

Create an array from the content of a textarea, iterate through it using a loop, and send the data to

Using PHP, I have successfully received data from users submitted in a textarea, split it by line breaks, and processed it using a foreach loop. However, when users submit a large amount of data, the server becomes overwhelmed and returns a 504 Gateway err ...

Utilizing Bootstrap to display selected portions of the list content

I am working with a select element that looks like this: jQuery('.my-select').selectpicker(); .list_img{ width: 30px; height: 30px; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script ...

Using Django Form with Bootstrap: Incorporating CSS classes and <div> elements

I am currently implementing Twitter Bootstrap with Django to style forms. Bootstrap can enhance the appearance of forms, but it requires specific CSS classes to be included. My challenge lies in the fact that Django's generated forms using {{ form.a ...

Styling a span within a row in Bootstrap to automatically indent using CSS

I have integrated Bootstrap into my project and I am utilizing its grid system. I start by creating a row, then adding a span inside the row which functions as a column (col-12). The text inside this span is underlined, with <br> elements used to se ...

What encodings does FileReader support?

Are you looking to easily read user-input files as text? If you can count on modern browser usage, then using FileReader is the way to go (and it works exceptionally well). reader.readAsText(myfile, encoding); It's worth noting that encoding defaul ...

Python-JavaScript Integration Problem

I'm a beginner when it comes to Javascript, Python, and PHP. In my Javascript program, I have a button that triggers a Python script and displays the returned value on the screen. My goal is to steer clear of using Jquery and Json. Here are the snipp ...

PHP Session-Based Language Toggle

I have implemented a simple session switch on my website to make it bilingual. However, there is a flaw - whenever the user switches to the other language, they are redirected back to the index page. I am looking for a solution that allows the user to stay ...

Unable to center div container with margin set to auto

I'm struggling to center my container on the website. My goal is to have it centered and take up about 80% of the page so I can incorporate an image slider and text inside. Using margin: 0 auto doesn't seem to be achieving what I want. The backgr ...

Struggling to display the retrieved data on the webpage

Code in pages/index.js import React from 'react'; import axios from 'axios'; import ListProducts from '@/components/products/ListProducts'; const getProducts = async () => { const data = await axios.get(`${process.env.AP ...

What is the best way to customize the endIcon of a styled-component button?

Presented here is a neatly styled button I've created import styled from 'styled-components'; import Button from '@material-ui/core/Button'; import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos'; const MyB ...

What is the method of utilizing variables as selectors in HTML/Bootstrap4?

I've been working on creating an accordion in Bootstrap using a for loop, but I'm facing an issue where every card expands/collapses when I click the button. I suspect this is because all cards share the same id attribute and I want to use the po ...

What are the differences in performance between jQuery and other libraries?

Which option offers superior performance? $('input[data-confirm],a[data-confirm],button[data-confirm]'); or $('[data-confirm]'); The $('[data-confirm]') selector is more versatile, but does it require jQuery to search thro ...

Steps for automatically redirecting to a specific page upon form submission

After submitting the form, typically the server sends the inserted data as an email and redirects you to the Home page. However, I wanted to have control over the redirection after form submission rather than letting the server handle it. To achieve this, ...

A guide on using wrapAll within an each loop in jQuery

I have a series of div elements in my HTML code: <div class="mainClass class_1"></div> <div class="mainClass class_1"></div> <div class="mainClass class_2"></div> <div class="mainClass class_2"></div> <di ...

What is the best way to change a variable's type from string to integer in Javascript?

Check out the fiddle I created: https://jsfiddle.net/ajc100/vrzme0st/ I have been working on an insurance calculator (with fake numbers) using a form with radio buttons and dropdowns where the value of each selection is a number. Currently, I am able to d ...

I attempted to layer multiple images on top of each other, but unfortunately, the background has disappeared

I am attempting to align a series of images together, but I seem to have lost the background in the process. I am using "position:absolute" and while the images stack nicely due to their correct sizes, there seems to be an issue with the backgrounds. My go ...

Is there a way to resolve the warning message "The shadow-piercing descendant combinator (>>>) is deprecated" that appears when running ng build for production?

I keep receiving warnings when I run ng-build -c production for all my styles that contain the '>>>' notation. Warning: ▲ [WARNING] Unexpected ">" /Users/mike/project2022/client/src/app/bank/bank-new/bank-new.component.ts-angular- ...