472,958 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Floating images among text

I've been wanting web pages that nicely embed images among text. The
way I typically do this at the moment is to sprinkle my IMGs through
the text as floats, alternating between float: left and float: right.
Mostly I test with IE 6 and Firefox 1. I'm having a hard time stopping
ugly empty gaps appearing in the text.

If I use clear: both then, if the browser window is too wide, the text
takes up less vertical space than the images, and I end up with ugly
vertical gaps in the text.

If I use clear: none then, if the browser window is too narrow, there
are still ugly vertical gaps in the text where floats are on the left
and the right and the browser decides there's insufficient horizontal
space in between them to render text too.

What would work well is if, whatever the browser width, floats would
come on each side of the page except if they leave no room to render
any of the text in between.

How do other people deal with this sort of situation? Really I just
want my images to float as far from the actual IMG as they need to to
allow some text to appear on each line. But, I find that my current
pages leave no vertical gaps in the text only within some range of
browser window widths.

-- Mark
Jul 21 '05 #1
3 3106
Mark Carroll <ma***@chiark.greenend.org.uk> wrote:
Really I just
want my images to float as far from the actual IMG as they need to to
allow some text to appear on each line. But, I find that my current
pages leave no vertical gaps in the text only within some range of
browser window widths.


You are not describing the problem clearly, post a url to an example.

--
Spartanicus
Jul 21 '05 #2
Mark Carroll wrote on 04 jan 2005 in
comp.infosystems.www.authoring.stylesheets:
I've been wanting web pages that nicely embed images among text. The
way I typically do this at the moment is to sprinkle my IMGs through
the text as floats, alternating between float: left and float: right.
Mostly I test with IE 6 and Firefox 1. I'm having a hard time stopping
ugly empty gaps appearing in the text.

If I use clear: both then, if the browser window is too wide, the text
takes up less vertical space than the images, and I end up with ugly
vertical gaps in the text.


Put the text and the floating imgs in a fixed width div:

<div style="width:600px;font.size:10pt;">
lot of text
<img style="float:left;width:200px;" src="..">
bit of text
<img style="float:right;width:200px;" src="..">
lot of text
</div>

However, people on this NG don't like fixed sizes.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 21 '05 #3

"Mark Carroll" <ma***@chiark.greenend.org.uk> wrote in message
news:9O*******@news.chiark.greenend.org.uk...
I've been wanting web pages that nicely embed images among text. The
way I typically do this at the moment is to sprinkle my IMGs through
the text as floats, alternating between float: left and float: right.
Mostly I test with IE 6 and Firefox 1. I'm having a hard time stopping
ugly empty gaps appearing in the text.

If I use clear: both then, if the browser window is too wide, the text
takes up less vertical space than the images, and I end up with ugly
vertical gaps in the text.

If I use clear: none then, if the browser window is too narrow, there
are still ugly vertical gaps in the text where floats are on the left
and the right and the browser decides there's insufficient horizontal
space in between them to render text too.


What I'm understanding you to want is to have images float nicely on
alternate sides, with the top of each image appear at a level that is, say,
3 ems lower than the bottom of the previous image, regardless of where that
happens to be with respect to the text. Then the text flows independently of
the location of the images, other than by not overlapping them. In other
words, the kind of layout sometimes seen in print media. Sorry, no way to do
that on the Web, at least not without hefty amounts of Javascript
determining image positions, setting their display property to "hidden" when
necessary, changing the float properties of the ones that remain visible to
maintain the alternating arrangement--and then running through the whole
computation all over again because now the layout of the page has been
thoroughly altered and more adjustments might be necessary. And even if all
this works, and the browser correctly positions everything in the end, it
won't work for people who have Javascript turned off, and you'd have to kick
off the process all over again if the user resizes his browser while your
page is being displayed. It would be a mess. I don't advise it, even if you
know how.

Jul 21 '05 #4

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

Similar topics

0
by: styler | last post by:
I am having difficulty with the page located here: http://tinyurl.com/2zwa9 I am creating a number of image sets (some left-, some right-aligned; an example of the right-aligned is shown the...
18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
1
by: Lee K. Seitz | last post by:
I created this page (http://home.hiwaay.net/~lkseitz/comics/newu/publishing.shtml; CSS at http://home.hiwaay.net/~lkseitz/comics/newu/newu.css) while looking at it in Firefox 1.05 (Win 9x) and it...
5
by: sp_mclaugh | last post by:
Hi. I've just recently switched to using CSS (rather than tables) to display collections of thumbnails. That way, depending on the user's screen resolution and browser window size, the number of...
4
by: JoJo | last post by:
I followed along in Jeremy Keith's book "DOM Scripting" on how to make a image viewer that changes on clicking links. It is up for demo at: http://jojowebdesign.com/dom1.html My question is...
1
by: cazconv2007 | last post by:
Hi under my floating images i cant get text under them why not? it goes to the side <!--navigation menu--> <div id = "mainnavigation"> <a href = "home.html">Home</a> |<a href = ...
2
by: yela | last post by:
I am working in a floting menu for a website, I found this cool script, it works great, but I need to limit the movement of the menu to a table area, right now it goes up and down through the whole...
6
by: Jeremy | last post by:
I've got a floating div which becomes visible when a link is clicked. I want the div to be hidden when the user clicks anywhere on the page except for whithin the div. What is the best way to do...
2
by: benwah1983 | last post by:
Greetings, Here is my problem: The following code shows a div with two small nested divs (images with a title), then the div is closed. Another one opens and a "random text" is displayed. <div...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.