文字环绕图片css 图片margin—bottom 下边距自动变成20左右

html-css014

文字环绕图片css 图片margin—bottom 下边距自动变成20左右,第1张

这是因为软件默认的有边界,先*{margin:0}设置所有边界为零,再用id选择器重新设置边界,这里要注意优先级的问题,id选择器的优先级是最高的!希望我的解答能解决你的疑惑,谢谢!

<p>content content content content content content <img src="1.jpg" style="float:right/>content content content content content content content content content content

</p>

在段落中插入img,img设置向右浮动。

<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>