简体   繁体   English

带有背景img的文字换行

[英]Text Wrap with a background-img

As shown in this screenshot, I'm trying to get my text to wrap so that it goes around the background-img. 如该屏幕快照所示,我正在尝试将文本换行,以使其围绕background-img。

Obviously this won't work all in itself, therefore I've come here to ask for a possible solution. 显然,这本身并不能解决所有问题,因此,我来​​这里寻求可能的解决方案。 There are a few ways I've thought of myself, such as putting the image there using absolute positioning, but I'm pretty sure it wouldn't help me wrap the text. 我想到了几种方法,例如使用绝对定位将图像放置在那里,但是我很确定这不会帮我包装文字。

recently found just such a piece can help 最近发现这样的一块可以帮助

shape 形状

Create a css class named TextWrap or whatever you choose with properties as follows: 创建一个名为TextWrap或诸如此类的带有属性的CSS类,如下所示:

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

Adjust the float/margin depending on where you want the image in relation to the text. 根据您想要图像相对于文本的位置来调整浮动/边距。 Add the class as the name in your image in HTML. 将类作为名称添加到HTML中的图像中。

There is jQuery plugin for stuff like this: 有一个jQuery插件,用于这样的事情:

http://www.jwf.us/projects/jQSlickWrap/ http://www.jwf.us/projects/jQSlickWrap/

Here what they say: 他们在这里说什么:

Why would I need this? 我为什么需要这个?

If you've ever felt the need to wrap stuff around an irregularly-shaped image using CSS's float, you may have been somewhat disappointed to find out that it's forced to wrap around the image's bounding box, rather than the actual contents of the image. 如果您曾经需要使用CSS的float将东西包裹在不规则形状的图像上,可能会有些失望,因为发现它被迫包裹在图像的边框上,而不是图像的实际内容。

UPD. UPD。 And yet another one: http://baconforme.com/ 还有一个: http//baconforme.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM