Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS文本定位_Css_Text_Alignment - Fatal编程技术网

CSS文本定位

CSS文本定位,css,text,alignment,Css,Text,Alignment,我有一个容器,我有保存h5文本的信息。当分辨率不同时,如何将文本放置在容器中我想要的任何位置,而不会弄乱页面。谢谢 <style media="screen" type="text/css"> body { background-color:#C0C0C0; } #container { background-image:url('pic.png'); background-repeat: no-repeat; he

我有一个容器,我有保存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>

身体{
背景色:#C0;
}
#容器{
背景图片:url('pic.png');
背景重复:无重复;
身高:541px;
宽度:1020px;
保证金:自动;
}
#信息{
高度:500px;
宽度:700px;
}
a:链接{
文字装饰:无;
颜色:#000000;
}
a:悬停{
背景色:#EFEF;
} 
h5{
颜色:黑色;
字号:0.9em;
}

添加
位置:相对于
#容器
和相对于
h5
。然后您可以使用
(或
)移动标题


这里有一个演示:

你说的“不把页面弄乱”是什么意思?如果可能的话,举一个你想要达到的目标的例子,即使这是一个图像,它也会帮助那些想要帮助的人,想象你想要做什么。好的。因此分辨率为1440x900,更改为1024x768,文本移动并位于容器的不同部分。我怎样才能让它“粘住”?
#container {
    position: relative;
}


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