【发布时间】:2012-03-15 12:38:55
【问题描述】:
我正在学习使用 CSS 创建按钮的本教程。 http://www.secondpicture.com/tutorials/web_design/css_ul_li_horizontal_css_menu.html
按钮的背景在 UL 元素中设置。我注意到的是,如果我删除 UL 元素的高度和宽度属性,背景图像就会消失,就好像 UL 大小变为零一样。从盒子模型的角度来看,这对我来说没有意义。子元素 ( LI ) 已设置尺寸,应相应地扩展 UL 的尺寸。有人可以解释发生了什么吗?
ul {
list-style-type: none;
background-image: url(navi_bg.png);
height: 80px;
width: 663px;
margin: auto;
}
【问题讨论】:
标签: css height width background-image html-lists