473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

float text around image

Hi,
I can float the image left or right so the text will float around it, but
only if the top of the image is aligned with the start of the paragraph. I'd
like the image be a little below that, so the text appears above, left and
below the image. The text is a single paragraph.
Thanks for any help.

Steven
Jul 21 '05 #1
9 4981
steven wrote:
I can float the image left or right so the text will float around
it, but only if the top of the image is aligned with the start of
the paragraph. I'd like the image be a little below that, so the
text appears above, left and below the image. The text is a single
paragraph.


My solution is to place the image in a <span> that is inserted within
the paragraph text a few lines below the start of the text. Try this CSS:

..imgleft, .imgright {
font-size: 90%;
font-style: italic;
padding: 1em;
text-align: center;
}
..imgleft {
float: left;
}
..imgright {
float: right;
}

<p>
Here is a bunch of text ...
Here is a bunch of text ...
Here is a bunch of text ...
<span class="imgright">
<img ...> <br>A caption here
</span>
Here is a bunch of text ...
Here is a bunch of text ...
Here is a bunch of text ...
</p>

See an example at my site: http://www.freezeblock.com/
...the picture of the house. Since the page works for any browser
width, the amount of text above will vary with that width. Place the
<span> where you think it works best.

--
-bts
-This space intentionally left blank.
Jul 21 '05 #2
"Beauregard T. Shagnasty" <a.*********@example.invalid> wrote in message
news:32*************@individual.net...
steven wrote:
I can float the image left or right so the text will float around
it, but only if the top of the image is aligned with the start of
the paragraph. I'd like the image be a little below that, so the
text appears above, left and below the image. The text is a single
paragraph.


My solution is to place the image in a <span> that is inserted within
the paragraph text a few lines below the start of the text. Try this CSS:

.imgleft, .imgright {
font-size: 90%;
font-style: italic;
padding: 1em;
text-align: center;
}
.imgleft {
float: left;
}
.imgright {
float: right;
}

<p>
Here is a bunch of text ...
Here is a bunch of text ...
Here is a bunch of text ...
<span class="imgright">
<img ...> <br>A caption here
</span>
Here is a bunch of text ...
Here is a bunch of text ...
Here is a bunch of text ...
</p>


Good idea! Thanks.
Steven
Jul 21 '05 #3
Beauregard T. Shagnasty wrote:
My solution is to place the image in a <span> that is inserted within
the paragraph text a few lines below the start of the text.


The trouble with that approach is that you have to be careful with your alt
text and caption, otherwise you end up with something like this:

Traditional gutters are prone to blockage, especially in winter when
ice jams push water back up under the roofing material and damage
fascia boards and A house suffering from an ice dam
House with ice dam interior walls. In warmer climates, heavy rains and
blocked gutters cause the same problems.

.... which is nonsensical.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #4
David Dorward wrote:
... which is nonsensical.


I agree. <g> Have you a better solution?

--
-bts
-This space intentionally left blank.
Jul 21 '05 #5
Beauregard T. Shagnasty wrote:
David Dorward wrote:
... which is nonsensical.
I agree. <g> Have you a better solution?


Don't use a caption and have sane (null) alt text. You still get an ugly
effect in graphical browsers without CSS, but its better then nothing. (The
other option is to forget about trying to achieve that effect and live with
the top of the image being parallel to the beginning of the paragraph).

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #6
On Sat, 18 Dec 2004, Beauregard T. Shagnasty wrote:
David Dorward wrote:
... which is nonsensical.


I agree. <g> Have you a better solution?


Provide any additional detail about the image by means of the
attribute that's meant for it, namely title= (just how the reader gets
their hands on that is a client-specific issue: I won't say it's by
any means ideal, but at least, as a document author, you'd be doing
the right thing).

Use the alt(ernative text) for providing a genuine textual alternative
for the image's purpose, whatever it might be. In this case, that
genuine alternative might be alt="".

But if you need the image to be an anchor link, then maybe you could
adapt this principle (from my now somewhat outdated example):

http://ppewww.ph.gla.ac.uk/~flavell/alt/floater.html

Jul 21 '05 #7
David Dorward wrote:
Beauregard T. Shagnasty wrote:
David Dorward wrote:
... which is nonsensical.

I agree. <g> Have you a better solution?


Don't use a caption and have sane (null) alt text. You still get an
ugly effect in graphical browsers without CSS, but its better then
nothing. (The other option is to forget about trying to achieve
that effect and live with the top of the image being parallel to
the beginning of the paragraph).


I'll consider the null alt text. My client, however, would not like me
to remove the captions, so there would still be a nonsensical
paragraph in a text browser. I'll ask him, though.

--
-bts
-This space intentionally left blank.
Jul 21 '05 #8
Beauregard T. Shagnasty wrote:
I'll consider the null alt text. My client, however, would not like me
to remove the captions, so there would still be a nonsensical
paragraph in a text browser.


Or a graphical browser with a screen reader ...
.... or a search engine indexing robot.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #9
David Dorward wrote:
Beauregard T. Shagnasty wrote:
I'll consider the null alt text. My client, however, would not
like me to remove the captions, so there would still be a
nonsensical paragraph in a text browser.


Or a graphical browser with a screen reader ... ... or a search
engine indexing robot.


Perhaps I could surround the caption with something like this:

<span style="cap">[Caption: </span>A house with ice dam<span
style="cap"> ]</span>

..cap { display: none }

--
-bts
-This space intentionally left blank.
Jul 21 '05 #10

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

Similar topics

2
by: Gustav Medler | last post by:
Css only offers float:right; and float:left; Is it possible, to center an image, floated around by text? Cross browser funcionality is needed for NS4.7, IE 5.x, Op 6.x, Moz 1.x, Konqu 3.x. I...
1
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...
4
by: Florian Brucker | last post by:
Hi! I've got a problem with float & clear. Take this example code: <div style=" width:100px; height:100px; background-color:#FF0000; float:left; margin:10px;"></div> <span...
2
by: mike | last post by:
Hello, What I would like is to float some text around the image where the text starts align on the left or right of the image aligned to the top of the image and then wrap around the image. I have...
0
by: Paul E Collins | last post by:
Hello. I want to display a number of individual blocks of text. Each block has an associated image, which should be displayed on the right and aligned with the top of its block of text, i.e....
9
panachepad
by: panachepad | last post by:
I arrived here from a websearch that found this thread from your archives: http://www.thescripts.com/forum/thread97805.html It helped me to understand that I am on the right track, but I still have...
8
by: DarkSaturn | last post by:
Is there a method of using the CSS float command on images to contain itself within a single paragraph? The problem I'm running into is trying to use float images on a listing page, I have an...
6
by: battle.chris | last post by:
Hi all. Any advice appreciated - I'm floating an image right and the text to the left of the image is being forced down about 5px from the top of the containing area. You can see the issue...
27
by: GloStix | last post by:
WARNING VIDEO TAKES A WHILE TO LOAD http://screencast.com/t/BWQ6DNtsM I really don't know how to fix this other than putting another div. But I dont' exactly want to do that for every page....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.