Home > Web Front-end > HTML Tutorial > 【求助】UL下的子菜单会自动内联?_html/css_WEB-ITnose

【求助】UL下的子菜单会自动内联?_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:32:41
Original
844 people have browsed it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> </head> <style>ul {    margin: 0px;    padding: 0px;	background:#333;	width:949px;}ul li{float:left;      display:inline;	  list-style:none;	  height:30px;	  width:100px;}ul li ul{display:block ;}	  </style> <div style="width:949;"><ul><li><a href="#"><span>ALL</span></a>    <ul>      <li style="display:block"><a href="#"><span>all</span></a></li>      <li style="display:block"><a href="#"><span>all</span></a></li>      <li style="display:block"><a href="#"><span>all</span></a></li>      <li style="display:block"><a href="#"><span>all</span></a></li>    </ul> </li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li></ul></div>
Copy after login


回复讨论(解决方案)

自动内联?
不明白楼主的意思。

自动内联?
不明白楼主的意思。 要实现2级菜单的效果。
-------------------
!
!
!
这种效果 但是出来是这种效果-------------------
-------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> </head> <style>ul.menu {    margin: 0px;    padding: 0px;    background:#333;    width:949px;}ul.menu li{float:left;      display:inline;      list-style:none;      height:30px;      width:100px;}ul.menu li ul{display:block ;}      </style> <div style="width:949;"><ul class="menu"><li><a href="#"><span>ALL</span></a>    <ul>      <li style="display:block"><a href="#"><span>all</span></a></li>      <li style="display:block"><a href="#"><span>all</span></a></li>      <li style="display:block"><a href="#"><span>all</span></a></li>      <li style="display:block"><a href="#"><span>all</span></a></li>    </ul> </li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li><li><a href="#"><span>name</span></a></li></ul></div>
Copy after login

为什么我在

    为什么我在


      作用是有的,但你写的ul样式中设置了宽度值,这个样式对li内部的ul元素也是有效的。
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template