Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6221739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:11:13+00:00 2026-05-24T08:11:13+00:00

The shadow created with :before and :after goes under the parent div . How

  • 0

The shadow created with :before and :after goes under the parent div. How can I fix it? The shadow of the parent div works fine.

enter image description here

CSS:

article {
    display: block;
    position: relative;
    width: 90%;
    background: #ccc;
    -moz-border-radius: 4px;
    border-radius: 4px;
    padding: 1.5em;
    color: rgba(0,0,0, .8);
    text-shadow: 0 1px 0 #fff;
    line-height: 1.5;
    text-align: center;
    display: block;
    margin: 20em auto;
}


article:before, article:after {
    z-index: -1;
    position: absolute;
    content: "";
    bottom: 15px;
    left: 10px;
    width: 50%;
    top: 80%;
    max-width:300px;
    background: rgba(0, 0, 0, 0.7);
    -webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.7);   
    -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
    box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
    -webkit-transform: rotate(-3deg);    
    -moz-transform: rotate(-3deg);   
    -o-transform: rotate(-3deg);
}

article:after {
    -webkit-transform: rotate(3deg);
    -moz-transform: rotate(3deg);
    -o-transform: rotate(3deg);
    right: 10px;
    left: auto;
}

HTML:

<body>
    <div>
        <table>
            <tr>
                <td>
                    <div>this div has also a nice shadow effect (works), but created with another div by z-index:-1;
                        <article>
                            <p>this will have a nice shadow effect(doesnt work)</p>
                        </article>
                    </div>
                    ...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:11:15+00:00Added an answer on May 24, 2026 at 8:11 am

    JS fiddle of the posted code, cleaned up a bit.

    The :before and :after pseudo-selectors allow you to add content to the text node of the element. You cannot add additional elements or nodes into the DOM using these pseudo-selectors.

    I’m not sure what content you’re wanting to style since you’re appending a blank string, but right now you’re trying to add a box shadow to text.

    Additionally, you have completely garbled indention in your CSS, and you have some rogue HTML tags. You should spend 12 seconds looking at the code you posted up for us to spend time reading in order to deduce and help with your misunderstanding; if you respect our time by spending time on your question, you would get better help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the titles says, my css works fine locally when using ie9, but when
How can I add a drop shadow effect to a website that has one
I'm looking at all the CSS Drop shadow tutorials, which are great. Unfortunately, I
I would like to use WebKit's box-shadow css property for a little drop-down. The
Our designer created a mockup of our frontend using HTML and CSS. However, when
I have a parent div #modal_share that contains a floating div modal_big_hline and a
I've created the following script #!/bin/bash shdw=$(cat /etc/shadow | cut -d: -f1,2) users=$(cat /etc/passwd
I created a borderless window and i want to remove its shadow. This is
I hope someone can help with this. I have created a map app that
I have a parent div (container) that has a child div (inner) which also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.