CSS Ride SideBar 需要保持在顶部

发布于 2024-07-10 18:26:58 字数 956 浏览 5 评论 0原文

我的右侧栏没有保持在顶部。

例如,这是两个页面。 www.cafecartel.com

和 www.cafecartel.com.index2.php

目前网站的编写方式,右侧栏必须这样放置:

body id="Support" div id =“容器1” div id =“容器2”

div id="header"
 ?php include("inc/header.inc"); ?
  h1 Point of Sale for Restaurants, POS Retail and Inventory by Cafe Cartel/h1
/div

div id =“包装” div id="content"

div id="sidebar"
 ?php include("inc/sidebar_justafew.inc"); ?
 ?php include("inc/sidebar_whouses.inc"); ?
/div

div id="maincontent"


我想要的是能够将侧边栏放置在主要内容下方。 对于搜索引擎优化。

这是侧边栏的 CSS:

sidebar {

float: right;
    position: relative;
    left: 178px;
    width: 166px;
    padding-top: 5px;
margin-left: -165px;
margin-bottom: 50px;
    line-height: 1.4em;
    voice-family: "\"}\"";
    voice-family: inherit;
    width: 165px;
    }

感谢所有帮助。 谢谢

My right side bar isn't staying on top.

These are the two pages for example. www.cafecartel.com

and www.cafecartel.com.index2.php

Currently the way the site is written, the right side bar must be placed like this:

body id="Support"
div id="container1"
div id="container2"

div id="header"
 ?php include("inc/header.inc"); ?
  h1 Point of Sale for Restaurants, POS Retail and Inventory by Cafe Cartel/h1
/div

div id="wrapper"
div id="content"

div id="sidebar"
 ?php include("inc/sidebar_justafew.inc"); ?
 ?php include("inc/sidebar_whouses.inc"); ?
/div

div id="maincontent"


What i want is to be able place the Sidebar Beneath the Main Content. For SEO.

This is the CSS for the side bar:

sidebar {

float: right;
    position: relative;
    left: 178px;
    width: 166px;
    padding-top: 5px;
margin-left: -165px;
margin-bottom: 50px;
    line-height: 1.4em;
    voice-family: "\"}\"";
    voice-family: inherit;
    width: 165px;
    }

All help is appreciated. Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

老娘不死你永远是小三 2024-07-17 18:26:59

cc_layout.css line: 63

#maincontent {
    margin:0;
    padding:0;
    position:relative;
    width:97%;
    float: left;
}

@Carl,两个页面(新旧)之间的区别在于,与上面(旧)相比,他将侧边栏 HTML 放置在主内容(新)下方。

cc_layout.css line: 63

#maincontent {
    margin:0;
    padding:0;
    position:relative;
    width:97%;
    float: left;
}

@Carl, the difference between the two pages (old and new) is that he has placed the sidebar HTML below the maincontent (new) compared to above (old).

浅笑轻吟梦一曲 2024-07-17 18:26:58

我无法完全理解这个问题,所以如果我误解了,我提前道歉,但是要让侧边栏出现在内容旁边并让内容显示在 HTML 中的侧边栏上方,您可以将 #maincontent div 向左浮动,然后将#sidebar div 右侧。

#content { 明确:两者; }

#maincontent { float: left; }

#sidebar { float: right; 。

之后您还需要清除浮动,因此我在内容 div 上添加了clear:both

希望有帮助!

I'm having trouble fully understanding the question, so my apologies in advance if I misunderstood, but to have the sidebar appear next to the content and have content appear above the sidebar in HTML, you could float the #maincontent div left, and the #sidebar div right.

#content { clear: both; }

#maincontent { float: left; }

#sidebar { float: right; }

You'll need to clear the floats after, too, so I added the clear: both on the content div.

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文