我的导航栏的CSS问题

时间:2015-11-01 12:46:05

标签: css

我试图这样做,当用户将鼠标悬停在导航栏中的链接上时,字体颜色变为蓝色,但我无法更改它。 我试过这个:

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    char playerName[1024];
    int playerAge;

    printf("What's your name, and your age?\nYour name: ");
    scanf("%1023s\n", playerName); /* max length = # of elements - 1 for terminating null character */
    printf("Your age: ");
    scanf("%d\n", &playerAge);
    printf("Okay %s, you are %d years old!", playerName, playerAge);

    return 0;
}

但它还没有奏效。有帮助吗?的jsfiddle:https://jsfiddle.net/0k6wnvs6/

2 个答案:

答案 0 :(得分:0)

尝试以下css

ul#nav li a:hover{
  color: #1B8AD8;
  background: none;
  text-decoration: none;
}

答案 1 :(得分:0)

您的规则与之后定义的其他规则冲突:

#nav li:hover a{ /* These create persistent hover states, meaning the top-most link stays 'hovered' even when your cursor has moved down the list. */
    text-decoration: none;
    color: #181818; /* <- conflict */
}

删除color: #181818; 或者将!important标志添加到原始标志:

#nav a:hover{
  color: #1B8AD8 !important;
  background: none;
  text-decoration: none;
}

编辑:

当我更新我的答案时,你似乎正在改变你的小提琴链接中的CSS,试着避免冲突。