【问题标题】:How could I make the logo follow the fixed position header?如何使徽标跟随固定位置标题?
【发布时间】:2011-09-18 07:23:42
【问题描述】:

我有一个大约 40 像素高的固定位置标题栏。 它位于原始(未滚动)位置的 80 像素高徽标上方。

当我向下滚动传递原始徽标时,我希望缩小徽标(并放置到标题栏)。 我怎么能这样做?

(我希望它看起来像 TechCrunch

【问题讨论】:

    标签: html css position fixed graphical-logo


    【解决方案1】:

    我不确定您是否真的想模仿链接中的效果,但如果您这样做了,那么这是一个示例:see demo fiddle

    样式表:

    #header {
        height: 40px;
        width: 100%;
        position: fixed;
        top: 0;
        background: #fff;
    }
    #content {
        margin-top: 41px;
    }
    #logo {
        position: relative;
        height: 200px;
        width: 200px;
        top: -41px;
        float: left;
        margin-bottom: -41px;
    }
    

    标记:

    <div id="header">
        <img src="..." alt="" />
        Menu
    </div>
    <div id="content">
        <div id="logo">
            <img src="..." alt="" />
        </div>
    </div>
    

    在 Win7 的 IE7、IE8、IE9、Opera 11.51、Safari 5.0.5、FF 6.0、Chrome 13.0 中测试。

    【讨论】:

    • 非常感谢。我真的很感谢你的帮助。 +1 并接受:)
    猜你喜欢
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-03
    • 2014-06-23
    • 1970-01-01
    • 2014-03-19
    相关资源
    最近更新 更多