Jump to content

The function close() doesn't seem to work really. Does anyone have any suggestions why? Thank you in advance!


Recommended Posts

<html>
    <head>
    <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0" />
        <link rel="stylesheet" href="style.css">
        <script>
        function close() {
            document.getElementById("popup").style.display = "none";
        }
        </script>
        <style>
            .popup {
                display: inline;
                position: fixed;
                height: 100%;
                width: 100%;
                z-index: 9999;
                background-color: red;
            }
            .inner-part {
                width: 90%;
                margin-left: 5%;
                margin-top: 50%;
                text-align: center;
                height: 30%;
                background-color: white;
                color: black;
                box-shadow: 0px 0.2vw 6vw black;
            }
            .close {
                position:absolute;
                right:6%;
                margin-top: 1%;
                background-color: lightgrey;
                padding: 2%;
            }
            .close:hover {
                background-color: red;
            }

        </style>
    </head>
    
    <body>
        <div class="popup" id="popup">
                <div class="inner-part" >
                    <div class="close" onclick="close()" >X</div>
                    <p>Welcome on my website!</p>
                    <p>This website is self written and has many issues. I would love any kind of feedback.</p>
                    <p>Please select your language</p>
                    <img src="en.png">
                    <img src="de.png">
                </div>
                
            </div>
    </body>
</html>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...