我正在尝试为一个朋友建立一个网站,我正在使用Drupal 7来建立它。我有一个CSS问题,这使我发疯。我浮动在右侧的辅助菜单不位于我的内容旁边。相反,它显示在我的内容下方的右侧。
我觉得我已经尝试了一切。我的第一个菜单向左浮动,第二个菜单向右浮动,页边上的内容自动向左和向右移动。
我也尝试清除底层容器上的两个容器,但这都没有帮助。我在Firefox和Chrome中都遇到此错误。
我尚未在网上找到的唯一尚未尝试的解决方案是在向左浮动之前向右浮动,因为我必须修补Drupal核心。
我以前确实遇到了问题,然后重建了该死的整个网站,然后在尝试使组件居中时又发生了。
自从按下“撤消”以来,我已经进行了太多更改,因此如果拥有大量CSS知识的人可以向我解释为什么会发生这种情况真是太棒了。
如果您想查看问题,请访问此页面www.mohaaleague.com,在右底部,但它应与左侧菜单一样高...。
.two-sidebars #content /*the middle element*/
{
width: 827px;
margin-left:auto;
margin-right:auto;
}
#sidebar-second /*the right sidebar*/
{
width: 287px;
float:right;
}
#sidebar-first /*the left sidebar*/
{
float:left;
width: 287px;
}
#main /*the underlying div that holds all the others*/
{
width: 1650px;
margin-left: auto;
margin-right: auto;
position: relative;
clear: both;
}
顺便说一句,我从BARTIK主题开始。
好的,所以我设法通过更改page.tpl.php来解决它,通常这是我在问题中提出的。
问题在于,在向左浮动之前调用了向右浮动。因此,我更改了Drupal呈现页面的顺序。通过使Drupal首先渲染我的第二边栏,然后再渲染我的第一边栏,然后再解决我的内容。
我在主题模板目录中这样更改了page.tpl.php,如果您正在阅读此文件,并且遇到相同的问题,请将代码顺序更改为:
<?php if ($page['sidebar_second']): ?>
<div id="sidebar-second" class="column sidebar"><div class="section">
<?php print render($page['sidebar_second']); ?>
</div></div> <!-- /.section, /#sidebar-second -->
<?php endif; ?>
<?php if ($page['sidebar_first']): ?>
<div id="sidebar-first" class="column sidebar"><div class="section">
<?php print render($page['sidebar_first']); ?>
</div></div> <!-- /.section, /#sidebar-first -->
<?php endif; ?>
<div id="content" class="column"><div class="section">
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a>
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1 class="title" id="page-title">
<?php print $title; ?>
</h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs): ?>
<div class="tabs">
<?php print render($tabs); ?>
</div>
<?php endif; ?>
<?php print render($page['help']); ?>
<?php if ($action_links): ?>
<ul class="action-links">
<?php print render($action_links); ?>
</ul>
<?php endif; ?>
<?php print render($page['content']); ?>
<?php print $feed_icons; ?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句