简体   繁体   English

将图像浮动到右下角,文字环绕

[英]Floating an image to the bottom right with text wrapping around

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否有可能在 HTML 和 CSS 中实现这一点(CSS3 很好)? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

I have a text container with paragraphs and headings.我有一个带有段落和标题的文本容器。 At the bottom of the page I want to float an image to the right of the page, while the text wraps around the image.在页面底部,我想将图像浮动到页面右侧,而文本环绕图像。 The bottom of the image should be flush with the bottom of the last paragraph.图像的底部应与最后一段的底部齐平。

The page width is variable (responsive), but the image dimensions are fixed.页面宽度是可变的(响应式),但图像尺寸是固定的。 Is it possible to accomplish this in HTML and CSS (CSS3 is fine)?是否可以在 HTML 和 CSS(CSS3 很好)中完成此操作? If not, can it be done with a minimal amount of Javascript?如果没有,可以用最少的 Javascript 来完成吗?

Here's a schematic example of what I want to accomplish:这是我想要完成的一个示意性示例:

右下角浮动图片

The HTML currently looks something like this, but it can be changed if necessary. HTML 目前看起来像这样,但可以根据需要进行更改。 I don't particularly care where in the document the image is located.我并不特别关心图像在文档中的位置。 Using background images instead would be fine too.使用背景图像也可以。

<section>
  <h2>...</h2>
  <p>... ...</p>
  <p>... ...</p>
  ...
  <img src="...">
</section>

When I set float: right on the image, it floats to the right but I cannot get it to align to the bottom of the page.当我在图像上设置float: right时,它会向右浮动,但我无法让它与页面底部对齐。 Suggestions?建议?

Edit: the closest I got is this ... :-)编辑:我得到的最接近的是这个...... :-)

Not quite there yet - but you might get where I'm going.还没有到那里——但你可能会得到我要去的地方。 Maybe someone else will complete this (if possible).也许其他人会完成这个(如果可能的话)。

 div.wrapper { width: 300px; transform: rotate(-90deg); writing-mode: vertical-lr; } p.text { margin-top: 1em; writing-mode: vertical-lr; } img { float: right; transform: rotate(90deg); height: 100px; width: 100px; }
 <div class="wrapper"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAYAAACqNX6+AAAAAXNSR0IArs4c6QAABCZJREFUeF7t3D9I80AUAPBXcFBwEQcRwcGl4KhLQTvXWQQHdRasWDroIEitxVVBRFCc/DO4ddRZhU5CwcWldCiVDiqFgkUEP9593HE5kjZNk/vTJouNudxd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y7q/OJsN4XhXRlu8/PzbB0SUTALdnd3YXt7m9wE4JR2cXHB1iV+CuurV2vYTVleb3v529eFhQW2hszMzFhuj2m5iYkJAoYBx8V/dnaWPPtks1l2K21729tLGeFmUacLudsHQ5x2cMOg4kZvlzF7kskk3N3dweTkJDlOHwzxgZJ/+MNBsLS0BK+vr+ShE4/Rl/+wDAlfzyTyydkXE4C8nil8gZmc4LdqhX+B2T8GuESS5P5SHQAAAABJRU5ErkJggg==" /> <p class="text"> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. </p> </div>

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

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