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

move code to the bottom of a page without effecting it's position on the finished page

本文关键字:位置 底部 代码移动 影响      更新时间:2023-09-26

我在一个网站上工作,这个网站有一个很长的项目列表(大约200个),目前显示在页面顶部的下拉列表中。出于SEO的原因,我想把这个代码移到页面的底部,这样搜索引擎就可以忽略它,但如果有意义的话,我不想改变加载时内容在页面上显示的位置。

有没有一种非javascript的方法来做到这一点,甚至是javascript的方法?

你是说像这样

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;
}