开发者

CSS Text positioning

I have a container and I have #info holding my h5 text. How can I position the text anywhere i want within the container without messing the page up when the resolution is different. Thanks.

    <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开发者_StackOverflow中文版:hover {
    background-color:#efefef;
    } 

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

   </style>


Add position: relative to #container and to h5. Then you can move the headline with left and top (or right and bottom).

#container {
    position: relative;
}


h5 {
    position: relative;
    left: 10px;
    top: 5px;
}

Here is a demonstration: http://jsfiddle.net/alp82/4b9xK/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜