无法让下拉菜单编码工作 [英] Unable to get the drop down menu coding to work

查看:84
本文介绍了无法让下拉菜单编码工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在通过在线视频帮助创建的下拉菜单时遇到问题...无论如何我的问题是它似乎根本不适合我!我尝试了一些其他设计礼貌的youtube视频,但仍然没有运气?这是否归结为人为错误或软件问题?请帮助,因为我知道它会非常令人沮丧,特别是当您知道已经按照确切的步骤进行操作时!



当我在浏览器上预览时显示产品和所有项目链接下面的项目符号。显示为列表但不放弃



HTML code

Hi All,

I am having trouble with a drop down menu that I have created via help from an online video...Anyways my problem is that it doesnt seem to be working for me at all!! I have tried a few other designs courtesy of youtube videos but still no luck? Does that come down to human error or software issues? Please help as you my know it gets very frustrating especially when you know the steps have been followed to the exact!

When I preview on my browser it displays "Products" and all "items link" below with bullet points. Displays as a list and does not drop

"HTML code"

<!DOCTYPE html>
<html lang="en">
  <head>

    <title>Untitled</title>

    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body>


<div id="wrapper">
<div id="navMenu">

<ul>
<li><a href="#">Products</a>
<ul>
<li><a href="#">Link Item</a></li>
<li><a href="#">Link Item</a></li>
<li><a href="#">Link Item</a></li>
<li><a href="#">Link Item</a></li>
<li><a href="#">Link Item</a></li>
<li><a href="#">Link Item</a></li>

</ul>
</li>
</ul>
</div>
</div>

</body>
</html>



CSS代码


"CSS code"

#navMenu {
margin:0;
padding:0;
}

#navMenu ul {
margin:0;
padding:0;
line-height:30px
}

#navMenu li {
margin:0;
padding:0;
list-style:none;
float:left;
position:relative;
}

#navMenu ul li a {
text-align:center;
font-family:sans-serif, cursive;
text-decoration:none;
height:30px;
width:150px;
display:block;
color:#000;
}

#navMenu ul ul {
position:absolute;
visibility:hidden;
top:30px;
}

#navMenu ul li:hover ul {
visibility:visible;
}

推荐答案

我没有看到html中包含的css文件,是你的合作伙伴完成?它应该放在head元素里面,如下所示:



< link rel =stylesheethref =/ path / to / css /page.css/>



确保你也得到正确的路径。
I don't see the css file included in the html anywhere, is your code complete? It should be placed inside the head element like this:

<link rel="stylesheet" href="/path/to/css/page.css" />

Make sure you get the correct path too.


是的, BuggyTimes 是正确的。您尚未将样式添加到页面。因此,它没有按预期显示。



只是为了展示,它是如何工作的,请参考演示与您的代码(我刚刚添加了红色背景) - [演示]带有HTML和CSS的DropDown菜单 [ ^ ]。



看到它,它运作正常。你只需要将CSS样式添加到页面。
Yes, BuggyTimes is correct. You have not added the Styles to the Page. As a result, it is not showing as expected.

Just to show, how it works, refer the demo with your code (I have just added red background) - [Demo] DropDown Menu with HTML and CSS[^].

See that, it is working perfectly. You just need to add the CSS Styles to the Page.


感谢BuggyTimes和Tadit Dash的巨大帮助!全部现在排序。



Thanks to BuggyTimes and Tadit Dash for the huge help!!! All sorted now.

引用:





错过了一个点,所以经过数小时的挫折后,它归结为人为错误:)



missed a dot so after hours of frustration it come down to human error :)


这篇关于无法让下拉菜单编码工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆