下拉链接消失在网页正文后面

时间:2014-06-09 02:19:24

标签: html css drop-down-menu menu hyperlink

我有一个链接“服务”的下拉菜单,但是当我尝试建立链接时(我知道颜色和内容已关闭,我稍后会修复它们),它会消失在内容之后页。救命啊!

这是CSS:

    body {

    margin: 0 13% 0 13%;
    padding:0;
    border:0;           /* This removes the border around the viewport in old versions of IE */
    width:100%;
    background-image:url('bg.jpg');
    background-size: 100% auto;
    background-attachment:fixed;
    background-repeat: no-repeat;
    min-width: 600px;
    max-width: 1200px;
    font-size:90%;
}

h1, h2, h3 {
    margin:.8em 0 .2em 0;
    padding:0;
}

p {
    margin:.4em 0 .8em 0;
    padding:0;
}

img {
    margin:10px 0 5px;
}

#ads img {
    display:block;
    padding-top:10px;
}

/* Header styles */
#header {
    clear:both;
    float:left;
    width:80%;
}

#header {
    border-bottom:1px solid #000;
}

#header p,
#header h1,
#header h2 {
    padding:.4em 15px 0 15px;
    margin:0;
}

#header a {
    color:#E47AFF;
}

#header a:hover {
    color:#fff;
    background:#E47AFF;
    text-decoration:none;
}

#header ul {
    color: #FFFFFF;
    float: right;
    margin: 0 10% 0% 0%;
    background: #E47AFF;
    padding: 5px;
    border-radius: 10px;
    list-style: none;
    position: relative;
    display: inline-table;
    overflow: visible;
}

#header ul li {
    float: left;
}

#header ul li:hover {
    background: #000;
    color: #E47AFF;
    position: relative;
}

#header ul li:active {
    background: #FFFFFF;
}

#header ul li a {
    display: block;
    text-decoration: none;
    color: #ffffff;
    padding: 5px 20px;
    display: inline;
}

#header ul:after {
    content: "";
    clear: both;
    display: block;
}

#header ul ul {
    display:none;
}

#header ul li:hover > ul {
    display: block;
    float: left;
}

#header ul ul {
    background: #E47AFF;
    border-radius: 10px;
    padding: 5px;
    position: absolute;
    top: 100%;
}

#header ul ul li {
    float: none;
    position: relative;
    top: 100%;
    width: 125px;
}

#header ul ul li a {
    padding: 5px 15px;
    color: white;
    width: 100px;
}

#links {
    margin: 0 10% 0 10%;
}

/* 'widths' sub menu */
#layoutdims {
    clear:both;
    background:#eee;
    border-top:4px solid #000;
    margin:0;
    padding:6px 15px !important;
    text-align:right;
}

/* column container */
.colmask {
    position:relative;  /* This fixes the IE7 overflow hidden bug */
    clear:both;
    float:left;
    width:80%;          /* width of whole page */
    overflow:hidden;        /* This chops off any overhanging divs */
}

/* common column settings */
.colright,
.colmid,
.colleft {
    float:left;
    width:89%;
    position:relative;
}

.col1,
.col2,
.col3 {
    float:left;
    position:relative;
    padding:0 0 1em 0;
    overflow:hidden;
}

/* 2 Column (right menu) settings */
.rightmenu {
    background:#eee;        /* right column background colour */
}

.rightmenu .colleft {
    right:20%;          /* right column width */
    background:#fff;        /* left column background colour */
}

.rightmenu .col1 {
    width:74%;          /* left column content width (left column width minus left and right padding) */
    left:26%;           /* (right column width) plus (left column left padding) */
}

.rightmenu .col2 {
    width:25%;          /* right column content width (right column width minus left and right padding) */
    left:31%;           /* (right column width) plus (left column left and right padding) plus (right column left padding) */
}

/* Footer styles */
#footer {
    clear:both;
    float:left;
    width:80%;
    border-top:1px solid #000;
}

#footer p {
    padding:0 7% 0 7%;
    margin:0;
}

这是HTML:

<!DOCTYPE html>
<html>
<head>
    <title>Website.</title>
    <link rel="stylesheet" type="text/css" href="screen.css" media="screen" />
</head>
<body>
<div id="page_wrap">
<div id="header">
    <center><img src="berta.jpg"></center>

<div id="links">
    <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="index.html">About</a></li>
        <li><a href="index.html">Background</a></li>
        <li><a href="index.html">Services</a>
            <ul>
                <li><a href="index.html">Example</a></li>
            </ul>   
        </li>
        <li><a href="index.html">Other</a></li>
        <li><a href="index.html">Contact</a></li>
        <li><a href="index.html">Disclaimer</a></li>
    </ul>
</div>

</div>

    <!-- <marquee bgcolor="#cccccc" loop="-1" scrollamount="5" width="100%">Welcome to the webpage of Berta Kay Celtic Reader.</marquee> -->
<div class="colmask rightmenu">
    <div class="colleft">
        <div class="col1">
            <!-- Column 1 start -->
            This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. This is where your content will go. 

            <!-- Column 1 end -->
        </div>
        <div class="col2">
            <!-- Column 2 start -->
            <center><IMG src="roberta.jpg" width="200px"><br>
            Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here. Any sidebar content will go here.
            <!-- Column 2 end -->
        </div>
    </div>
</div>
<div id="footer">
    <p>This page uses the <a href="http://matthewjamestaylor.com/blog/perfect-2-column-right-menu.htm">Perfect 'Right Menu' 2 Column Liquid Layout</a> by <a href="http://matthewjamestaylor.com">Matthew James Taylor</a>. View more <a href="http://matthewjamestaylor.com/blog/-website-layouts">website layouts</a> and <a href="http://matthewjamestaylor.com/blog/-web-design">web design articles</a>.</p>
</div>
</div>
</body>
</html>

请帮助!

1 个答案:

答案 0 :(得分:2)

CSS

#d
{
z-index:100;
}    

列表代码

<ul id='d'>
<li><a href="index.html">Example</a></li>
</ul>

正文中的所有元素都使用z-index:0如果我们手动设置z-index,则z-index较高的元素将位于顶部。