javascript - 将元素放置在特定的 px 处,但让文本围绕它流动

标签 javascript jquery html css

我能否在页面上的特定 px 位置放置一个元素(例如图像),然后让文本围绕它流动?

必要时使用 JS/jquery。

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

编辑:假设页面上全是文本,那么更改图像的位置不应改变文本的开始和结束位置,而应该围绕图像的新位置流动。

最佳答案

希望对您有所帮助。

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

关于javascript - 将元素放置在特定的 px 处,但让文本围绕它流动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32940802/

相关文章:

javascript - Angular.js - 在其他任何事情之前运行服务功能?

html - 如何使长文本适合小的 div?

javascript - 嵌套的 div 填充父 div 中的区域

javascript - 如何通过单击按钮显示 iframe (JavaScript)

javascript - 尝试编辑字符串中的所有 <a>

javascript - 是否可以使用一组参数同时调用两个函数?

javascript - Scrollmagic 添加结束触发器

jquery - 如何计算获取返回值的时间

javascript - 使用 Ajax 进行实时搜索时出错

html - 在表格内等分 100% 宽度的表格单元格