用CSS的style语句使图片、播放器等居中的代码、效果(图)

本帖于 2012-10-19 21:01:52 时间, 由普通用户 smallguy 编辑

代码:
<p><img src="http://i47.tinypic.com/21cryfp.jpg" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p> <embed height="30" style="display: block; margin-left: auto; margin-right: auto;" type="audio/mpeg" width="390" src="http://www.rolia.cn/singers/ingale/mengtian8.mp3" autostart="true" loop="true" /></embed> </p>

效果:



另外一种表达法更为简单,使用text-align来完成。

代码:
<p><img src="http://i47.tinypic.com/21cryfp.jpg" style="text-align:center;" /></p>

效果:

所有跟帖: 

这个问题困扰我很久,相信很多朋友也有同样感受。特别提上来贴出。 -smallguy- 给 smallguy 发送悄悄话 smallguy 的博客首页 (0 bytes) () 10/07/2012 postreply 12:37:25

揖谢~ -弓尒- 给 弓尒 发送悄悄话 弓尒 的博客首页 (0 bytes) () 10/07/2012 postreply 12:38:42

不用谢~~ 俺把你的音乐搬了过来,展示了播放器,这下成了音乐贴子:)) -smallguy- 给 smallguy 发送悄悄话 smallguy 的博客首页 (0 bytes) () 10/07/2012 postreply 15:10:57

鹅地 94 泥地,咱俩 水跟水 雅~ :)) -弓尒- 给 弓尒 发送悄悄话 弓尒 的博客首页 (0 bytes) () 10/07/2012 postreply 16:15:19

收入热心网友 -yy888- 给 yy888 发送悄悄话 yy888 的博客首页 (0 bytes) () 10/07/2012 postreply 15:02:35

才子雅雅真是细致周到,分享了那么多的制帖经验,谢谢热情助人的小yaya! -片片红叶- 给 片片红叶 发送悄悄话 片片红叶 的博客首页 (0 bytes) () 10/07/2012 postreply 17:46:36

谢谢热心助人的雅雅宝贵制贴经验分享!:)) -小声音- 给 小声音 发送悄悄话 小声音 的博客首页 (0 bytes) () 10/07/2012 postreply 18:26:19

请您先登陆,再发跟帖!