css 新手。我的页面左上角有一张图片。在它的右边,我有两行垂直对齐的文本。我想在图像的右边缘和文本的最左侧字符之间放置一些空间。我认为 margin-left 或 padding-left 都可以做到这一点,但它不起作用。我究竟做错了什么?谢谢!
<div class="frame">
<div class="page">
<div class="myimage">
<img id="mainpic" src="images/small.png" width="330px" height="220px">
</div>
<div class="title" >
<h1>Some Title</h1>
<p>Short explanation of what to do here.</p>
</div>
</div>
</div>
css 文件:
body{
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
p, h1, form, button{border:0; margin:0; padding:0;}
.frame{
}
.page{
margin:0 auto;
width:1000px;
height:1000px;
}
.myimage {
position:relative;
float:left;
width="330px";
height="220px";
float:left;
}
.title{
position:relative;
float:left
margin-left:100px; <-- one approach, not working
padding-top:100px;
width="670px";
height="220px"
min-height="220px"
}
.title h1 {
padding-left:100px; <--another approach, still not working
color:#000000;
font-size:xx-large;
}
title p {
color:#444444;
font-size:large;
}