将代码移动到页面底部而不影响其在完成页面上的位置

时间:2014-04-24 13:00:08

标签: javascript html5 css3 css-position

我正在一个包含很长项目列表(大约200个)的网站上工作,目前显示在页面顶部的下拉列表中。出于搜索引擎优化的原因,我想将此代码移到页面底部,以便搜索引擎可以忽略它,但我不想更改内容在页面上显示的位置。加载页面,如果这是有道理的。

是否有非javascript方式来执行此操作,甚至是以javascript方式执行此操作?

1 个答案:

答案 0 :(得分:0)

您的意思是 this?

<强> HTML

<div id="contents">
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div id="top-items">
    <p>Top Items</p>
</div>

<强> CSS

#top-items {
    width:100%;
    float:left;
    background:#333;
    height:40px;
    color:#FFF;
    position:absolute;
    top:0;
    left:0;
    text-align:center;
}
#contents {
    width:100%;
    float:left;
    padding:30px 0 0 0;
}