Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.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 将鼠标悬停在导航栏上时选择颜色_Html_Css_Twitter Bootstrap_Colors - Fatal编程技术网

Html 将鼠标悬停在导航栏上时选择颜色

Html 将鼠标悬停在导航栏上时选择颜色,html,css,twitter-bootstrap,colors,Html,Css,Twitter Bootstrap,Colors,所以我有一个导航栏,我想在鼠标悬停时改变它的颜色。它的默认值是黑色,我希望它是浅灰色的白色。我做错了什么 HTML: 还有一个旁注:我希望每个列表项都用一条垂直线分开,如:“|”尝试添加大括号: li a:hover {{background-color: #111;}} 尝试添加大括号: li a:hover {{background-color: #111;}} 将li a:hover背景色更改为#CCC并删除以下内容: *::selection { /*This should hand

所以我有一个导航栏,我想在鼠标悬停时改变它的颜色。它的默认值是黑色,我希望它是浅灰色的白色。我做错了什么

HTML:

还有一个旁注:我希望每个列表项都用一条垂直线分开,如:“|”

尝试添加大括号:

li a:hover {{background-color: #111;}}
尝试添加大括号:

li a:hover {{background-color: #111;}}

li a:hover
背景色更改为
#CCC
并删除以下内容:

*::selection { /*This should handle the hover color situation right?*/
  background: #cc0000;
  color: #ffffff;
}
*::-moz-selection {
   background: #cc0000;
   color: #ffffff;
}
*::-webkit-selection {
   background: #cc0000;
   color: #ffffff;
}

我假设你的
#111
不是“黑色”而是“黑色”,因此被视为黑色;)

li a:hover
背景色更改为
#CCC
,并删除以下内容:

*::selection { /*This should handle the hover color situation right?*/
  background: #cc0000;
  color: #ffffff;
}
*::-moz-selection {
   background: #cc0000;
   color: #ffffff;
}
*::-webkit-selection {
   background: #cc0000;
   color: #ffffff;
}

我假设你的
#111
不是“黑色”而是“黑色”,因此被视为黑色;)

只需更换此块:

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    /* Separator Border */
    border-right: 1px solid #000;
}

li a:hover {
    /* Background color on hover */
    background-color: silver;
    color: #fff;
}
最终css:

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

li {
    float: left;
}

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    border-right: 1px solid #000;
}

li a:hover {
    background-color: silver;
    color: #fff;
}

#header {
    background-color: #503F31;
    color: white;
    padding: 30px;
}

#searchMenu {
    margin-left: 1450px;
}

#sweBtn {
    font-family: 'Times New Roman';
    background-color: Transparent;
    color: grey;
}

#engBtn {
    font-family: 'Times New Roman';
    background-color: Transparent;
    color: gold;
}

#searchTxt {
    background-color: grey;
    border-color: grey;
}

#searchBtn {
    font-family: 'Times New Roman';
    background-color: Transparent;
    color: gold;
}

#imgText {
    font-size: 25px;
    position: absolute;
}

#imgHeader {
    width: 1904px;
}

#navBar {
    font-family: 'Times New Roman';
    color: gold;
    background-color: #503F31;
}

#footer {
    background-color: grey;
    color: white;
    padding-bottom: -250px;
}

*::selection { /*This should handle the hover color situation right?*/
  background: #cc0000;
  color: #ffffff;
}
*::-moz-selection {
  background: #cc0000;
  color: #ffffff;
}
*::-webkit-selection {
  background: #cc0000;
  color: #ffffff;
}

只需更换以下模块:

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    /* Separator Border */
    border-right: 1px solid #000;
}

li a:hover {
    /* Background color on hover */
    background-color: silver;
    color: #fff;
}
最终css:

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

li {
    float: left;
}

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    border-right: 1px solid #000;
}

li a:hover {
    background-color: silver;
    color: #fff;
}

#header {
    background-color: #503F31;
    color: white;
    padding: 30px;
}

#searchMenu {
    margin-left: 1450px;
}

#sweBtn {
    font-family: 'Times New Roman';
    background-color: Transparent;
    color: grey;
}

#engBtn {
    font-family: 'Times New Roman';
    background-color: Transparent;
    color: gold;
}

#searchTxt {
    background-color: grey;
    border-color: grey;
}

#searchBtn {
    font-family: 'Times New Roman';
    background-color: Transparent;
    color: gold;
}

#imgText {
    font-size: 25px;
    position: absolute;
}

#imgHeader {
    width: 1904px;
}

#navBar {
    font-family: 'Times New Roman';
    color: gold;
    background-color: #503F31;
}

#footer {
    background-color: grey;
    color: white;
    padding-bottom: -250px;
}

*::selection { /*This should handle the hover color situation right?*/
  background: #cc0000;
  color: #ffffff;
}
*::-moz-selection {
  background: #cc0000;
  color: #ffffff;
}
*::-webkit-selection {
  background: #cc0000;
  color: #ffffff;
}

那么你的悬停CSS规则在哪里?*::选择{/*这应该正确处理悬停颜色的情况?*/背景:#cc0000;颜色:#ffffff;}不,那是完全不同的。那么你的悬停CSS规则在哪里?*::选择{/*这应该正确处理悬停颜色的情况?*/背景:#cc0000;颜色:#ffffffff;}不,那是完全不同的事情。那不是有效的CSS。那不是有效的CSS。