将元素放置在特定的px,但文本流周围

时间:2015-10-05 03:21:02

标签: javascript jquery html css

我可以将元素(例如图像)放置在页面上的特定px位置,然后让文本在其周围流动吗?

根据需要使用JS / jquery。

我确实看到了Have text flow around an object that can be moved by the user。它没有答案,但它已经有几年了......

编辑:让我们说页面中充满了文字,然后改变图像的位置不应该改变文本开始和结束的位置,而应该只是围绕图像的新位置流动。

1 个答案:

答案 0 :(得分:1)

我希望它可以帮到你。

HTML

<div class="container">
<img class="image" src="http://indianapublicmedia.org/stateimpact/files/2013/01/apple-image-300x300.jpg" alt="Apple" />

 <p class="text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

</div>

CSS

.container
{
    position:absolute;
    top:200px;
    left:200px;
    width:480px;
}

.image
{
    float:left;
    margin:10px;
}

link

相关问题