Search code examples
htmlcssiosipadsafari

The white X appears in the grey box on all browsers I have but Safari on iPad. Did I make a mistake or Safari?


On Safari on Ipad the white X appears on the right hand part of the black. This is the only Safari I have though so unsure if iPad issue or Safari issue or my issue.

https://jsfiddle.net/juvpxa8q/

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
    <title>title</title>
</head>
<body>
    <div id="main">
        <div id="piece-info-container">
            <div id="piece-info">
                <div id="piece-info-top">
                    <div class="piece-info-row">
                        <i id="close-piece-info" class="fa fa-window-close unselectable" aria-hidden="true">X</i>
                    </div>
            </div>
        </div>
        </div>
        </div>
</body>
</html>

Solution

  • Add position: relative to #piece-info-container.

    It has to do with the resetting of the children's positions.


    To be honest, it'd be best to rethink your CSS from the ground up because position:absolute inside of a sticky inside of a fixed is a recipe for trouble.

    It's quite common to be wanting to position icons in the top right corner... A good place to start could be taking a look at Bootstrap's modals. Look at the .modal-header separation and using float to position the x it to the right.