Why is marginal work, but not at the bottom?

I have the following HTML markup, and I want the div div tag to always be 5 pixels from the bottom of the parent container.

I can manually use it with a trial and erroneous position using margin-top, but if I had to change the logo or resize the div, I would have to change this value again using the trial version and error. A much better solution would be to say whether to always be at a distance of 5 pixels from the bottom, and not indicate that it is X pixels on top.

Why is this not working? alt text

<body>
    <div id="header">
        <img src="../../Content/images/cumaviLogo.png" alt="Cumavi.com - Compras y ventas online en Bolivia!" />    
        <ol id="topuserbar">
            <li>Bienvenidos, <span class="userSalute">Sergio!</span></li>
            <li><a href="#">Mis Anuncios</a></li>
            <li><a href="#">Perfil</a></li>
            <li><a href="#">Cerrar Sesion</a></li>
        </ol>
    </div>

    <asp:ContentPlaceHolder ID="MainContent" runat="server" />
</body>

#header
{
    background-image: url('images/headerBackground.png');
    background-repeat:repeat;
    width:auto;
}

#topuserbar
{
    border: 1px solid red;  
    font-family:Georgia;
    font-size:large;
    float:right;
    margin-top:45px;  
}

#topuserbar ol
{
}

#topuserbar li
{
    display:inline;
    margin-left:10px;
    color:#fff;
}
+3
source share
3 answers

HTML, , , . , ol div, -Ypx.

, , ol div .

DOM, ol -Ypx.

... .

0

ol, ... , , .

position: absolute css. position: relative . bottom: 5px; . 5px , , .

, , , .

+1

Well, I always encourage people to use the reset.css file http://meyerweb.com/eric/tools/css/reset/

And why ol? I think ul makes more sense in such a menu ...

0
source

Source: https://habr.com/ru/post/1769471/


All Articles