473,789 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text wrap around image: how can we do it with css?

Hello. I have been using word processor like OOO for nearly 10 years and
such layout is very usual to me:

gopher://sdf.lonestar.org/I/users/we..._correctly.png

but I found it's very difficult to achieve the same layout with HTML/css.
The best result I can achieve is like this:

gopher://sdf.lonestar.org/h/users/weiwu/Expectation.xml

As you can see in Firefox, the list items which wraps around the image has
wrong indent. The list bullet is displayed on-top-of the image, which is
wrong.

I discovered the margin style (which should be what sets list item
indent) do not work when there is an image floated on the left side.

I knew the problem I got must be a very common problem so there must
already be solutions on the Internet, but I cannot figure out what proper
keyword to use to search for solutions, hance this post.

Thanks in advance!
Jan 20 '07 #1
14 8330
Rik
Zhang Weiwu wrote:
Hello. I have been using word processor like OOO for nearly 10 years
and such layout is very usual to me:

gopher://sdf.lonestar.org/I/users/we..._correctly.png

but I found it's very difficult to achieve the same layout with
HTML/css. The best result I can achieve is like this:

gopher://sdf.lonestar.org/h/users/weiwu/Expectation.xml

As you can see in Firefox, the list items which wraps around the
image has wrong indent. The list bullet is displayed on-top-of the
image, which is wrong.

I discovered the margin style (which should be what sets list item
indent) do not work when there is an image floated on the left side.
Then use padding instead of margin to indent list-items, and use
list-style-position: inside;
--
Rik Wasmus
Jan 20 '07 #2
On 2007-01-20, Zhang Weiwu <zh********@rea lss.comwrote:
Hello. I have been using word processor like OOO for nearly 10 years and
such layout is very usual to me:

gopher://sdf.lonestar.org/I/users/we..._correctly.png

but I found it's very difficult to achieve the same layout with HTML/css.
The best result I can achieve is like this:

gopher://sdf.lonestar.org/h/users/weiwu/Expectation.xml

As you can see in Firefox, the list items which wraps around the image has
wrong indent. The list bullet is displayed on-top-of the image, which is
wrong.

I discovered the margin style (which should be what sets list item
indent) do not work when there is an image floated on the left side.
It works for me in Firefox to put a left margin on <li>. In any case a
right margin on the image might be better instead, so the <li>s that fit
below it don't get an extra left indent.

But there is some question here whether what Firefox is doing is
actually correct. Each <liis a block box whose inline content is
offset to flow around the float. Should the list-item marker follow the
inline content or the <liblock box? We might expect the markers right
over on the left positioned somewhere near the left edges of the <li>
block boxes which are under the image.

Indeed that's where the CSS 2.1 spec implies they should be since it
says that the list-item-position property specifies "position with
respect to the principal [i.e. block] box". So whether the markers are
inside or outside, you'd expect them to be somewhere near the principal
box left edge, not near the left edge of the inline box inside it (which
in this case has moved right because of the float).
I knew the problem I got must be a very common problem so there must
already be solutions on the Internet, but I cannot figure out what proper
keyword to use to search for solutions, hance this post.
This is a real problem. list-style-position: inside should work as the
the poster suggested, since in that case the markers are inline boxes
and should go the right of the float. But you might not like the way
<li>s that span multiple lines come out.
Jan 20 '07 #3
On 2007-01-20, Ben C <sp******@spam. eggswrote:
[snip]
Indeed that's where the CSS 2.1 spec implies they should be since it
says that the list-item-position property specifies "position with
respect to the principal [i.e. block] box". So whether the markers are
inside or outside, you'd expect them to be somewhere near the principal
box left edge, not near the left edge of the inline box inside it (which
in this case has moved right because of the float).
Sorry, that was rather misleading and I should put it right. If the
marker position is "inside", it's positioned as if it were an inline box
first thing in the <li>'s block box (aka "principal box").

The situation looks like this, where "F" is the float, and L and R are
the left and right edges of the list item's block box:

LFFFFFFFFF R

An outside marker (m) you would expect to be positioned somewhere like
this (exactly where is up to the UA):

m LFFFFFFFFFF R

off the left edge of the <li>'s block box.

i.e. not like this:

LFFFFFFFFmF R

which is roughly where Firefox seems to put it-- offset to the left of
the inline box containing the <li>'s content.

If the marker position is inside, it should reliably look like this:

LFFFFFFFFFF m R

since the marker is inline and therefore moves right of the float just
like any inline box.
Jan 20 '07 #4
Scripsit Zhang Weiwu:
gopher://sdf.lonestar.org/I/users/we..._correctly.png
Please use http URLs. If you want to author for the WWW, use an http server.

I think it was about five years ago I last saw discussions about Gopher
still being alive. Nobody had seen a living Gopher server.

IE 7 dropped support to the gopher: protocol.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jan 20 '07 #5
In article <4F************ ****@reader1.ne ws.saunalahti.f i>,
"Jukka K. Korpela" <jk******@cs.tu t.fiwrote:
Scripsit Zhang Weiwu:
gopher://sdf.lonestar.org/I/users/we..._correctly.png

Please use http URLs. If you want to author for the WWW, use an http server.

I think it was about five years ago I last saw discussions about Gopher
still being alive. Nobody had seen a living Gopher server.

IE 7 dropped support to the gopher: protocol.
I was surprised... but delighted when my Mozilla browser dusted
itself off and fired up and opened it.

--
dorayme
Jan 21 '07 #6
于 Sat, 20 Jan 2007 15:02:07 -0600,Ben C写到:
On 2007-01-20, Ben C <sp******@spam. eggswrote:
[snip]
The situation looks like this, where "F" is the float, and L and R are
the left and right edges of the list item's block box:

LFFFFFFFFF R

An outside marker (m) you would expect to be positioned somewhere like
this (exactly where is up to the UA):

m LFFFFFFFFFF R

off the left edge of the <li>'s block box.

i.e. not like this:

LFFFFFFFFmF R

which is roughly where Firefox seems to put it-- offset to the left of
the inline box containing the <li>'s content.

If the marker position is inside, it should reliably look like this:

LFFFFFFFFFF m R

since the marker is inline and therefore moves right of the float just
like any inline box.
Your explaination is very prompt and clear. Thanks for helping me with
this issue.

It seems impossible in Firefox to layout the content exactly the way my
word processor has done. If I used 'inside' position the list item line
that wraps many lines looks strange, but acceptable to me.

Thanks a lot for explain this to me and other people on the group.
Jan 21 '07 #7
[snip: Ben's explaination of boxing model and how float works ... ]

If all what you have described is true (obviously it is), then we will
again have problem with <blockquote>

If I float an image to the left side, and explain this image with normal
text flowing around this image, and during my text explanation I need to
use blockquote, then it doesn't work.

+-----------+ <pBlah Blah</p>
| | <blockquote><pQ uote text here blach</p>
| | <p>Again quote text</p>
+-----------+ <p>again, blach</p>
<p>and quotes</p>
</blockquote>

For the above case, the first 3 paragrahs in the blockquote might get
incorrect left-side padding/margin, but the last paragraph in the
blockquote is correctly indented.

Is there a way to workaround this? (except floating image to the right
side instead)
Jan 21 '07 #8
On 2007-01-21, Zhang Weiwu <zh********@rea lss.comwrote:
[snip: Ben's explaination of boxing model and how float works ... ]

If all what you have described is true (obviously it is), then we will
again have problem with <blockquote>
Yes, what happens is the blockquote's block box's left edge is all the
way to the left, under the image, and that's where its margin goes. It's
only the words inside the blockquote (in this case inside <pelements,
which make more block boxes, also stacking up against the left of their
container-- the blockquote) that are moved right to avoid the float.
If I float an image to the left side, and explain this image with normal
text flowing around this image, and during my text explanation I need to
use blockquote, then it doesn't work.

+-----------+ <pBlah Blah</p>
| | <blockquote><pQ uote text here blach</p>
| | <p>Again quote text</p>
+-----------+ <p>again, blach</p>
<p>and quotes</p>
</blockquote>

For the above case, the first 3 paragrahs in the blockquote might get
incorrect left-side padding/margin, but the last paragraph in the
blockquote is correctly indented.
Exactly.
Is there a way to workaround this? (except floating image to the right
side instead)
So long as the left margin you want on the blockquote is known to be
smaller than the width of the float, set the same amount also as right
margin on the float, and it should come out all right, provided that the
blockquote and the <p>s have transparent backgrounds.
Jan 21 '07 #9
Scripsit Ben C:
Yes, what happens is the blockquote's block box's left edge is all the
way to the left, under the image, and that's where its margin goes.
It's only the words inside the blockquote - - that are moved right to
avoid the float.
I think you meant "lines", not "words".
>Is there a way to workaround this? (except floating image to the
right side instead)

So long as the left margin you want on the blockquote is known to be
smaller than the width of the float, set the same amount also as right
margin on the float, and it should come out all right, provided that
the blockquote and the <p>s have transparent backgrounds.
But that would create a uniform right margin for the floated image, so that
<pelements and <blockquoteelem ents would still be lined up on the left,
instead of any visible indentation of <blockquote>.

I don't see any general workaround, but in many special cases, it might be
feasible to use

blockquote { float: left; }

(You'd need to consider what happens in different situations, especially
when the canvas width varies.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jan 21 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1401
by: Savas Ates | last post by:
is there any component to make it.. i want to make user registiration page.. in this page i want to place a image which has a text and a user must be type this text to a text box and after that i will check the textbox value and image text value.. how can i make it.. do i need a component. if there is a component what is its name .. and i need a free one...
3
23025
by: Xerxes | last post by:
Hi, I need help in setting up a page where the text wraps around an image. Right now, I am using table, with text in one <td> and the image in the adjacent <td>. The problem is when the text is longer than the height of the image, I get all this dead space below the image with the text just going vertically down in its own <td>. Can I use style sheet to position the image and the text so that the text can start taking up the whole page...
1
3543
by: Aaron | last post by:
I'm using relative positioning to move a right-floated image 10px upwards.. Text wrapping around the image should go underneath it once it reaches the bottom of the image, yet it acts as if the image is still in it's original position and doesn't start wrapping until it's 10px below the bottom of the image. How can I work around this? TIA, Aaron
2
13935
by: Suzanne Boyle | last post by:
I have the following code in a webpage: <p><img src="images/clydesdale.gif" width="100" height="41" style="float: left;" /> <strong>Test</strong><br /> 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. <br /> visit website
9
2280
by: Fred | last post by:
Hello, I would like to dynamically add a text as a watermark on images. I managed to do that with aspsmartimage but as the watermark is added when the image is sent to the browser, it takes too much ressources on the server, due to a big number of images to diplay simultaneously. Is there a way or an other component to do that more efficiently. I can't add the watermark when uploading the file because it has to be
2
9264
by: zahirbar | last post by:
Hi, I have an image with a basically a big round circle (a photo). How do i make the text wrap around it fully? I use dreamweaver. Thanks
1
14181
by: maya | last post by:
hi, I have to do a page where there's a paragraph with an img on top left and the text in paragr has to wrap around the image.. pls see screen-shot here... http://www.mayacove.com/css/ss_page.jpg the image itself will be inserted dynamically via a CMS.. but NOT the border around it.. there are no. of ways to do the border, of course (div, table, etc..) problem is how do you make the text wrap around a table or a div?
3
5571
by: crazychrisy54 | last post by:
Hi there I just wondered if there is any way using GD to insert a clickable button or some clickable text into a image? It is possible to create images for buttons but what if you want a clickable button *inside* another image. I don't know if this is along the right lines but the following code puts a image inside another image. Perhaps I could then make im2 clickable or is it just not possible? Any help would be very much
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.