The height of the innermost element is defined as a percentage, and the height is determined by the outermost element.

    <style>
        .base {
            margin: 30px 0 0;
            min-height: 500px;
            position: relative;
            border: 1px solid black;
        }
        .outer {
            padding: 15px 0;
            width: 100%;
            box-sizing: border-box;
            border: 1px solid -sharp00bb54;
        }
        .parent {
            padding: 0 2%;
            height: 47px;
            display: block;
            border: 1px solid -sharpf75959;
        }
        .parent a {
            display: inline-block;
            position: absolute;
            right: 2%;
            height: 50%;
            border: 1px solid darkblue;
        }
    </style>
<div class="base">
    <div class="outer">
        <div class="parent">
            <a href="-sharp"></a>
        </div>
    </div>
</div>
The

code is shown above with the following result:

clipboard.png

Mar.25,2022

has this effect because the innermost element is set to absolute positioning, which is referenced by the ancestral element closest to him with relative or absolute positioning attributes, so here we will use base as a reference to set the height of element a

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea75b7-1e51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea75b7-1e51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?