• Resolved eftbet5

    (@eftbet5)


    Hello, I’ve been reading for several days, trying to learn how to put a shadow behind my pages. I’m new to css but did successfully get rid of the search box in the menu bar.

    My background is dark gray – is there a way to do a shadow that shows against a dark background? Would it work to make it lighter than the background?

    Can anyone give me some specific code and exactly where to put it? Or tell me where to read, if I should be able to figure this out. <s>

    url: http://www.eftbetsycrouse.com

    Thanks for any help!
    Betsy

Viewing 9 replies - 1 through 9 (of 9 total)
  • Do you mean like a drop-shadow?

    There is a CSS property called box-shadow that will do that. You can make it whatever color you like.

    To give it a try, you’ll just add one line of code in the section on line 326 of your child theme’s style.css file that affects the div with the id “page.” That block of code currently looks like this:

    #page {
        background: none repeat scroll 0 0 #FFFFFF;
    }

    To add a black shadow, you’d just add the box-shaddow line to make that code block look like this:

    #page {
        background: none repeat scroll 0 0 #FFFFFF;
        box-shadow: 25px 25px 25px #000000;
    }

    You can read about the box-shadow property here. You can change any of the parameters, including the color, of course.

    Thread Starter eftbet5

    (@eftbet5)

    Thank you linux4me2! A further question – in my child theme’s style.css file this is all I have:

    /*
    Theme Name: twentyeleven child LMF
    Theme URL: http://www.eftbetsycrouse.com
    Description: twentyeleven child theme for LMF
    Author:Betsy
    Template: twentyeleven
    */
    @import url(‘../twentyeleven/style.css’);

    Should I copy over all the code, instead, so I can work with it the way you describe when I’m making changes?

    Thanks much,
    Betsy

    That line with “import” in it is importing the entire contents of your parent theme into the child theme, so really all you need to do is put the code for the changes you make in the child theme’s style.css so it would look like this:

    /*
    Theme Name: twentyeleven child LMF
    Theme URL: http://www.eftbetsycrouse.com
    Description: twentyeleven child theme for LMF
    Author:Betsy
    Template: twentyeleven
    */
    @import url('../twentyeleven/style.css');
    
    #page {
        box-shadow: 25px 25px 25px #000000;
    }

    Since your child theme’s style.css is read after the parent theme’s style.css, your settings in the child theme will supercede any similar settings you have above in the majority of cases. (There is an exception involving the use of the “!important” keyword in CSS, but that’s not in play here.)

    If I’m making a lot of CSS changes in a child theme, I copy and paste all the CSS (except the section at the top with the theme name, description, etc. between the “/*” and the “*/”) from the parent theme to the child theme’s style.css. The reason I do that is that it prevents the end-user’s browser from having to do extra formatting and CSS overriding when there are a lot of duplicate entries. You can do that if you like, but if you’re just making a few changes, you don’t need to copy it all, and in this case, you’re actually adding a setting, so you don’t need to worry about it because the browser won’t be doing extra work like it would if you were duplicating a setting.

    Just to emphasize, any changes you make should be made in the child theme’s style.css, not in the parent theme’s style.css, or they will be overwritten every time you upgrade WordPress and the theme is updated.

    Thread Starter eftbet5

    (@eftbet5)

    Got it – that is so helpful! Thank you thank you. The end result is exactly what I want, and it’s really helpful to understand a little more about inserting code. You write in a very clear, easy to understand manner. I’ve been reading and reading, but a lot of the time I have to skip an article because it’s written above my current ability to comprehend.

    And I’ll study the resource you sent to learn more about using shadows, which I’m sure I’ll use in other places.

    And I do understand to always make changes in the child theme.

    THANKS!! I’m sending you a hug. 🙂

    Betsy

    🙂 Thanks for the hug. I’m glad you got it working.

    Thread Starter eftbet5

    (@eftbet5)

    I have discovered that the drop shadow behind my pages is not showing up in Internet Explorer. And my menu bar (from which I’d removed the search box) is gone (do I need to start a different topic question for each?)

    Both look correct in Firefox – shadow shows, menu bar minus search box in place.

    Can anyone help? http://www.eftbetsycrouse.com

    Thank you!
    Betsy

    You’re experiencing the wonderful world of browser-compatibility, and problems are usually with IE. Box-shadow is only supported in IE9 and above, so users of IE8 and lower won’t see it, but I wouldn’t think having it there would break anything; IE8 and below should just ignore it.

    You might test by reversing the changes you made to remove the search box from the menu bar to see if the menu bar then shows up in IE. If it does, you can find a new way to remove it either by posting here or in a new thread. You are using a child theme of Twenty Eleven, it looks like, which has lots of compensation built in for older versions of IE so ordinarily you should be okay with most of the CSS.

    Thread Starter eftbet5

    (@eftbet5)

    Thanks linux4me2 – I was hoping you might be back! I’ll try the testing as soon as I can and let you know. I think the menu bar might have disappeared right after I removed the search box, before I added the shadow. I saw that it was gone in IE but I had a little trouble with my hosting site at the time of that change, and thought that was why. Coming back to check for the shadow in IE I saw it was still gone…

    I’ll also install Chrome, Safari and Opera so I can always do my cross checking. I’m sure there will still be some glitches, but doing that should help.

    Thanks for your time in writing! I’ll come back with a report.
    Betsy

    Thread Starter eftbet5

    (@eftbet5)

    Hi Linux4me2 – I’d said I’d report back and in any event I should have marked this resolved because you helped me fix the shadow problem, which is what the thread was about. I just got help for the menu bar problem, and wanted to report that all is well!

    Thanks for your help back then,
    Betsy

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Put shadow behind theme page twentyeleven dark background’ is closed to new replies.