English 中文(简体)
右和相对位置
原标题:float:right and relative positioning

这似乎应该是一个简单的解决方案, 但我似乎无法找出答案。

我需要在每页的同一位置放置一个图像。 我需要文本来覆盖图像的上部和下部。

http://jsfiddle.net/4AnsK/" rel="nreferrer" >http://jsfiddle.net/4AnsK/

注意右上角的图像空间吗? 它不会随图像而变化。 我理解为什么会发生这种情况, 但我不知道如何让它运作。

我尝试过使用相对定位和设置“顶”值。我尝试过边顶、垫垫顶,把它放入一个绝对的Div容器等。我似乎无法弄清楚。任何帮助都是感激不尽的。

最佳回答

这似乎有效,但它需要一些 HTML 黑客。基本上,你只需要在图像上方放一个零维的空格 来将其推倒,而不影响其他任何东西。

添加到 HTML 中, 在图像前 :

<span id="evilNonSemanticSpacer"></span>

使用此 CSS :

#evilNonSemanticSpacer {
    float:right;
    display:block;
    height:210px;
}
img
{
    float: right;
    clear:right;
}​

从图像中移除相对位置, 位置正确, 周围有文字环绕。 示例是 < a href="http://jsfidle. net/4AnsK/11" >here

有一种奇特的铬文字环绕( 上面的行位于图像上方) 。 它不会出现在 Firefox 中。 在 Chrome 中, 我唯一能够修正它的方法是 < code> margin- top: 1. 1 em 在 < code> img 上, 但是在 Firefox 图像上方( 可能还有其他浏览器), 也会导致白空。

问题回答

作为替代办法,能否在第二段或第三段之后放置隐形人,并删除 top: 200px ? 这将产生类似的影响, 尽管您无法保证它将完全为200px。 否则, 您将失去运气, 段落将围绕原始位置浮动 。





相关问题
Using QCView and iSight to capture image

I have a QCView that loads a Quartz file which gives you iSights feedback (basically like a QTCaptureView) Everything displays fine The button simply takes a snapshot using the following simple ...

Taking picture with QTCaptureView

Is it possible to simply take a picture and save it somewhere using a QTCaptureView and Apple s built-in iSight? I ve seen lots of tutorials on recording video but none on simply taking a picture. Any ...

Transform rectangular image into trapezoid

In .NET how can I transform an image into a trapezoid. The Matrix class supports rotation, shear, etc, but I can t see a trapezoidal transformation. I m using the usual System.Drawing.* API, but I m ...

Rotate image through Y-axis on web page

What are my options for rotating an image on a web page through the Y-axis? I m not sure if I even have the terminology right. Is this called a rotate or a transform. Most of the searches that I ve ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

Convert from 32-BPP to 8-BPP Indexed (C#)

I need to take a full color JPG Image and remap it s colors to a Indexed palette. The palette will consist of specific colors populated from a database. I need to map each color of the image to it s "...

热门标签