【发布时间】:2014-11-11 13:45:15
【问题描述】:
我正在开发我的第一个 Drupal 主题,到目前为止我只遇到了一个问题。我为我的所有 div 设置了百分比大小,以使网站更具响应性。然而,他们似乎忽略了大小,只是包装到他们的子内容。我该如何解决这个问题?
CSS
#wrapper {
padding: 5%;
width: auto;
height: auto;
position: relative;
}
div {
margin: 0px;
padding: 5px;
}
#sidebar-first {
float: left;
display: inline;
width: 19%;
height: 79%;
background-color: orange;
}
#header {
float: right;
display: inline;
width: 79%;
height: 19%;
background-color: purple;
text-align: right;
}
#sidebar-second {
float: right;
display: inline;
width: 19%;
height: 79%;
background-color: red;
}
#content {
float: left;
display: inline;
background-color: green;
}
#footer {
float: left;
display: inline;
width: 79%;
height: 19%;
background-color: pink;
}
PHP
<div id="wrapper">
<?php if ($page['sidebar_first']): ?>
<div id="sidebar-first">
<?php print render($page['sidebar_first']); ?>
</div>
<?php endif; ?>
<div id="header">
<a href="<?php print $front_page;?>">
<h1><?php print $site_name; ?></h1>
</a>
<?php if ($main_menu): ?>
<?php print theme('links', $main_menu); ?>
<?php endif; ?>
</div>
<?php if ($page['sidebar_second']): ?>
<div id="sidebar-second">
<?php print render($page['sidebar_second']); ?>
</div>
<?php endif; ?>
<div id="content">
<?php print render($title_prefix); ?>
<?php if ($title): ?><h1><?php print $title; ?></h1><?php endif; ?>
<?php print render($title_suffix); ?>
<?php print render($messages); ?>
<?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>
<?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
<?php print render($page['content']); ?>
</div>
<div id="footer">
<?php if ($page['footer']): ?>
<?php print render($page['footer']); ?>
<?php endif; ?>
</div>
</div>
这是现在的样子: 希望它看起来与此类似,但他们在静态页面上使用了表格。
【问题讨论】:
标签: html css drupal drupal-themes