Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 鼠标悬停在上方时,a-Hover菜单不断消失_Html_Css - Fatal编程技术网

Html 鼠标悬停在上方时,a-Hover菜单不断消失

Html 鼠标悬停在上方时,a-Hover菜单不断消失,html,css,Html,Css,当我将鼠标悬停在服务链接上时,右侧的悬停会一直消失。我已经看了css,似乎找不到修复它的地方。本网站是,我的CSS如下: html { height: 100%;} * { margin: 0; padding: 0;} body { font: 0.8em/1.5 "arial",sans-serif; color: #303030; background: #990000; } p { padding: 0 0 20px 0; line-height: 1.7em

当我将鼠标悬停在服务链接上时,右侧的悬停会一直消失。我已经看了css,似乎找不到修复它的地方。本网站是,我的CSS如下:

html
{ height: 100%;}

*
{ margin: 0;
  padding: 0;}

body
{ font: 0.8em/1.5 "arial",sans-serif; 
  color: #303030;
  background: #990000;
  }

p
{ padding: 0 0 20px 0;
  line-height: 1.7em;}

img
{ border: 0;}

h1, h2, h3, h4, h5, h6 
{ font: normal 175% 'century gothic', arial, sans-serif;
  color: #43423F;
  margin: 0 0 15px 0;
  padding: 15px 0 5px 0;}

h2
{ font: normal 200% 'century gothic', arial, sans-serif;
  color: #1293EE;}

h4, h5, h6
{ margin: 0;
  padding: 0 0 5px 0;
  font: normal 120% arial, sans-serif;
  color: #1293EE;}

h5, h6
{ font: italic 95% arial, sans-serif;
  padding: 0 0 15px 0;
  color: #000;}

h6
{ color: #362C20;}

a, a:hover
{ outline: none;
  text-decoration: underline;
  color: #CC0000;}

a:hover
{ text-decoration: none;}

.left
{ float: left;
  width: auto;
  margin-right: 10px;}

.right
{ float: right; 
  width: auto;
  margin-left: 10px;}

.center
{ display: block;
  text-align: center;
  margin: 20px auto;}

blockquote
{ margin: 20px 0; 
  padding: 10px 20px 0 20px;
  border: 1px solid #E5E5DB;
  background: #FFF;}

ul
{ margin: 2px 0 22px 17px;}

ul li
{ list-style-type: circle;
  margin: 0 0 6px 0; 
  padding: 0 0 4px 5px;}

ol
{ margin: 8px 0 22px 20px;}

ol li
{ margin: 0 0 11px 0;}

#main, #logo, #menubar, #site_content, #footer
{ margin-left: auto; 
  margin-right: auto;}

#header
{ background: #990000;
  height: 240px;}

#logo
{ width: 810px;
  position: relative;
  height: 120px;
  background: #150517; url(logo.png) no-repeat;}

#logo #logo_text 
{ position: center; 
  top: 20px;
  left: 0;}

#logo h1, #logo h2
{ font: normal 300% 'century gothic', arial, sans-serif;
  border-bottom: 0;
  text-transform: none;
  margin: 0;}

#logo_text h1, #logo_text h1 a, #logo_text h1 a:hover 
{ padding: 22px 0 0 0;
  color: #FFF;
  letter-spacing: 0.1em;
  text-decoration: none;}

#logo_text h1 a .logo_colour
{ color: #FAF700;}

#logo_text h2
{ font-size: 100%;
  padding: 4px 0 0 0;
  color: #DDD;}

#menubar
{ width: 877px;
  height: 72px;
  padding: 0;
  background: #150517; url(menu.png) repeat-x;
  } 

ul#menu, ul#menu li
{ float: left;
  margin: 0; 
  padding: 0;}

ul#menu li
{ list-style: none;}

ul#menu li a
{ letter-spacing: 0.1em;
  font: normal 100% 'lucida sans unicode', arial, sans-serif;
  display: block; 
  float: left; 
  height: 37px;
  padding: 29px 26px 6px 26px;
  text-align: center;
  color: #FFF;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;} 

ul#menu li a:hover, ul#menu li.selected a, ul#menu li.selected a:hover
{ color: #FFF;
  background: #451C1B url(menu_select.png) repeat-x;}

ul#menu li ul#sub_nav
{
    /*border:1px solid red;*/
    position: absolute;
    left: 0; top:35px;
    padding: 15px 0;
    width: 170px;
    margin:0;
    display:none;
    background:#150517;
}

ul#menu li:hover #sub_nav
{
    display:block;
}

#site_content
{ width: 900px;
  overflow: hidden;
  margin: 0 auto 0 auto;
  padding: 20px 24px 20px 37px;
  background: #DCDCDC;} 

.sidebar
{ float: right;
  width: 200px;
  padding: 0 15px 20px 15px;}

.sidebar ul
{ width: 178px; 
  padding: 4px 0 0 0; 
  margin: 4px 0 30px 0;}

.sidebar li
{ list-style: none; 
  padding: 0 0 7px 0; }

.sidebar li a, .sidebar li a:hover
{ padding: 0 0 0 40px;
  display: block;
  background: transparent url(link.png) no-repeat left center;} 

.sidebar li a.selected
{ color: #444;
  text-decoration: none;} 

#content
{ text-align: left; position: absoulte;
  width: 595px;
  padding: 0;}

#content ul
{ margin: 2px 0 22px 0px;}

#content ul li
{ list-style-type: none;
  background: url(bullet.png) no-repeat;
  margin: 0 0 6px 0; 
  padding: 0 0 4px 25px;
  line-height: 1.5em;}

#footer
{ width: 878px;
  font: normal 100% 'lucida sans unicode', arial, sans-serif;
  height: 33px;
  padding: 24px 0 5px 0;
  text-align: center; 
  background: #000000;
  color: #b1b1b1;
  text-transform: uppercase;
  letter-spacing: 0.1em;}

#footer a
{ color: #FFF;
  text-decoration: none;}

#footer a:hover
{ color: #FFF;
  text-decoration: underline;}

.search
{ color: #5D5D5D; 
  border: 1px solid #BBB; 
  width: 134px; 
  padding: 4px; 
  font: 100% arial, sans-serif;}

#colours
{ height: 0px;
  text-align: right;
  padding: 66px 16px 0px 300px;}

.form_settings
{ margin: 15px 0 0 0;}

.form_settings p
{ padding: 0 0 4px 0;}

.form_settings span
{ float: left; 
  width: 200px; 
  text-align: left;}

.form_settings input, .form_settings textarea
{ padding: 5px; 
  width: 299px; 
  font: 100% arial; 
  border: 1px solid #E5E5DB; 
  background: #FFF; 
  color: #47433F;}

.form_settings .submit
{ font: 100% arial; 
  border: 1px solid; 
  width: 99px; 
  margin: 0 0 0 212px; 
  height: 33px;
  padding: 2px 0 3px 0;
  cursor: pointer; 
  background: #7D0F0F; 
  color: #FFF;}

.form_settings textarea, .form_settings select
{ font: 100% arial; 
  width: 299px;}

.form_settings select
{ width: 310px;}

.form_settings .checkbox
{ margin: 4px 0; 
  padding: 0; 
  width: 14px;
  border: 0;
  background: none;}

.separator
{ width: 100%;
  height: 0;
  border-top: 1px solid #D9D5CF;
  border-bottom: 1px solid #FFF;
  margin: 0 0 20px 0;}

table
{ margin: 10px 0 30px 0;}

table tr th, table tr td
{ background: #DCDCDC;
  color: #DCDCDC;
  padding: 7px 4px;
  text-align: left;}

table tr td
{ background: #DCDCDC;
  color: #DCDCDC;
}

#testimonials{
    width: 133px;
    padding: 45px 45px 35px;
    background:url('../img/quotes.png') no-repeat 20px 20px rgba(178,178,169,0.2);
    min-height:90px;

    -moz-border-radius:12px;
    -webkit-border-radius:12px;
    border-radius:12px;
}
#testimonials ul{ list-style:none;}
#testimonials p.text{ font-size:11px;}

#testimonials p.author{
    color: #878787;
    font-size: 16px;
    font-style: italic;
    text-align: left;

}

#testimonials p.author a,
#testimonials p.author a:visited{
    color:#6aa42a;
}

如果您打算创建一个下拉菜单,那么您的li标记将丢失位置:relative属性和sub-menu将卡在页面左侧的顶部。你所说的悬停一直在消失-我不太确定。

嗨,主要的是你在你的孩子id中定义了位置:绝对的,而没有定义位置:相对的,这就是为什么你的悬停下拉列表在顶部

因此,我已经更新了您的css应用程序,我希望这将工作良好:-

 ul#menu li {
    list-style: none outside none;
    position: relative;
}


ul#menu li ul#sub_nav {
    background: none repeat scroll 0 0 #150517;
    display: none;
    margin: 0;
    position: absolute;
    top: 72px;
    width: 155px;
}
您完整更新的CSS

 html
{ height: 100%;}

*
{ margin: 0;
  padding: 0;}

body
{ font: 0.8em/1.5 "arial",sans-serif; 
  color: #303030;
  background: #990000;
  }

p
{ padding: 0 0 20px 0;
  line-height: 1.7em;}

img
{ border: 0;}

h1, h2, h3, h4, h5, h6 
{ font: normal 175% 'century gothic', arial, sans-serif;
  color: #43423F;
  margin: 0 0 15px 0;
  padding: 15px 0 5px 0;}

h2
{ font: normal 200% 'century gothic', arial, sans-serif;
  color: #1293EE;}

h4, h5, h6
{ margin: 0;
  padding: 0 0 5px 0;
  font: normal 120% arial, sans-serif;
  color: #1293EE;}

h5, h6
{ font: italic 95% arial, sans-serif;
  padding: 0 0 15px 0;
  color: #000;}

h6
{ color: #362C20;}

a, a:hover
{ outline: none;
  text-decoration: underline;
  color: #CC0000;}

a:hover
{ text-decoration: none;}

.left
{ float: left;
  width: auto;
  margin-right: 10px;}

.right
{ float: right; 
  width: auto;
  margin-left: 10px;}

.center
{ display: block;
  text-align: center;
  margin: 20px auto;}

blockquote
{ margin: 20px 0; 
  padding: 10px 20px 0 20px;
  border: 1px solid #E5E5DB;
  background: #FFF;}

ul
{ margin: 2px 0 22px 17px;}

ul li
{ list-style-type: circle;
  margin: 0 0 6px 0; 
  padding: 0 0 4px 5px;}

ol
{ margin: 8px 0 22px 20px;}

ol li
{ margin: 0 0 11px 0;}

#main, #logo, #menubar, #site_content, #footer
{ margin-left: auto; 
  margin-right: auto;}

#header
{ background: #990000;
  height: 240px;}

#logo
{ width: 810px;
  position: relative;
  height: 120px;
  background: #150517; url(logo.png) no-repeat;}

#logo #logo_text 
{ position: center; 
  top: 20px;
  left: 0;}

#logo h1, #logo h2
{ font: normal 300% 'century gothic', arial, sans-serif;
  border-bottom: 0;
  text-transform: none;
  margin: 0;}

#logo_text h1, #logo_text h1 a, #logo_text h1 a:hover 
{ padding: 22px 0 0 0;
  color: #FFF;
  letter-spacing: 0.1em;
  text-decoration: none;}

#logo_text h1 a .logo_colour
{ color: #FAF700;}

#logo_text h2
{ font-size: 100%;
  padding: 4px 0 0 0;
  color: #DDD;}

#menubar
{ width: 877px;
  height: 72px;
  padding: 0;
  background: #150517; url(menu.png) repeat-x;
  } 

ul#menu, ul#menu li
{ float: left;
  margin: 0; 
  padding: 0;}

 ul#menu li {
    list-style: none outside none;
    position: relative;
}


ul#menu li a
{ letter-spacing: 0.1em;
  font: normal 100% 'lucida sans unicode', arial, sans-serif;
  display: block; 
  float: left; 
  height: 37px;
  padding: 29px 26px 6px 26px;
  text-align: center;
  color: #FFF;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;} 

ul#menu li a:hover, ul#menu li.selected a, ul#menu li.selected a:hover
{ color: #FFF;
  background: #451C1B url(menu_select.png) repeat-x;}

ul#menu li ul#sub_nav {
    background: none repeat scroll 0 0 #150517;
    display: none;
    margin: 0;
    position: absolute;
    top: 72px;
    width: 155px;
}


ul#menu li:hover #sub_nav
{
    display:block;
}

#site_content
{ width: 900px;
  overflow: hidden;
  margin: 0 auto 0 auto;
  padding: 20px 24px 20px 37px;
  background: #DCDCDC;} 

.sidebar
{ float: right;
  width: 200px;
  padding: 0 15px 20px 15px;}

.sidebar ul
{ width: 178px; 
  padding: 4px 0 0 0; 
  margin: 4px 0 30px 0;}

.sidebar li
{ list-style: none; 
  padding: 0 0 7px 0; }

.sidebar li a, .sidebar li a:hover
{ padding: 0 0 0 40px;
  display: block;
  background: transparent url(link.png) no-repeat left center;} 

.sidebar li a.selected
{ color: #444;
  text-decoration: none;} 

#content
{ text-align: left; position: absoulte;
  width: 595px;
  padding: 0;}

#content ul
{ margin: 2px 0 22px 0px;}

#content ul li
{ list-style-type: none;
  background: url(bullet.png) no-repeat;
  margin: 0 0 6px 0; 
  padding: 0 0 4px 25px;
  line-height: 1.5em;}

#footer
{ width: 878px;
  font: normal 100% 'lucida sans unicode', arial, sans-serif;
  height: 33px;
  padding: 24px 0 5px 0;
  text-align: center; 
  background: #000000;
  color: #b1b1b1;
  text-transform: uppercase;
  letter-spacing: 0.1em;}

#footer a
{ color: #FFF;
  text-decoration: none;}

#footer a:hover
{ color: #FFF;
  text-decoration: underline;}

.search
{ color: #5D5D5D; 
  border: 1px solid #BBB; 
  width: 134px; 
  padding: 4px; 
  font: 100% arial, sans-serif;}

#colours
{ height: 0px;
  text-align: right;
  padding: 66px 16px 0px 300px;}

.form_settings
{ margin: 15px 0 0 0;}

.form_settings p
{ padding: 0 0 4px 0;}

.form_settings span
{ float: left; 
  width: 200px; 
  text-align: left;}

.form_settings input, .form_settings textarea
{ padding: 5px; 
  width: 299px; 
  font: 100% arial; 
  border: 1px solid #E5E5DB; 
  background: #FFF; 
  color: #47433F;}

.form_settings .submit
{ font: 100% arial; 
  border: 1px solid; 
  width: 99px; 
  margin: 0 0 0 212px; 
  height: 33px;
  padding: 2px 0 3px 0;
  cursor: pointer; 
  background: #7D0F0F; 
  color: #FFF;}

.form_settings textarea, .form_settings select
{ font: 100% arial; 
  width: 299px;}

.form_settings select
{ width: 310px;}

.form_settings .checkbox
{ margin: 4px 0; 
  padding: 0; 
  width: 14px;
  border: 0;
  background: none;}

.separator
{ width: 100%;
  height: 0;
  border-top: 1px solid #D9D5CF;
  border-bottom: 1px solid #FFF;
  margin: 0 0 20px 0;}

table
{ margin: 10px 0 30px 0;}

table tr th, table tr td
{ background: #DCDCDC;
  color: #DCDCDC;
  padding: 7px 4px;
  text-align: left;}

table tr td
{ background: #DCDCDC;
  color: #DCDCDC;
}

#testimonials{
    width: 133px;
    padding: 45px 45px 35px;
    background:url('../img/quotes.png') no-repeat 20px 20px rgba(178,178,169,0.2);
    min-height:90px;

    -moz-border-radius:12px;
    -webkit-border-radius:12px;
    border-radius:12px;
}
#testimonials ul{ list-style:none;}
#testimonials p.text{ font-size:11px;}

#testimonials p.author{
    color: #878787;
    font-size: 16px;
    font-style: italic;
    text-align: left;

}

#testimonials p.author a,
#testimonials p.author a:visited{
    color:#6aa42a;
}

你为什么定义一个:悬停两次?悬停消失是因为他定义了两次;一次带文字装饰:下划线;一次带文字装饰:无;我以为我们讨论的是子菜单hover:
ul#menu li:hover#sub#u nav{display:block;}
谢谢大家,我已经更新了css,子菜单是li元素的一部分。但是,当您将鼠标移到服务链接上时,无法单击服务超链接。是否有方法按下子菜单链接“安全门”“淋浴屏幕”等?您需要添加
位置:相对
#菜单
,这将告诉绝对定位的子
#子导航
根据
#菜单
位置和大小计算其定位。