【问题标题】:Headline of responsive portfolio doesn't behaves correctly响应式投资组合的标题行为不正确
【发布时间】:2017-05-29 20:10:49
【问题描述】:

不幸的是,如果我在较小的设备上打开网站或调整浏览器窗口的大小,标题总是会滑倒:

danieljwerner.com

代码的受影响部分在这里:

<div class="header-content">

<?php

require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;

if ($detect->isMobile() ) {

        echo '<div class="header-content-inner" style="margin-top:-17%;">';

} else {

        echo '<div class="header-content-inner" style="margin-top:17%;">';

}

?>

<h1 id="homeHeading">What will shape the future?<br>Let's find out.</h1>

谁能给我一个提示?我不明白为什么浏览器不能正确地从百分比计算像素...... 感谢您的支持:)

【问题讨论】:

    标签: css web responsive-design


    【解决方案1】:

    标题因header .header-content 设置的绝对位置而滑动。另外,删除.header-content-inner上的margin-top

    删除这个:

    @media (min-width: 768px)
    header .header-content {
        position: absolute;
        top: 50%;
        -webkit-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
        transform: translateY(-50%);
        padding: 0 50px;
    }
    

    【讨论】:

    • 感谢您的快速响应,但很遗憾您的解决方案无法解决问题。如果我删除您提到的部分,标题会像以前一样滑过我的个人资料图片和带有联系信息的标题栏。您还有其他建议吗?
    • 您确定保存了 CSS 文件吗?你确定你的 CSS 重新加载了吗?如果有,请提供问题的屏幕截图。
    猜你喜欢
    • 1970-01-01
    • 2017-03-15
    • 2021-02-10
    • 2013-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-25
    相关资源
    最近更新 更多