Joomla 模块与连续最高模块等高
网络上有几种方法可以将列的高度设置为相等。我认为最好的之一是“等高度具有跨浏览器 CSS 的列”。
但是在 Joomla 模块结构上应用该方法存在一个问题,我不知道如何让它工作。
我使用了圆形模块镶边(有一个主要背景Joomla 模板源上的模块和内部 DIV 的另一个背景图像将模块包装在底部),因此每个模块都以这种方式呈现:
<div class="module_menu">
<div>
<div>
<div>
<h3>Main Menu</h3>
<ul class="menu">
<li><!-- various menu items --></li>
</ul>
</div>
</div>
</div>
</div>
并且我连续使用 3 个模块,这些模块包装在父级中DIV。
这是代码:
<div style="width:904px; margin:20px; float:left; overflow:hidden; position:relative;">
<div style="width:904px; float:left; position:relative;">
<div style="width:904px; float:left; position:relative;">
<div style="float:left; width:288px; height:100%; margin-right:20px;">
<jdoc:include type="modules" name="user4" style="rounded" />
</div>
<div style="float:left; width:288px; height:100%; margin-right:20px;">
<jdoc:include type="modules" name="user5" style="rounded" />
</div>
<div style="float:right; width:288px; height:100%;">
<jdoc:include type="modules" name="user6" style="rounded" />
</div>
</div>
</div>
</div>
最后还有与 Joomla 模块样式相关的 css:
div.module-gallery, div.module, div.module_menu {
width:291px;
background:url(../images/module-bg.png) no-repeat 50% bottom;
}
div.module div div div, div.module_menu div div div {
padding-right:15px;
padding-left:15px;
background:url(../images/module-bg-bottom.png) no-repeat 50% 100%;
padding-bottom:15px;
min-height:230px;
}
div.module div div div div, div.module_menu div div div div {
background:none;
}
How can I set module height equalautomatic/dynamically with saving Module background style。
There are several method on the web to set height of columns equal. One of the best, I think, is "Equal Height Columns with Cross-Browser CSS".
But there's a problem to apply that method on Joomla module structure and I couldn't figure out how to get it to work.
I used rounded module chrome (with one main background for module and another background image for inner DIV to wrap modules bottom) on Joomla template source so each module renders this way:
<div class="module_menu">
<div>
<div>
<div>
<h3>Main Menu</h3>
<ul class="menu">
<li><!-- various menu items --></li>
</ul>
</div>
</div>
</div>
</div>
and I use 3 modules in a row that wrapped in a parent DIV.
This is the code:
<div style="width:904px; margin:20px; float:left; overflow:hidden; position:relative;">
<div style="width:904px; float:left; position:relative;">
<div style="width:904px; float:left; position:relative;">
<div style="float:left; width:288px; height:100%; margin-right:20px;">
<jdoc:include type="modules" name="user4" style="rounded" />
</div>
<div style="float:left; width:288px; height:100%; margin-right:20px;">
<jdoc:include type="modules" name="user5" style="rounded" />
</div>
<div style="float:right; width:288px; height:100%;">
<jdoc:include type="modules" name="user6" style="rounded" />
</div>
</div>
</div>
</div>
And finally there's css related to the Joomla module's style:
div.module-gallery, div.module, div.module_menu {
width:291px;
background:url(../images/module-bg.png) no-repeat 50% bottom;
}
div.module div div div, div.module_menu div div div {
padding-right:15px;
padding-left:15px;
background:url(../images/module-bg-bottom.png) no-repeat 50% 100%;
padding-bottom:15px;
min-height:230px;
}
div.module div div div div, div.module_menu div div div div {
background:none;
}
How can I set modules height equal automate/dynamically with saving Module background style.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要查看
templates/system/html/modules.php
。然后,您可以创建
module chrome
的副本来输出模块结构,这会更有用,因为您的代码读起来有点令人难以接受,而且语义也不是很清楚。即,您会猜测使用样式来调用模块,如下所示:
从那时起,您将有一种更语义化的方式来调用您的模块,并使您的 CSS 高度更容易发挥作用。
You need to take a look in
templates/system/html/modules.php
.You can then create a copy of
module chrome
to output your module structure, which would be more beneficial since you code is kinda outrageous to read and isn't very semantic. i.e.You'd then guess call the module with a style, like so:
From then on, you'll have a more semantic way of calling your modules and making it easier to get your CSS heights to work.