仅在顶部的线高?

时间:2012-11-10 21:00:14

标签: html css html5 css3

我有一个网站:http://starthumble.com/

该菜单在同一页面上执行滚动到锚点效果。但是,如果单击“主页”,它会滚动并删除一半的标注文本。我已经想出如果我设置

.companycallout h1 {
    line-height: 5em;
}

然后滚动得当。唯一的问题是h2标签被推低了。我能找到解决方法的唯一方法是

.companycallout h1 {
    line-height: 5em;
}
.companycallout h2 {
    margin-top: -90px;
    padding-bottom: 50px;
}

这是最好的解决方案吗?还有更好的选择吗?我还没有测试过这个跨浏览器(暂时无法访问它)所以我不确定它是否兼容全面兼容。

谢谢!

2 个答案:

答案 0 :(得分:1)

我会把你的CSS归还给你以前的样子。

您的解决方案是更改您正在使用的jquery插件。更具体地说是offset()。您可以为其添加值。以下是有关它的更多信息:

http://api.jquery.com/offset/

enter image description here

答案 1 :(得分:1)

只需将您的margin-top更改为padding top

body {
    margin: 0;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 20px;
    color: #333;
    background-color: white;
    padding-top: 80px;}