头标记内部的链接(在div内部)不起作用

时间:2014-07-19 20:34:02

标签: html css

我创建了这段代码但是"主页"似乎没有像链接一样工作。在css a:link中," text-decoration"似乎工作,但"颜色"不起作用。并没有像链接那样回应。这是代码:

<!DOCTYPE html>
<html>
<head>

<style>

h4{
float:left;
margin:10px;
text-color:white;
font-family:cursive;
}
.exp{
margin-left:50px;
}
a:link{
text-decoration:none;
color:pink;
}
</style>

</head>

<body style="background-color:#787878">

<div style="background-color:#A2CD5A;
position:absolute; margin-left:180px;
margin-top:100px;width:1000px;
height:750px;">
                <div style="background-color:#CAE1FF;
                position:relative; top:50px;left:250px;
                width:200px;height:400px;">
                </div>
</div>

<div style="position:fixed;top:0px;left:0px;
height:3em;width:100%;background-color:#104E8B;
z-index:10">
    <h4 class="exp"><a href="index.html">Home Page</a></h4>
    <h4>My Blog </h4>
    <h4>Accomplishments</h4>
    <h4>Institutes</h4>
    <h4>Some Fun!</h4>
    <h4>Contact Me</h4>
    <h4>Search:</h4>
    <h6 style="position:relative;top:-16px">
            <form>
            <input type="text" name="search" value="SearchBox"/>
        </form>
        </h6>
</div>


</body>
</html>

1 个答案:

答案 0 :(得分:0)

一些事情:

  • 尝试尊重div标签顺序。首先是标题,然后是内容,依此类推
  • 每次浮动div标签时,该div的容器必须具有属性&#34; overflow:hidden&#34;在风格

  • 如果您正在使用外部css文档,则无需在每个div中添加css,您可以使用id执行此操作,您可以在示例中看到

  • 如果你正在使用菜单,你必须使用一个列表,它们不是标题,所以使用标签h1 ... h6没有任何意义。

  • 我无法重写所有代码,但必须是这样的(带徽标的菜单)。

这是代码!希望能帮助到你 https://drive.google.com/file/d/0B7ID1nfpPSnXRS1KWmhKMnl2RmM/edit?usp=sharing