下拉菜单位于div标签下

时间:2012-12-28 09:01:38

标签: css html drop-down-menu

我如何解决这个问题,我尝试在很多地方进行编辑,但我不明白这个技巧部分。

这是网址:http://www.pineappletimes.com/ 这是代码

 <!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=utf-8" />
<title>Pineappletimes.com</title>

<style type="text/css">#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a 
{
  margin: 0;
  padding: 0;
  position: relative;
}
#cssmenu:after,
#cssmenu ul:after 
{
  content: '';
  display: block;
  clear: both;
}
#cssmenu a
 {
  color: #ffffff;
  display: inline-block;
  font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;
  font-size: 14px;
  min-width: 120px;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 -1px 0 #333333;
}
#cssmenu ul 
{
  list-style: none;
}
#cssmenu > ul > li
 {
  float: left;
}
#cssmenu > ul > li.active a 
{
  background: #646464 url(http://www.pineappletimes.com/images/grad_dark.png) repeat-x left bottom;
  background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(100%, #4a4a4a));
  background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -o-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: linear-gradient(to bottom, #646464 0%, #4a4a4a 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#646464', endColorstr='#4a4a4a', GradientType=0);
  box-shadow: inset 0 0 10px #222222, inset 0 10px 10px #222222;
  -moz-box-shadow: inset 0 0 10px #222222, inset 0 10px 10px #222222;
  -webkit-box-shadow: inset 0 0 10px #222222, inset 0 10px 10px #222222;
  filter: none;
}
#cssmenu > ul > li.active a:hover 
{
  background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(100%, #4a4a4a));
  background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -o-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: linear-gradient(to bottom, #646464 0%, #4a4a4a 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#646464', endColorstr='#4a4a4a', GradientType=0);
  filter: none;
}
#cssmenu > ul > li a 
{
  box-shadow: inset 0 0 0 1px #8a8a8a;
  -moz-box-shadow: inset 0 0 0 1px #8a8a8a;
  -webkit-box-shadow: inset 0 0 0 1px #8a8a8a;
  background: #4a4a4a url(http://www.pineappletimes.com/images/grad_dark.png) repeat-x left top;
  background: -moz-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #8a8a8a), color-stop(50%, #707070), color-stop(51%, #626262), color-stop(100%, #787878));
  background: -webkit-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: -o-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: -ms-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: linear-gradient(to bottom, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#8a8a8a', endColorstr='#787878', GradientType=0);
  border-bottom: 1px solid #5d5d5d;
  border-top: 1px solid #5d5d5d;
  border-right: 1px solid #5d5d5d;
  line-height: 34px;
  padding: 0 35px;
  filter: none;
}
#cssmenu > ul > li a:hover 
{
  background: #8a8a8a url(http://www.pineappletimes.com/images/grad_dark.png) repeat-x left bottom;
  background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(50%, #4a4a4a), color-stop(51%, #3b3b3b), color-stop(100%, #525252));
  background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: -o-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: linear-gradient(to bottom, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#8a8a8a', endColorstr='#787878', GradientType=0);
  filter: none;
}
#cssmenu > ul > li:first-child a
 {
  border-radius: 5px 0 0 5px;
  -moz-border-radius: 5px 0 0 5px;
  -webkit-border-radius: 5px 0 0 5px;
  border-left: 1px solid #5d5d5d;
}
#cssmenu > ul > li:last-child a 
{
  border-radius: 0 5px 5px 0;
  -moz-border-radius: 0 5px 5px 0;
  -webkit-border-radius: 0 5px 5px 0;
}
#cssmenu .has-sub:hover ul 
{
  display: block;
}
#cssmenu .has-sub ul
 {
  display: none;
  position: absolute;
  top: 36px;
  left: -1px;
  min-width: 100%;
  text-align: center;
  /* IE7 */

  *width: 100%;
}
#cssmenu .has-sub ul li
 {
  text-align: center;
}
#cssmenu .has-sub ul li a
 {
  border-top: 0 none;
  border-left: 1px solid #5d5d5d;
  display: block;
  line-height: 120%;
  padding: 9px 5px;
  text-align: center;
}

#cssmenu
{
    margin-top:10%;
    margin-left:15%;
    width:80%;
}

#mainarticle {
    position:absolute;
    width:58%;
    height:50%;
    border:#F7F7F7;
    border-width:20px;
    border-style:solid;
    z-index:1;
    top:28%;
    left:12%;
    font-size:100%;
    padding:1%;
    font-family: "Open Sans";

}

#twitterfeed {
    position:absolute;
    margin-left:76%;
    top:27%;
    width:22%;
    height:70%;

}
#logo
 {
    position:absolute;
    width:100%;
    height:17%;
    z-index:1;
    top:0%;
    background-repeat: no-repeat;
    background-color:#000;
    color:#FFF; 
    font-family: "tabs";
}

@font-face {
  font-family: "Open Sans bold";
  src: url(http://www.pineappletimes.com/Fonts/OpenSans-Bold.ttf) format("truetype");
}
@font-face {
  font-family: "Open Sans";
  src: url(http://www.pineappletimes.com/Fonts/OpenSans-Regular.ttf) format("truetype");
}
@font-face {
  font-family: "tabs";
  src: url(http://www.pineappletimes.com/Fonts/tabs.ttf) format("truetype");
}


</style>

</head>

    <body style="margin:0px;padding:0px;">



<div id="logo">
<a href="http://www.pineappletimes.com/" >
<img  src="http://www.pineappletimes.com/images/logo.png" />
</a>

</div>
<div id='cssmenu'>

<ul>
   <li class='active '><a href='cssmenu/index.html'><span>Articles</span></a></li>
   <li><a href='#'><span>Howlah Index</span></a></li>
   <li class='has-sub '><a href='#'><span>Humorous Horoscope</span></a>
      <ul>

         <li><a href='#'><span>Aries</span></a></li>
         <li><a href='#'><span>Taurus</span></a></li>
         <li><a href='#'><span>Gemini</span></a></li>
         <li><a href='#'><span>Cancer</span></a></li>
         <li><a href='#'><span>Leo</span></a></li>
         <li><a href='#'><span>Virgo</span></a></li>
         <li><a href='#'><span>Libra</span></a></li>
         <li><a href='#'><span>Scorpio</span></a></li>
         <li><a href='#'><span>Sagittarius  </span></a></li>
         <li><a href='#'><span>Capricorn</span></a></li>
         <li><a href='#'><span>Aquarius</span></a></li>
         <li><a href='#'><span>Pisces</span></a></li>


      </ul>
   </li>
   <li><a href='#'><span>Agony Aunt</span></a></li>
</ul>
</div>

<div id="mainarticle"><img  src="http://www.pineappletimes.com/images/arvindmosquito.png" width="300" height="100" alt="kejriwalmosq"  align="left" style="margin-right:2%"/><p style="font-family: Open Sans bold;"> Dengue cases rise in Delhi; Arvind Kejriwal wants probe against mosquitoes</p><br> After Robert Vadra and Nitin Gadkari, Mr. Kejriwal has now targeted the Mosquitoes for causing dengue fever in Delhi and other parts of the country. He wants the actions of mosquitoes to be probed using all the government machinery available. Association of mosquitoes (ASS_MO) has clearly denied any wrongdoing and has issued a statement supporting its members’ actions.<br>
The statement reads...<br><br>
“We have no intention to harm humans. Some of our members who love humans more than others got over excited and kissed a few people. What happened after that is not our responsibility. We have acted as per law and not kissed any person in public.“ 
<a href="http://www.pineappletimes.com/kejriwal_mosquito.html" > &nbsp;Read more</a>
</div>

<div id="twitterfeed">
<a class="twitter-timeline" href="https://twitter.com/PineappleTimes" data-widget-id="274533936351289345">Tweets by @PineappleTimes</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

</div>


</body>
</html>

1 个答案:

答案 0 :(得分:6)

#cssmenu .has-sub ul {
z-index: 1000;
}
相关问题