添加CSS3下拉到现有菜单项而不更改格式

时间:2014-02-01 00:31:32

标签: html css css3

我在上面遇到一些麻烦,可以真正使用一些帮助!

菜单存在的一个页面是:

https://googledrive.com/host/0By60ZMFepOvCYWNKSzlxOVJSYTA

和CSS:

/* Global properties ======================================================== */
html, body {width:100%; padding:0; margin:0;}

sup {
   vertical-align: top;
   font-size:60%;
}
body {   
    color:#6D266A;
    background-color: #FFF3CC;
    font-family: "Futura-Book";
    src: url('Futura-Book.eot');
    src: url('Futura-Book.eot?#iefix') format('embedded-opentype'),
         url('Futura-Book.woff') format('woff'),
         url('Futura-Book.ttf') format('truetype'),
         url('Futura-Book.svg#futura-bookbook') format('svg');
}

.ic {border:0;float:right;background:#FFF3CC;color:#f00;width:50%;line-height:10px;font-size:10px;margin:-220% 0 0 0;overflow:hidden;padding:0}
.mob {width:100%;}
/***********************************************************************/
a {text-decoration:none; cursor:pointer;text-decoration:none; }
a:hover {text-decoration:none;}

.button {background:url(../images/button.png) 0 0 no-repeat; color:#000; font-size:24px; line-height:30px; display:inline-block; padding: 2px 0 5px 43px;}
.button:hover {color:#579700;}

.link {color:#D2A973; text-decoration:none; }
.link:hover {text-decoration:underline;}

.link-2 {font-family: 'Futura-Book', sans-serif; font-weight:300; font-style:italic; color:#D2A973; font-size:20px; line-height:25px; text-decoration:none; }
.link-2:hover {text-decoration:underline;}
.valentines{font-family: 'Futura-Book', sans-serif; font-weight:300; font-style:italic; color:#D2A973; font-size:20px; line-height:25px; text-decoration:none; }
.clr-1 { color:#D2A973;}

.text-1 {font-weight:normal; color:#000; font-size:60px; line-height:72px;}
.text-1 strong {font-weight:normal; margin-top:-32px; display:block;}
.text-2 {font-family: 'Futura-Book', sans-serif; font-weight:300; font-style:italic; color:#6D266A; font-size:21px; line-height:35px;}

.text-3 {font-weight:normal; color:#6D266A; font-size:50px; line-height:60px;}
.text-3 span {color:#D2A973;}
.text-4 {font-family: 'Futura-Book', sans-serif; font-weight:300; font-style:italic; color:#6D266A; font-size:30px; line-height:36px; letter-spacing:-1px;}
.text-5 {font-weight:normal; color:#D2A973; font-size:50px; line-height:60px;}
.text-5 span {vertical-align: text-top; font-size:50%;}
h2 { font-size:31px; line-height:40px; color:#000; font-weight:normal; }

ul {margin:0; padding:0;list-style-image:none;}
ul.list-1 li {padding:0px 0 0px 25px; line-height:25px; background:url(../images/marker.png) 0 5px no-repeat;}
ul.list-1 li a {color:#6D266A;}
ul.list-1 li a:hover {color:#457c00;}

/******************************************************************/
.clear {clear:both; line-height:0; font-size:0; width:100%;}
.wrapper {width:100%; overflow:hidden; position:relative}
.wrap {overflow:hidden; position:relative}
.extra-wrap {overflow:hidden;}
.fleft {float:left;}
.fright {float:right;}
.img-indent {float:left; margin:4px 18px 0px 0;}    
.line-height {line-height:18px;}
.last {margin-right:0px !important; padding-right:0px !important;}

.top {padding-top:37px;}
.top-1 {margin-top:30px;}
.top-2 {margin-top:10px;}
.top-3 {margin-top:12px;}
.top-4 {margin-top:14px;}
.top-5 {margin-top:8px !important;}
.top-6 {margin-top:13px;}
.top-7 {margin-top:34px;}

.left-1 { margin-left:13px;}

.right-1 {margin-right:40px;}

.bot-0 {padding-bottom:0 !important; margin-bottom:0 !important;}

.pad-1 {margin-top:44px; margin-bottom:33px;}

.p1 {padding-bottom:25px;}
.p2 {padding-bottom:13px;}
.p3 {padding-bottom:10px;}
.p4 {padding-bottom:20px;}
.p4 span {font-weight:bold;}
.p5 {padding-bottom:12px;}

/*********************************header*************************************/
header{ width:100%; background:url(../images/header-bg.jpg) 0 0 repeat;}
header>div+div {width:100%; background:url(../images/header-bg-shadow.png) 0 bottom repeat-x; padding-bottom:17px;}
header>div+div>div {width:960px; margin:0 auto; }
h1 {display:inline-block; z-index:1111; margin:16px 0px 0 10px; position:relative; float:left;}

nav {display:inline-block; z-index:1111; position:relative; float:right;}


ul.menu {margin:28px 10px 0px 0px; display:inline-block;}
ul.menu li {float:left; line-height:30px; margin:0px 0px 0px 48px;}
ul.menu li:hover, ul.menu li.current {}
ul.menu li a {font-size:20px; line-height:30px; color:#FFF3CC; display:inline-block; }
ul.menu li a:hover , ul.menu li.current a { color:#D2A973; }

/*********************************content*************************************/

#content {width:100%;padding:0px 0px 48px 0; background:#FFF3CC;}
#mob-content {width:100%;padding:0px 0px 48px 0; background:#FFF3CC;}

.img-border {border:#fff 8px solid; padding-bottom: 10px;}

.box-1 {overflow:hidden; padding:40px 0 34px;}
.box-1 img {float:left; margin-top:-3px;}
.box-1 h2 {margin-bottom:8px;}

.box-2 {background: url(../images/line-1.gif) 0 0 repeat-x #6D266B;}
.box-2>div {background: url(../images/line-1.gif) 0 bottom repeat-x; padding:15px 0 36px 0; text-align:center;}
.box-2>div p.text-4 {margin-top:-7px;}

.box-3 {overflow:hidden; padding:12px 0 0 0;}
.box-3>div { width:180px; float:left; margin-right:25px;}
.box-3>div a.link-2 {display:inline-block; margin:15px 0 6px 0;}

.box-4 {}
.date {overflow:hidden;}
.date strong {display:inline-block; background:url(../images/date.png) 0 0 no-repeat; width:51px; height:53px; float:left; margin-right:5px;font-weight:normal; color:#000; font-size:40px; line-height:48px; text-align:center;}
.date span {font-family: 'Futura-Book', sans-serif; font-weight:300; font-style:italic; color:#000; font-size:20px; line-height:24px; display:inline-block; overflow:hidden; margin-top:21px;}

.box-5 {overflow:hidden; padding-top:8px;}
.box-5 img {margin:4px 10px 0 0;}

.box-6 {overflow:hidden; margin-top:13px;}
.box-6>div { width:290px; float:left; margin-right:35px;}
.box-6 a.link-2 {display:inline-block; margin-bottom:3px;}

.box-7 {overflow:hidden; margin-top:10px;}
.box-7>div { width:290px; float:left; margin-right:35px;}
.box-7 a.link-2 {display:inline-block; margin-bottom:3px;}

/****************************footer************************/
footer {width:950px; overflow:hidden; margin:0 auto; padding:0px 0px 20px 0; }
footer p {float:left; text-align:center; width:580px;}
.soc-icons {overflow:hidden; float:right; margin:8px 73px 0 0;}
.soc-icons span {display:inline-block; float:left;  color:#000; font-size:20px; line-height:27px; margin-right:17px;}
.soc-icons a {display:inline-block; float:left; margin-right:19px;}
.soc-icons a:hover img {opacity:0.7;}

/**********************form**********************/
.map {width:550px; height:450px;}

#form { margin: 12px 0 0px 0px; width:300px; }
#form input {border:#fff 1px solid; background:#fff;font: 13px Arial, Helvetica, sans-serif;color:#b6b6b6; font-style:italic; padding:5px 9px 6px 18px;outline: medium none;width: 300px;  float:left;}
#form textarea {border:#fff 1px solid; background:#fff;font: 13px Arial, Helvetica, sans-serif;color:#b6b6b6; font-style:italic;  height: 268px;outline: medium none;overflow: auto;padding: 6px 0px 0px 18px;width: 281px;resize:none;margin:0px 0 0 0;float:left;}
#form label {position:relative;overflow:hidden;display: block;min-height:35px;}
.btns {text-align:left;  padding-top:15px;}

我需要在主菜单上的处理链接下添加一个包含3个链接的下拉菜单,似乎无法让它播放。

非常感谢任何帮助!

萨姆

1 个答案:

答案 0 :(得分:0)

如果我理解正确,以下情况应该有效:

HTML:

<body>

<ul>
    <li><a>level1</a>
        <ul>
            <li><a>level2</a></li>
        </ul>
    </li>
    <li><a>level1</a></li>
</ul>

</body>

CSS:

ul {
    position:relative;
    list-style:none;
}

ul li a {
    display:inline-block;
    float:left;
    width:100px;
    height:50px;
    background:#eaeaea;
    text-align:center;
    vertical-align:middle;
    line-height:50px;
}

ul ul {
    display:none; 
    position:absolute;
}

ul li:hover > ul {
    display:block;
    top:50px;
}

ul ul li a {
    background:#a7a7a7;   
}

这是工作jsfiddle:http://jsfiddle.net/a9NVN/32/

您可以根据需要设置子菜单css的格式,与父元素无关。

希望我已经回答了你的问题!