画面上图片的布局心得
很难说有什么心得,只是在遇到某些特殊问题时的一些处理方法。(仅供参考,如有更好的请写在下边)
1、当文字与图片、文字与控件、控件与控件发生错位(通常在IE6以上版本)
通常处理方法:定义元素浮动属性 float:left或right,最好这些元素放在一个大元素快中。
例如:
<div style='width:320px'>
<span style='float:left;width:100px'>aaaa</span>
<span style='float:left;width:100px'>aaaa</span>
<span style='float:left;width:100px'>aaaa</span>
</div>
<div style='width:320px'>
<span style='float:left;width:100px'>aaaa</span>
<span style='float:left;width:100px'>aaaa</span>
<span style='float:left;width:100px'>aaaa</span>
</div>
2、当画面上需要显示大图片,最好根据图片情况,切割成几个小图片。
图片被截成了三个 分别是 头 zl010.gif 中间 hengxian011.gif 尾 hengxian012.gif
html代码:
=================================================================================
<div class="left">
<div class="left_guidejob">
<div class="left_guidejob_title"></div>
<div class="left_guidejob_content">
<div style="width:100%;margin-top:20px;line-height:25px;">
<span style="width:60px;float:left;padding-left:30px;text-align:left;">
<img src="../Image/icon003.gif" alt="" /></span>
<span style="width:100px;float:left;text-align:left;"><a href="AddRecord.aspx"
target="dataframe">添加指示</a></span>
</div>
<div style="width:100%;margin-top:20px;line-height:20px;">
<span style="width:60px;float:left;padding-left:30px;text-align:left;">
<img src="../Image/icon004.gif" alt="" /></span>
<span style="width:100px;float:left;text-align:left;"><a href="UpdateRecord.aspx"
target="dataframe" onclick="SetDenoteID();">指示记录</a></span>
</div>
</div>
<div class="left_guidejob_bottom">
</div>
=================================================================================
<div class="left">
<div class="left_guidejob">
<div class="left_guidejob_title"></div>
<div class="left_guidejob_content">
<div style="width:100%;margin-top:20px;line-height:25px;">
<span style="width:60px;float:left;padding-left:30px;text-align:left;">
<img src="../Image/icon003.gif" alt="" /></span>
<span style="width:100px;float:left;text-align:left;"><a href="AddRecord.aspx"
target="dataframe">添加指示</a></span>
</div>
<div style="width:100%;margin-top:20px;line-height:20px;">
<span style="width:60px;float:left;padding-left:30px;text-align:left;">
<img src="../Image/icon004.gif" alt="" /></span>
<span style="width:100px;float:left;text-align:left;"><a href="UpdateRecord.aspx"
target="dataframe" onclick="SetDenoteID();">指示记录</a></span>
</div>
</div>
<div class="left_guidejob_bottom">
</div>
css代码:
=================================================================================
.left
{
margin:0;
padding:0;
width:200px;
background-color:#6b84dc;
height:600px;
float:left;
}
.left_guidejob
{
margin-top:30px;
width:168px;
}
.left_guidejob_title
{
width:100%;
margin:0;
padding:0;
height:32px;
background-image:url(../image/zl010.gif);
background-repeat:repeat-y;
color:#4583bf;
font-weight:bold;
font-size:14px;
}
.left_guidejob_content
{
width:100%;
margin:0;
padding:0;
height:150px;
background-image:url(../image/hengxian011.gif);
background-repeat:repeat;
}
.left_guidejob_bottom
{
width:100%;
margin:0;
padding:0;
height:14px;
background-image:url(../image/hengxian012.gif);
background-repeat:repeat-x;
}
=================================================================================
.left
{
margin:0;
padding:0;
width:200px;
background-color:#6b84dc;
height:600px;
float:left;
}
.left_guidejob
{
margin-top:30px;
width:168px;
}
.left_guidejob_title
{
width:100%;
margin:0;
padding:0;
height:32px;
background-image:url(../image/zl010.gif);
background-repeat:repeat-y;
color:#4583bf;
font-weight:bold;
font-size:14px;
}
.left_guidejob_content
{
width:100%;
margin:0;
padding:0;
height:150px;
background-image:url(../image/hengxian011.gif);
background-repeat:repeat;
}
.left_guidejob_bottom
{
width:100%;
margin:0;
padding:0;
height:14px;
background-image:url(../image/hengxian012.gif);
background-repeat:repeat-x;
}
效果如下: