悬停后文字颜色不会改变

时间:2015-01-02 17:09:17

标签: html css css3

@charset "utf-8";
/* CSS Document */
a.header {
	text-decoration: none;
	color: #e4703e;
}

a.header1 {
	text-decoration: none;
	color: #E74C3C;
}

a.header2 {
	text-decoration: none;
	color: #00aced;
}

a.header3 {
	text-decoration: none;
	color: #2C3E50;
}

a.header4 {
	text-decoration: none;
	color: #517fa4;
}

a.header5 {
	text-decoration: none;
	color: #E74C3C;
}

a.header6 {
	text-decoration: none;
	color: #E74C3C;
}
* {
	padding: 0;
	margin-top: 0px;
	margin-right: 0px;
	margin-left: 0px;
	margin-bottom: 0px;
	font-family: 'Lato', sans-serif;
	box-sizing: border-box;
}

.float-right {
  float: right;
}

.fa {
	font-size: .8em;
	font-family: 'FontAwesome';
	line-height: 22px !important;
	margin-right: 2px;
}

dropdown {
	display: inline-block;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	vertical-align: top;
}

dropdown label, dropdown ul li {
  display: block;
  width: 200px;
  background: #FFFFFF;
  padding: 15px 20px;
}

dropdown label:hover, dropdown ul li:hover {
  background: #e4703e;
  color: white;
  cursor: pointer;
}

dropdown label {
  color: #e4703e;
  border-left: 4px solid #e4703e;
  position: relative;
  z-index: 2;
}

dropdown input {
  display: none;
}

dropdown input ~ ul {
  position: relative;
  visibility: hidden;
  opacity: 0;
  top: -20px;
  z-index: 1;
}

dropdown input:checked + label {
	background: #e4703e;
	color: white;
}

dropdown input:checked ~ ul {
  visibility: visible;
  opacity: 1;
  top: 0;
}

.link1, dropdown ul li:nth-child(1) {
  border-left: 4px solid #E74C3C;
  text-decoration: none;
  color: #E74C3C;
}
dropdown ul li:nth-child(1) .fa {
  color: #E74C3C;
}
dropdown ul li:nth-child(1):hover {
  background: #E74C3C;
  color: #FFFFFF;
  
}
dropdown ul li:nth-child(1):hover .fa {
  color: white;
}

dropdown ul li:nth-child(2) {
  border-left: 4px solid #00aced;
}
dropdown ul li:nth-child(2) .fa {
  color: #00aced;
}
dropdown ul li:nth-child(2):hover {
  background: #00aced;
  color: #FFFFFF;
}
dropdown ul li:nth-child(2):hover .fa {
  color: white;
}

dropdown ul li:nth-child(3) {
  border-left: 4px solid #2C3E50;
}
dropdown ul li:nth-child(3) .fa {
  color: #2C3E50;
}
dropdown ul li:nth-child(3):hover {
  background: #2C3E50;
  color: white;
}

dropdown ul li:nth-child(3):hover .fa {
  color: white;
}
dropdown ul li:nth-child(4) {
  border-left: 4px solid #517fa4;
}
dropdown ul li:nth-child(4) .fa {
  color: #517fa4;
}
dropdown ul li:nth-child(4):hover {
  background: #517fa4;
  color: white;
}
dropdown ul li:nth-child(4):hover .fa {
  color: white;
}

dropdown ul li:nth-child(5) {
  border-left: 4px solid #bb0000;
}
dropdown ul li:nth-child(5) .fa {
  color: #bb0000;
}
dropdown ul li:nth-child(5):hover {
  background: #bb0000;
  color: white;
}
dropdown ul li:nth-child(5):hover .fa {
  color: white;
}

dropdown ul li:nth-child(6) {
  border-left: 4px solid #517fa4;
}
dropdown ul li:nth-child(6) .fa {
  color: #517fa4;
}
dropdown ul li:nth-child(6):hover {
	background: #517fa4;
	color: #E74C3C;
}
dropdown ul li:nth-child(6):hover .fa {
  color: white;
}

.animate {
  -webkit-transition: all .3s;
  -moz-transition: all .3s;
  -ms-transition: all .3s;
  -ms-transition: all .3s;
  transition: all .3s;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Chrome and Safari */
  -moz-backface-visibility: hidden;
  /* Firefox */
  -ms-backface-visibility: hidden;
  /* Internet Explorer */
}

@charset "utf-8";
/* CSS Document */

body {
  margin-top: 180px;
  background-color: #112;
  background-color: #0c2d41;
  font-family: roboto, 'helvetica neue', helvetica, arial, sans-serif;
}
.container {
  width: 800px;
  margin: auto;
}
.row {
  position: relative;
  height: 50px;
  z-index: 1;
  clear: both;
  margin-bottom: 30px;
  text-align: center;
}
.row--intro {
	padding-top: 10px;
	font-size: 16px;
	line-height: 28px;
	font-weight: 300;
	color: #fff;
	opacity: 0.4;
	margin-right: 0px;
}
.row--intro span {
  font-size: 11px;
}
.skew-title {
  font-size: 25px;
}
.skew-title span {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 50px;
  margin: auto;
  z-index: 2;
  text-align: center;
  color: #fff;
  font-family: 'roboto condensed';
  font-weight: 700;
  font-size: 35.714285714285715px;
  line-height: 50px;
  -webkit-transform: skewY(-15deg);
      -ms-transform: skewY(-15deg);
          transform: skewY(-15deg);
  -webkit-transform-origin: 0 100%;
      -ms-transform-origin: 0 100%;
          transform-origin: 0 100%;
  -webkit-transition: all 0.2s;
          transition: all 0.2s;
  cursor: default;
}
.skew-title span:after,
.skew-title span:before {
  display: block;
  top: 0;
  left: 0;
  position: absolute;
  background: #185a81;
  height: 50px;
  width: 40px;
  content: ' ';
  z-index: -1;
  -webkit-transition: all 0.2s;
          transition: all 0.2s;
}
.skew-title span:before {
  background: rgba(0,0,0,0.1);
  -webkit-transform: skewY(15deg);
      -ms-transform: skewY(15deg);
          transform: skewY(15deg);
  -webkit-transform-origin: 0 0;
      -ms-transform-origin: 0 0;
          transform-origin: 0 0;
}
.skew-title span:nth-child(even) {
  background-color: #154e70;
  -webkit-transform: skewY(15deg);
      -ms-transform: skewY(15deg);
          transform: skewY(15deg);
  -webkit-transform-origin: 100% 100%;
      -ms-transform-origin: 100% 100%;
          transform-origin: 100% 100%;
}
.skew-title span:nth-child(even):after {
  background-color: #154e70;
}
.skew-title span:nth-child(even):before {
  -webkit-transform-origin: 100% 0;
      -ms-transform-origin: 100% 0;
          transform-origin: 100% 0;
  -webkit-transform: skewY(-15deg);
      -ms-transform: skewY(-15deg);
          transform: skewY(-15deg);
}
.skew-title span.flat {
  -webkit-transform: skewY(0);
      -ms-transform: skewY(0);
          transform: skewY(0);
}
.skew-title span.flat:before {
  -webkit-transform: skewY(0);
      -ms-transform: skewY(0);
          transform: skewY(0);
}
.skew-title span.flat:nth-child(even):after {
  background-color: #185a81;
}
.skew-title span.alt:after {
  background-color: #b94a2c;
}
.skew-title span.alt:nth-child(even):after {
  background-color: #a14026;
}
.skew-title span.alt.flat:nth-child(even):after {
  background-color: #b94a2c;
}

.blueline {
	color: #326c9c;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>CodePen - Skewed title text</title>
    <link href="http://fonts.googleapis.com/css?family=Roboto:400,300,700" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:700" rel="stylesheet" type="text/css">
    <link href="css/skew.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet" type="text/css">
    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="css/dropdown.css" rel="stylesheet" type="text/css">
</head>
<body>
    <div class="container">
        <div id="TitleSlogan">
            <h1 class="row skew-title">
                <span dw_span_id="true">J</span>
                <span dw_span_id="true">O</span>
                <span dw_span_id="true">O</span>
                <span dw_span_id="true">S</span>
                <span dw_span_id="true">T</span>
                <span dw_span_id="true">L</span>
                <span dw_span_id="true">E</span>
                <span class="last" dw_span_id="true">K</span>
                &nbsp; 
                <span class="alt" dw_span_id="true">T</span>
                <span class="alt" dw_span_id="true">E</span>
                <span class="alt" dw_span_id="true">C</span>
                <span class="alt last" dw_span_id="true">H</span>
            </h1>
            <p class="row row--intro">Making games since 2014!</p>
        </div>
        <div id="dropdown">
            <dropdown>
                <input id="toggle" type="checkbox">
                <a href="index.html" class="header">
                    <label for="toggle" class="animate">Home
                        <i class="fa fa-home float-right"></i>
                    </label>
                </a>
                <ul class="animate">
                    <li class="animate">Processing
                        <i class="fa fa-spinner fa-spin float-right"></i>
                    </li>
                </ul>
            </dropdown>
            <dropdown>
                <input id="toggle2" type="checkbox">
                <label for="toggle2" class="animate">Games
                    <i class="fa fa-gamepad float-right"></i>
                </label>
                <ul class="animate">
                    <li class="animate">
                        <a href="venture.html" class="link">
                            Venture
                        </a>
                        <i class="fa fa-leaf float-right"></i>
                    </li>
                </ul>
            </dropdown>
            <dropdown>
                <input id="toggle3" type="checkbox">
                <label for="toggle3" class="animate">Coding
                    <i class="fa fa-file-text float-right"></i>
                </label>
                <ul class="animate">
                    <li class="animate">
                        <a href="codepen.io/joostlek" class="header">
                            Codepen
                        </a>
                        <i class="fa fa-codepen float-right"></i>
                    </li>
                    <li class="animate">
                        <a href="http://www.github.com/joostlek">
                            Github
                        </a>
                        <i class="fa fa-github float-right"></i>
                    </li>
                </ul>
            </dropdown>
            <dropdown>
                <input id="toggle4" type="checkbox">
                <label for="toggle4" class="animate">Contact Me
                    <i class="fa fa-gamepad float-right"></i>
                </label>
                <ul class="animate">
                    <li class="animate">Google+
                        <i class="fa fa-google-plus float-right"></i>
                    </li>
                    <li class="animate">Twitter
                        <i class="fa fa-twitter float-right"></i>
                    </li>
                    <li class="animate">Steam
                        <i class="fa fa-steam float-right"></i>
                    </li>
                    <li class="animate">Facebook
                        <i class="fa fa-facebook float-right"></i>
                    </li>
                    <li class="animate">Youtube
                        <i class="fa fa-youtube-play float-right"></i>
                    </li>
                    <li class="animate">Instagram
                        <i class="fa fa-instagram float-right"></i>
                    </li>
                </ul>
            </dropdown>
        </div>
    </div>

    <script src="http://assets.codepen.io/assets/libs/fullpage/jquery-ab8e840c3dad7ccf2deadb8c40d53bdb.js"></script>

    <script>
        $('.skew-title').children('span').hover(function() {
            var n = $(this).index();
            n++;
            $(this).addClass('flat');
            if ((n % 2 == 0)) {  
                $(this).prev().addClass('flat');
            } else {
                if (!$(this).hasClass('last')) {
                    $(this).next().addClass('flat');
                }  
            }
        }, function() {
            $('.flat').removeClass('flat');
        });
//@ sourceURL=pen.js
</script>

</body>
</html>

我的第二个菜单事情,当鼠标悬停时,下拉列表没有变为白色,并且有一个随机的橙色条,不知何故,如何解决?我希望它是一个没有线的链接,并且颜色与颜色代码相匹配

1 个答案:

答案 0 :(得分:0)

将以下内容添加到您的css代码

    dropdown ul li a {
      color: inherit;
      text-decoration: none;
    }

   dropdown ul li a:hover {
      color: white;
      background: #E74C3C;
      text-decoration: none;
    }