how to set css property of one class from another class


Tags: asp.net,css

Problem :

I am applying css style to "body" and to a div which id is "overlay" like:

body
{
    margin:0;
    background:#FEFEFE url(../Images/gradientHeader1.png);
    background-repeat:repeat-x;
}

overLay
{
    background-color:#666666;
    height:1000px;
    left:0;
    opacity:0.5;
    position:absolute;
    margin-top:0;
    width:100%;
    z-index:1003;
}

"overLay" div is inside noscript tag which renders in the browser only when javascript is disabled in the browser.My requirement is that I have to set "overflow:hidden" in the body when "overLay" div get rendered.Can I set overflow property of the body from #overLay?or any other way?



Solution :

Yes you can do this without scripting:

<noscript>
    <div id="overLay">whatever</div>
    <style type="text/css">
        body {
            overflow: hidden !important;
        }
    </style>
</noscript>

(You also need a # in your CSS rule: #overLay { ... })


    CSS Howto..

    How to get “position:fixed” css to work in IE 7+ with TRANSITIONAL doctype?

    How do I make cards of different heights fill gap in css? [duplicate]

    How do i prevent my CSS affecting external plugins?

    How do I center a menu option under it's heading option in a drop down menu?

    How to crop and design these images like this using html and css? [closed]

    How to grey out a box in CSS

    CSS How to get rid of border that appears around custom button on and after click

    How to display mouseover effect in GridView rows using only CSS?

    CSS Button Animation - How to Accomplish?

    How to make my asp chart scrollable in the x direction

    CSS: how to set width to children's width?

    Show/Hide tr elements based on multiple CSS classes and input from multiple checkboxes

    how to stop CSS hyphenation, no dash between words

    Hover over a pre - how to highlight a single line with plain CSS?

    How to put images behind each other in css

    How to set two divs side-by-side with the same height?

    How can I adjust the Wordpress Twentyeleven theme so that the page width is 100% and centered?

    How can i include only custom css and js files in rails application

    How to make xsl show only images/captions from xml

    How can I create a nav bar with a repeat image inside?

    How to use CSS media query to scale background-image to viewing window

    How to align logo and text in bootstrap on small screens?

    How do you add pseudo classes to elements using jQuery?

    CSS - How to center nested divs?

    Chrome & Firefox not rendering bold font-weights of Avenir, but Safari does! How to fix?

    How to reveal content behind a div with pure css?

    Keyboard Showed messed up elements' position

    How to adjust the size of the input component?

    CSS floats - how do I keep them on one line?

    How to determine if a device is in portrait or landscape mode using CSS