链接有什么原因不能改变颜色吗?

时间:2017-05-28 00:18:34

标签: html css frontend

嘿伙计我出于某种原因无法改变我(a)元素的悬停颜色。出于某种原因,它一直停留在浏览器默认设置上?谁能告诉我为什么?

  /* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}


/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

body {
  line-height: 1;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}


/*
  =================================
  Custom Styles
  =================================
*/

body {
  color: #888;
  font: 300 16px/22px "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}


/*
  =================================
  Grid
  =================================
 */

*,
*:before,
*:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.container,
.grid {
  margin: 0 auto;
}

.container {
  padding-left: 30px;
  padding-right: 30px;
}

.col-1-3 {
  width: 33.33%;
}

.col-2-3 {
  width: 66.66%;
}

.col-1-3 {
  display: inline-block;
  vertical-align: top;
}

.grid,
.col-1-3,
.col-2-3 {
  padding-left: 15px;
  padding-right: 15px;
}

.center-me {
  text-align: center;
}


/*
  ======================
  Clearfix
  ======================
*/

.group:before .group:after {
  content: "";
  display: table;
}

.group:after {
  clear: both;
}

.group {
  clear: both;
  *zoom: 1;
}


/*
  ==============================
  Primary Header 
  ==============================
*/

.logo {
  text-align: center;
}


/*
  ===============================
  Typography
  ===============================
*/

h1,
h3,
h4,
h5,
p {
  margin-bottom: 22px;
}

h1 {
  color: #a67c00;
  font-size: 24px;
  line-height: 44px;
}

h2 {
  font-size: 21px;
  line-height: 44px;
}

h3 {
  font-size: 21px;
}

h4 {
  font-size: 18px;
}

h5 {
  /*	color: #a9b2b9;*/
  font-size: 14px;
  /*  font-weight: 400;*/
  strong {
    font-weight: 400;
  }
  cite,
  em {
    font-style: italic;
  }
  /*
  ================================
  Buttons
  ===============================
*/
  .btn {
    border-radius: 5px;
    display: inline-block;
    margin: 0;
  }
  .btn-alt {
    border: 1px solid #dfe2e5;
    padding: 10px 30px;
  }
  .primary-nav {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: .5px;
    text-transform: uppercase;
  }
  /* 
  ==================
  Links
  ==================
*/
  a:hover {
    color: #a67c00;
  }
  a {
    color: #000000;
  }
<title>Rysh</title>

<body>
  <!--header-->

  <header class="container center-me">
    <h1 class="logo">Rysh</h1>
    <nav class="primary-nav">
      <a href="shop.html">Shop</a>
      <a href="about.html">About</a>
    </nav>
  </header>
</body>

你可以在最底层的css中看到我的(a)元素,顶部只是一个CSS重置

2 个答案:

答案 0 :(得分:6)

您的CSS有语法错误。您的H5规则未正确关闭,导致此后的所有内容出现问题。

h5 {
  /*    color: #a9b2b9;*/
  font-size: 14px;
 /*  font-weight: 400;*/
strong {
   font-weight: 400;
}

应该是:

h5 {
  /*    color: #a9b2b9;*/
  font-size: 14px;
}

strong {
  /*  font-weight: 400;*/
  font-weight: 400;
}

答案 1 :(得分:1)

您的css代码中存在语法错误:

h5 {
font-size: 14px;
                      strong {
                      font-weight: 400;
                      }
cite,
                      em {
                      font-style: italic;
                      }

缺少什么? ; - )

使用“}”

关闭'h5'

h5 {
font-size: 14px;
                  strong {
                  font-weight: 400;
                  }
cite,
                  em {
                  font-style: italic;
                  }
}

*祝你好运!