CSS3侧面菜单,移动屏幕?

时间:2016-02-07 17:45:52

标签: css3

我已经为侧面菜单编写了一些CSS3代码,但我需要将菜单进一步向下移动(因为它是高的)。为了移动菜单,我需要更改css3的哪一部分?我的CCS3代码位于下方,您也可以在http://codepen.io/aaron_1986/pen/wMYoYK

查看整个网页
#navigationMenu li{
    list-style:none;
    height:39px;
    padding:2px;
    width:40px;

}
#navigationMenu span {
    width:0;
    left:38px;
    padding:0;
    position:absolute;
    overflow:hidden;

    font-family:'Myriad Pro',Arial, Helvetica, sans-serif;
    font-size:18px;
    font-weight:bold;
    letter-spacing:0.6px;
    white-space:nowrap;
    line-height:39px;

    /* CSS3 Transition: */
    -webkit-transition: 0.25s;

    /* Future proofing (these do not work yet): */
    -moz-transition: 0.25s;
    transition: 0.25s;
}

#navigationMenu a{
    /* The background sprite: */
    background: url('http://res.cloudinary.com/dejafqqbm/image/upload        /v1454847965/navigation_kxrtcc.jpg') no-repeat;

   height:39px;
    width:38px;
    display:block;
    position:relative;
}

#navigationMenu a:hover span{ width:auto; padding:0      20px;overflow:visible;     }
#navigationMenu a:hover{
text-decoration:none;

-moz-box-shadow:0 0 5px #fff;
-webkit-box-shadow:0 0 5px #fff;
box-shadow:0 0 5px #fff;
}

#navigationMenu .home { background-position:0 0;}
#navigationMenu .home:hover {   background-position:0 -39px;}
#navigationMenu .home span{
background-color:#7da315;
 color:#3d4f0c;
text-shadow:1px 1px 0 #99bf31;
}

#navigationMenu .images { background-position:-38px 0;}
#navigationMenu .images:hover { background-position:-38px -39px;}
#navigationMenu .images span{
   background-color:#1e8bb4;
    color:#223a44;
    text-shadow:1px 1px 0 #44a8d0;
}

   #navigationMenu .Links { background-position:-76px 0;}
   #navigationMenu .Links:hover { background-position:-76px -39px;}
   #navigationMenu .Links span{
    background-color:#c86c1f;
    color:#5a3517;
    text-shadow:1px 1px 0 #d28344;
}

#navigationMenu .ContactUs { background-position:-114px 0;}
#navigationMenu .ContactUs:hover{ background-position:-114px -39px;}
#navigationMenu .ContactUs span{
  background-color:#d0a525;
  color:#604e18;
  text-shadow:1px 1px 0 #d8b54b;
}

#navigationMenu .hhh { background-position:-38px 0;}
#navigationMenu .hhh:hover { background-position:-38px -39px;}
#navigationMenu .hhh span{
    background-color:#af1e83;
    color:#460f35;
    text-shadow:1px 1px 0 #d244a6;
}
#navigationMenu .ggg { background-position:-76px 0;}
#navigationMenu .ggg:hover { background-position:-76px -39px;}
#navigationMenu .ggg span{
    background-color:#ffb1b1;
    color:#5a3517;
    text-shadow:1px 1px 0 #d28344;
}

#navigationMenu .zzz { background-position:-114px 0;}
#navigationMenu .zzz:hover{ background-position:-114px -39px;}
#navigationMenu .zzz span{
    background-color:#d9d1ff;
    color:#604e18;
    text-shadow:1px 1px 0 #d8b54b;
}

3 个答案:

答案 0 :(得分:1)

如果我正确地提出了您的问题,您只需要在ul中尽可能多地按下CSS元素,就像这样:

#navigationMenu {
   margin-top: 100px;
}

在这个例子中,我将其推下100px,但你也可以有一些百分比值。查看CODEPEN

中的工作示例

答案 1 :(得分:0)

你可以使用

#navigationMenu {
  margin-top: 4.50%;
}

cekout:http://codepen.io/anon/pen/jWQNNg

答案 2 :(得分:0)

你可以使用

<强> #navigationMenu {   保证金最高限额:4.50%; } enter code here

* {
  margin: 0;
  border: 0;
  padding: 0;
}
body {
  background: #f0f0f0;
  font: 14px/20px Arial, San-Serif;
  color: #555;
  margin: 0;
}

#navigationMenu li{
	list-style:none;
	height:39px;
	padding:2px;
	width:40px;
  
}
#navigationMenu span {
	width:0;
	left:38px;
	padding:0;
	position:absolute;
	overflow:hidden;

	font-family:'Myriad Pro',Arial, Helvetica, sans-serif;
	font-size:18px;
	font-weight:bold;
	letter-spacing:0.6px;
	white-space:nowrap;
	line-height:39px;

	/* CSS3 Transition: */
	-webkit-transition: 0.25s;

	/* Future proofing (these do not work yet): */
	-moz-transition: 0.25s;
	transition: 0.25s;
}

#navigationMenu a{
	/* The background sprite: */
	background: url('http://res.cloudinary.com/dejafqqbm/image/upload/v1454881544/tits_cv39ed.jpg') no-repeat;

	height:39px;
	width:38px;
	display:block;
	position:relative;
}

#navigationMenu a:hover span{ width:auto; padding:0 20px;overflow:visible; }
#navigationMenu a:hover{
	text-decoration:none;

	-moz-box-shadow:0 0 5px #fff;
	-webkit-box-shadow:0 0 5px #fff;
	box-shadow:0 0 5px #fff;
}

#navigationMenu .home {	background-position:0 0;}
#navigationMenu .home:hover {	background-position:0 -39px;}
#navigationMenu .home span{
	background-color:#7da315;
	color:#3d4f0c;
	text-shadow:1px 1px 0 #99bf31;
}

#navigationMenu .images { background-position: -38px 0;}
#navigationMenu .images:hover { background-position:-38px -39px;}
#navigationMenu .images span{
	background-color:#1e8bb4;
	color:#223a44;
	text-shadow:1px 1px 0 #44a8d0;
}

#navigationMenu .Links { background-position:-76px 0;}
#navigationMenu .Links:hover { background-position:-76px -39px;}
#navigationMenu .Links span{
	background-color:#c86c1f;
	color:#5a3517;
	text-shadow:1px 1px 0 #d28344;
}

#navigationMenu .ContactUs { background-position:-114px 0;}
#navigationMenu .ContactUs:hover{ background-position:-114px -39px;}
#navigationMenu .ContactUs span{
	background-color:#d0a525;
	color:#604e18;
	text-shadow:1px 1px 0 #d8b54b;
}

#navigationMenu .hhh { background-position:-152px 0;}
#navigationMenu .hhh:hover { background-position:-152px -39px;}
#navigationMenu .hhh span{
	background-color:#af1e83;
	color:#460f35;
	text-shadow:1px 1px 0 #d244a6;
}
#navigationMenu .ggg { background-position:-190px 0;}
#navigationMenu .ggg:hover { background-position:-190px -39px;}
#navigationMenu .ggg span{
	background-color:#ffb1b1;
	color:#5a3517;
	text-shadow:1px 1px 0 #d28344;
}

#navigationMenu .zzz { background-position:-227px 0;}
#navigationMenu .zzz:hover{ background-position:-227px -39px;}
#navigationMenu .zzz span{
	background-color:#c3bce5;
	color:#604e18;
	text-shadow:1px 1px 0 #d8b54b;
}


header {
  background: #F5F5F5;
  width: 100%;
  height: 86px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  opacity: 0.9%;
  border-bottom: 1px solid gray;
}

#logo {
  margin: 20px;
  float: right;
  width: 200px;
  height:55px;
  background: url(http://res.cloudinary.com/dejafqqbm/image/upload/v1454696003/logo_he9bmd.jpg) no-repeat center;
}
#navigationMenu {
  margin-top: 4.50%;
}
<html>
  <head>
    <meta charset="UFT-8">
    <title>Web Site Images</title>
  </style>
  </head>
<body>
  <header>
    
    <a href="#" id="logo"></a>
  <ul id="navigationMenu">
    <li>
	    <a class="home" href="#">
            <span>Home</span>
        </a>
    </li>

    <li>
    	<a class="images" href="#">
            <span>Images</span>
        </a>
    </li>

    <li>
	     <a class="Links" href="#">
            <span>Links</span>
         </a>
    </li>

    <li>
    	<a class="ContactUs" href="#">
            <span>Contact Us</span>
        </a>
    </li>
    
    <li>
    	<a class="hhh" href="#">
            <span>hhh</span>
        </a>
    </li>
     <li>
    	<a class="ggg" href="#">
            <span>ggg</span>
        </a>
    </li>
    <li>
    	<a class="zzz" href="#">
            <span>zzz</span>
        </a>
    </li>
    
 </ul>
    </u>
    </header>
  

cekout:http://codepen.io/anon/pen/jWQNNg