首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

关于浮动的有关问题

2012-09-03 
关于浮动的问题HTML codehtmlheadstyle typetext/cssimg {float:right}/style/headbodyp

关于浮动的问题

HTML code
<html><head><style type="text/css">img {float:right}</style></head><body><p>在下面的段落中,我们添加了一个样式为 <b>float:right</b> 的图像。结果是这个图像会浮动到段落的右侧。</p><p><img src="/i/eg_cute.gif" />This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.</p></body></html>

这样写右浮动就是正确的。

HTML code
<html><head><style type="text/css">img {float:right}</style></head><body><p>在下面的段落中,我们添加了一个样式为 <b>float:right</b> 的图像。结果是这个图像会浮动到段落的右侧。</p><p>This is some text. This is some text. This is some text.<img src="/i/eg_cute.gif" />This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.</p></body></html>

这样就是掉下来一格,这是今天才发现的因为以前一直用的谷歌浏览器,没发现这个。今天同学说它右浮动的时候老是掉下一格来。用搜狗测试下我的才发现也是一样的。
不太了解过程,求解!

[解决办法]
这是浏览器得到问题,

可以换一种思路 去解决这个问题~
HTML code
<html><head><style type="text/css">img {float:right;display:block;}span{display:block;}</style></head><body><p>在下面的段落中,我们添加了一个样式为 <b>float:right</b> 的图像。结果是这个图像会浮动到段落的右侧。</p><p><span>This is some text. This is some text. This is some text.</span><img src="/i/eg_cute.gif" />This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.</p></body></html> 

热点排行