【问题标题】:How can I position the link to the top right area? (Absolute positioning with a header as a relative)如何将链接定位到右上角区域? (以标题为相对的绝对定位)
【发布时间】:2020-12-28 19:06:24
【问题描述】:

我正在尝试将动漫链接转到右上角区域,但不能。只设法这样做,但它的最大位置是直到另一个标题的底部。我在这方面绝对是新手。 我设法做到了

#Header {
        position:fixed;
        background-color:#FFFFFF;
        width: 100%;
        height: 8%;
        top:0px;
    }
    #Header h1{
        margin-top:0px;
        position: relative;
    }
    #Header a{
        color:rgb(255,0,0);
    }
    #Header h3{
        position:absolute;
        top: 0px;
        right: 0px
        margin-top:0px;
    }
<div id=Header>
<h1>
imsmoothlikebutter
</h1>
<h3>
<a href= "anime" Target="Blank"> Anime</a>
</h3>   
</div>

【问题讨论】:

    标签: html css css-position absolute


    【解决方案1】:

    我想你忘记了第 18 行的分号。

    #Header {
            position:fixed;
            background-color:#FFFFFF;
            width: 100%;
            height: 8%;
            top:0px;
        }
        #Header h1{
            margin-top:0px;
            position: relative;
        }
        #Header a{
            color:rgb(255,0,0);
        }
        #Header h3{
            position:absolute;
            top: 0px;
            right: 0px; /* You forgot a semi-colon on this line */
            margin-top:0px;
        }
    <div id=Header>
    <h1>
    imsmoothlikebutter
    </h1>
    <h3>
    <a href= "anime" Target="Blank"> Anime</a>
    </h3>   
    </div>

    【讨论】:

    • 那太尴尬了!非常感谢!
    猜你喜欢
    • 2021-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-23
    • 2015-07-28
    相关资源
    最近更新 更多