Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Inline image and block text

Reply
Thread Tools

Inline image and block text

 
 
Rob
Guest
Posts: n/a
 
      02-24-2007
Hi all,

I've been attempting in vain for several days to do something that
should be very simple: display a small image with text adjacent to it,
but NOT wrapped underneath it. Here's a crude ASCII-art example of
what I'm attempting to do:
__
|__| Here is a bunch of text that
wraps, but not underneath
the image at its left. I'd also
like to make sure the image
is centered (absmiddle) with
the first line of this text.

Anyone have a clue how to do this?

 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      02-24-2007
Rob wrote:
> Hi all,
>
> I've been attempting in vain for several days to do something that
> should be very simple: display a small image with text adjacent to it,
> but NOT wrapped underneath it. Here's a crude ASCII-art example of
> what I'm attempting to do:
> __
> |__| Here is a bunch of text that
> wraps, but not underneath
> the image at its left. I'd also
> like to make sure the image
> is centered (absmiddle) with
> the first line of this text.
>
> Anyone have a clue how to do this?
>




Yeah, wrap image and text in DIV, float the image and set left margin of
text = "width of image + margin" in this example 300 pixels.

STYLE:
/*
want to clear floats do each image-text unit stays separate
if IMG height > text, padding will adds space for following units
*/
DIV.pixbox { clear: both; padding: .5em; }

/*
float IMG and clear any margins & padding - browser consistency
*/
DIV.pixbox IMG { display: block; float: left; margin: 0; padding: 0; }

/*
set margin of P so left is IMG.width + desired.margin, also set bottom
margin to allow more than one paragraph per 'image-text' unit
*/
DIV.pixbox P { margin: 0 0 1.5em 310px; padding: 0; }



HTML:

<div class="pixbox">
<img src="some.jpg" width="300" height="250" alt="my image">
<p>
Whatever your want to write about your picture ...
</p>
<-- add more paragraphs if needed -->
</div>

<-- Next image-text unit -->
<div class="pixbox">
<img src="someother.jpg"...


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple functions (one version being inline and other beingnon-inline) Rahul C++ 3 02-28-2008 03:28 PM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
about extern inline and static inline Sean C++ 4 04-30-2006 03:18 PM
inline or not to inline in C++ Abhi C++ 2 07-03-2003 12:07 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57