【发布时间】:2015-01-18 21:51:43
【问题描述】:
我是 Stackoverflow 的新手,我需要帮助解决这些问题。
所以问题是:我希望这个虚线图像高度达到容器的 100%。
HTML
<div id="test1">
</div>
<aside>
<?php
if (logged_in() === true) {
include 'includes/widgets/loggedin.php';
} else {
include 'includes/widgets/login.php';
}
include 'includes/widgets/user_count.php';
include 'includes/widgets/sponsors.php';
include 'includes/widgets/partners.php';
?>
</aside>
CSS
aside {
width:260px;
float:right;
background-image:url(../images/dashed.png);
background-repeat: repeat-y;
padding-left:15px;
}
#container, footer {
background:#fff;
width:1100px;
margin:0 auto;
padding:20px;
}
#test1 {
height:1000px;
}
谁能帮帮我?
【问题讨论】:
-
你知道 CSS 上有一个
border dashed属性吗? -
我们需要有关您的 html 的更多详细信息。显然,您的“旁边”与“#container”的高度不同。
-
@Danko 确实有一个虚线边框,但它不适用于 height:100%;和高度:自动;它只适用于图像,所以我尝试了但我仍然不会出来。
-
@Diego 我已经编辑过了,可以吗?
-
但是...标记中的#container 在哪里?,如果#test1 的高度在#container 中是相同的,那么你应该将高度设置为#test1 (1000px)。否则,如果高度发生动态变化,您可以使用此脚本: document.querySelector("aside").style.height = document.querySelector("#container").offsetHeight + 'px';