CSS文本定位

fea*_*iux 1 css text alignment

我有一个容器,我有#info持有我的h5文本.如何在容器中将文本放置在我想要的任何位置,而不会在分辨率不同时弄乱页面.谢谢.

    <style media="screen" type="text/css">

    body {
    background-color:#C0C0C0;
    }

    #container {
    background-image:url('pic.png');
    background-repeat: no-repeat;
    height: 541px;
    width:1020px;
    margin: auto;
    }

    #info {
    height:500px;
    width:700px;
    }

    a:link {
    text-decoration: none;
    color:#000000;
    }
    a:hover {
    background-color:#efefef;
    } 

    h5 {
    color:black;
    font-size:0.9em;
    }

   </style>
Run Code Online (Sandbox Code Playgroud)

Alp*_*Alp 5

添加position: relative#containerh5.然后你可以用lefttop(或rightbottom)移动标题.

#container {
    position: relative;
}


h5 {
    position: relative;
    left: 10px;
    top: 5px;
}
Run Code Online (Sandbox Code Playgroud)

这是一个演示:http://jsfiddle.net/alp82/4b9xK/