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)
添加position: relative到#container和h5.然后你可以用left和top(或right和bottom)移动标题.
#container {
position: relative;
}
h5 {
position: relative;
left: 10px;
top: 5px;
}
Run Code Online (Sandbox Code Playgroud)
这是一个演示:http://jsfiddle.net/alp82/4b9xK/
| 归档时间: |
|
| 查看次数: |
16063 次 |
| 最近记录: |