【发布时间】:2013-02-19 03:09:54
【问题描述】:
我正在尝试应用粘性页脚,但在 Orchard 中实现此功能时遇到问题。
在以前的网站中,我成功应用了以下粘性页脚方法: http://www.cssstickyfooter.com/using-sticky-footer-code.html
我只是无法在 Orchard 中使用粘性页脚,也找不到任何相关信息。
已经尝试删除所有现有的 CSS 以尝试找出其无法正常工作的原因。使用 firebug 检查 HTML 时也不会变得更明智。
使用的模板:基于自定义主题的主题机(结构不变)。
问题:
site.css 中的区域填充导致了这些奇怪的问题。但是我怎样才能保留这个填充,这样我就可以实现一个粘性页脚?
因为没有区域填充,所有区域的所有必要填充都消失了。
/* Zones */
.zone
{
padding: 10px;
}
或者还有其他更适合 Orchard 的方法来实现粘性页脚吗?
旁注问题
@tag.StartElement 和@tag.EndElement 的用途究竟是什么?
CSS: (我的页脚高度正好是 40px)
html, body
{
height: 100%;
}
#layout-wrapper { min-height: 100%; }
#layout-footer
{
position: relative;
margin-top: -40px; /* negative value of footer height */
clear:both;
background-color: #030e27;
}
Layout.cshmtl:
@tag.StartElement
@if (Model.Header != null)
{
<header>
<div id="layout-header" class="group">
<div id="header">
@Zone(Model.Header)
</div>
</div>
<div id="layout-header-bottom"></div>
</header>
}
@if (Model.Navigation != null)
{
<div id="layout-navigation" class="group">
<div id="navigation">
@Zone(Model.Navigation)
</div>
</div>
}
@if (Model.Featured != null) {
<div id="layout-featured" class="group">
@Zone(Model.Featured)
</div>
}
@if (Model.BeforeMain != null) {
<div id="layout-before-main" class="group">
@Zone(Model.BeforeMain)
</div>
}
<div id="layout-main-container">
<div id="layout-main" class="group">
@if (Model.AsideFirst != null) {
<aside id="aside-first" class="aside-first group">
@Zone(Model.AsideFirst)
</aside>
}
<div id="layout-content" class="group">
@if (Model.Messages != null) {
<div id="messages">
@Zone(Model.Messages)
</div>
}
@if (Model.BeforeContent != null) {
<div id="before-content">
@Zone(Model.BeforeContent)
</div>
}
@* the model content for the page is in the Content zone @ the default position (nothing, zero, zilch) *@
@if (Model.Content != null) {
<div id="content" class="group">
@Zone(Model.Content)
</div>
}
@if (Model.AfterContent != null) {
<div id="after-content">
@Zone(Model.AfterContent)
</div>
}
</div>
@if (Model.AsideSecond != null) {
<aside id="aside-second" class="aside-second">
@Zone(Model.AsideSecond)
</aside>
}
</div>
</div>
@if (Model.AfterMain != null) {
<div id="layout-after-main" class="group">
@Zone(Model.AfterMain)
</div>
}
@if (Model.TripelFirst != null || Model.TripelSecond != null || Model.TripelThird != null) {
<div id="layout-tripel-container">
<div id="layout-tripel" class="group">@* as in beer *@
@if (Model.TripelFirst != null) {
<div id="tripel-first">
@Zone(Model.TripelFirst)
</div>
}
@if (Model.TripelSecond != null) {
<div id="tripel-second">
@Zone(Model.TripelSecond)
</div>
}
@if (Model.TripelThird != null) {
<div id="tripel-third">
@Zone(Model.TripelThird)
</div>
}
</div>
</div>
}
@tag.EndElement
<div id="layout-footer" class="group">
<footer id="footer">
<div id="footer-quad" class="group">
@if (Model.FooterQuadFirst != null) {
<div id="footer-quad-first">
@Zone(Model.FooterQuadFirst)
</div>
}
@if (Model.FooterQuadSecond != null) {
<div id="footer-quad-second">
@Zone(Model.FooterQuadSecond)
</div>
}
@if (Model.FooterQuadThird != null) {
<div id="footer-quad-third">
@Zone(Model.FooterQuadThird)
</div>
}
@if (Model.FooterQuadFourth != null) {
<div id="footer-quad-fourth">
@Zone(Model.FooterQuadFourth)
</div>
}
</div>
@if(Model.Footer != null) {
<div id="footer-sig" class="group">
@Zone(Model.Footer)
</div>
}
</footer>
</div>
更新
Derk 的解决方案与删除以下 Orchard CSS 相结合似乎起到了作用:
/* Clearing Floats
***************************************************************/
.group:after
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.zone:after, .widget-control:after /* .zone:after self clears every zone container - .widget-control:after self clears any floats used in a widget */
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
更新 2
而不是删除清除浮动 css changing content: "." 到 content: "" 似乎也具有相同的效果。
对此原因的解释将不胜感激,干杯。
问候, 泽。
【问题讨论】:
-
我在 html 中没有看到您的 css 引用的#wrapper。
-
包装器由 Orchard 框架创建。
-
你能控制吗?或者如果没有,你能不能再做一个你可以控制的?在您的代码中,没有任何内容可以指定缓冲区。你没有所有的碎片。 d
-
你好 Derek,我可以删除 @tag 以便删除布局包装器并添加我自己的 div 包装器(如果你是这个意思)。
-
Orchard 只是一个 CMS。它将您的内容推送到 div 中。在果园中没有一种方法可以做到这一点......只有在 HTML 和 CSS 中做到这一点的方法就是果园 - 除了动态调用要放入这些 div 的信息。
标签: html css orchardcms