Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Тень на весь экран (https://javascript.ru/forum/misc/25499-ten-na-ves-ehkran.html)

Gamestop 07.02.2012 15:05

Тень на весь экран
 
Люди как можно грамотно сделать тень на весь экран и чтобы по центру можно-бы было поставить какой-нибудь блок?

и чтобы оно было по центру когда окно двигалось вверх или вниз??

немогу понять как это сделать, каждый раз криво выходит

devote 08.02.2012 23:33

<!DOCTYPE html>
<html>
    <head>
        <title>...</title>
        <style type="text/css">
            html, body {
                margin: 0;
                padding: 0;
                height: 100%;
                background-image: url('http://sites.google.com/site/jaimemontoya/Sample07.jpg');
            }
            .shadow {
                position: fixed;
                width: 100%;
                height: 100%;
                background-color: #000;
                opacity: 0.7;
            }
            .center_block {
                position: fixed;
                left: 50%;
                top: 50%;
                margin: -100px 0 0 -100px;
                width: 200px;
                height: 200px;
                background-color: #f00;
            }
        </style>
    </head>
    <body>
        <div class="shadow"></div>
        <div class="center_block"></div>
    </body>
</html>


Часовой пояс GMT +3, время: 10:20.