问题描述
- 为啥li中的背景图片显示不出来
-
代码如下:<style type="text/css"> #topnav{ height:36px; background-color:silver; border: 1px solid seagreen; } #topnav ul{ /*line-height:30px;*/ margin: 5px; padding: 0px; border-bottom: solid; border-bottom-width: 2px; border-bottom-color: darkgreen; float :left; } #topnav li{ float: left; padding: 4px; list-style-type: none;/*去掉列表默认样式符号*/ width: 62px;/*主要是设置宽度,这样li宽度固定了才不会导致大小不一*/ height:20px; text-align: center; margin: 0px 0px 0px 5px; background-image: url (nav/picture/normal.jpg); background-repeat:no-repeat; /*_zoom:1;*/ } #topnav li a{ font-family:arial; text-decoration:none;/*超链接的下划线去掉*/ } #topnav li#select { background-image: url (nav/picture/select.gif); background-repeat :no-repeat; } </style> </head> <body> <div id ="topnav"> <ul> <li id="select"><a href ="#">jlajla</a></li> <li><a href ="#">jlajla</a></li> <li><a href ="#">jlajla</a></li> <li><a href ="#">jlajla</a></li> </ul> </div> </body> </html>
解决方案
不要有空格,怎么老喜欢打空格,而且乱采纳自己的
background-image: url(nav/picture/normal.jpg);
background-image: url(nav/picture/select.gif);
时间: 2025-01-01 14:44:05