疑难问题:图片+文字
不过图片是通过背景定位取图的应该怎么写
环境:vs2008+文件系统网站+网页母版设计
问题:如题
html代码如下:
<div id="mytitle">
<h1 id="footer_t_1">
<div style="background-image: url(images/footer_ico.gif); background-repeat: no-repeat; background-position: 0px 0px; width: 40px"></div>
标题1</h1>
<h1 id="footer_t_2">
<div></div>
标题2</h1>
<h1 id="footer_t_3">
<div></div>
标题3</h1>
</div>
分析:现在的问题是所有h1不是排成一行的,每个h1换行.\
同时h1内我需要显示“图片”+“文字”,现在是“图片”和“文字”成两行。
<h1><div></div>标题</h1>要这么用的原因是footer_ico.gif是一张大图,里边有很多小的图片我需要定位取图
问题1.我想让#footer_t_1到#footer_t_3排成一行
问题2.在h1中我想认“div”与“文字”排成一行
上边两个问题解决的话:css应该怎么写?谢谢大家了!
问题:如题
html代码如下:
<div id="mytitle">
<h1 id="footer_t_1">
<div style="background-image: url(images/footer_ico.gif); background-repeat: no-repeat; background-position: 0px 0px; width: 40px"></div>
标题1</h1>
<h1 id="footer_t_2">
<div></div>
标题2</h1>
<h1 id="footer_t_3">
<div></div>
标题3</h1>
</div>
分析:现在的问题是所有h1不是排成一行的,每个h1换行.\
同时h1内我需要显示“图片”+“文字”,现在是“图片”和“文字”成两行。
<h1><div></div>标题</h1>要这么用的原因是footer_ico.gif是一张大图,里边有很多小的图片我需要定位取图
问题1.我想让#footer_t_1到#footer_t_3排成一行
问题2.在h1中我想认“div”与“文字”排成一行
上边两个问题解决的话:css应该怎么写?谢谢大家了!
...全文
请发表友善的回复…
发表回复
夜雨_Jason 2010-01-13
- 打赏
- 举报
我晕,干吗那样子写
可以
#mytitle h1#footer_t_1{background-image: url(.../images/footer_ico.gif) no-repeat;}
可以
#mytitle h1#footer_t_1{background-image: url(.../images/footer_ico.gif) no-repeat;}
jayfunk 2010-01-13
- 打赏
- 举报
补充需要取的小图都是40px*40px的!
a183249556 2010-01-13
- 打赏
- 举报
1.让mytitle和h1都向左浮动
2.footer_t_1中的div和也向左浮动,不过你要保证footer_t_1的宽度大于40多才能让子和DIV在同一行
3.然后在写一个层<div style="clear:both"></div>放到mytitle的下一个标签。
2.footer_t_1中的div和也向左浮动,不过你要保证footer_t_1的宽度大于40多才能让子和DIV在同一行
3.然后在写一个层<div style="clear:both"></div>放到mytitle的下一个标签。
bhbhxy 2010-01-13
- 打赏
- 举报
<div style="background-image: url(images/footer_ico.gif); background-repeat: no-repeat; background-position: 0px 0px; width: 40px; float:left"> </div>
<span style="float:left">标题1<span>
这样就可以同一行了
<span style="float:left">标题1<span>
这样就可以同一行了
jayfunk 2010-01-13
- 打赏
- 举报
不想用table
andyan_2008 2010-01-13
- 打赏
- 举报
外层用table布局,把图片的div和文字放到table的同一行中