PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.info.authoring.CSS > images and text
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
images and text

Réponse
 
LinkBack Outils de la discussion
Vieux 31/03/2008, 13h06   #1 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut images and text

I'm rewriting some of my CMS code.

It's very common to have a block of text with an image.

This can be done this way:

<p><img...>enough text to flow past the image...
</p>

or this way:

<div>
<img ...>
<p>enough text to flow past the image...</p>
</div>

Now, if we set widths and float the image either left or right, they
will appear identical. I suppose you could also set image align
properties, although I seldom use most of the alignments for this.

Method two allows for a no text wrap, perhaps that's useful.

Any thoughts on handling images?

Jeff
  Réponse avec citation
Vieux 31/03/2008, 14h55   #2 (permalink)
Nick Theodorakis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

On Mar 31, 8:06am, Jeff <jeff@spam_me_not.com> wrote:
> I'm rewriting some of my CMS code.
>
> It's very common to have a block of text with an image.
>
> This can be done this way:
>
> <p><img...>enough text to flow past the image...
> </p>
>
> or this way:
>
> <div>
> <img ...>
> <p>enough text to flow past the image...</p>
> </div>
>
> Now, if we set widths and float the image either left or right, they
> will appear identical. I suppose you could also set image align
> properties, although I seldom use most of the alignments for this.
>
> Method two allows for a no text wrap, perhaps that's useful.
>
> Any thoughts on handling images?
>


ISTM that it depends on the logical relationship between the text and
the image. Is the text a caption? Or is the image just tangentially
related to the text? Could the image be logically considered part of
the paragraph?

Nick

--
Nick Theodorakis
nick_theodorakis@hotmail.com
contact form:
http://theodorakis.net/contact.html


  Réponse avec citation
Vieux 31/03/2008, 15h40   #3 (permalink)
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

On 2008-03-31, Jeff <jeff@spam_me_not.com> wrote:
> I'm rewriting some of my CMS code.
>
> It's very common to have a block of text with an image.
>
> This can be done this way:
>
><p><img...>enough text to flow past the image...
></p>
>
> or this way:
>
><div>
><img ...>
><p>enough text to flow past the image...</p>
></div>
>
> Now, if we set widths and float the image either left or right, they
> will appear identical. I suppose you could also set image align
> properties, although I seldom use most of the alignments for this.


They're deprecated and browsers just turn them into float anyway.

> Method two allows for a no text wrap, perhaps that's useful.
>
> Any thoughts on handling images?


I prefer the first of your two examples. The second example is a bit
counterintuitive because the position of the float may depend on the top
margin of the <p> depending on whether that top margin collapses with
the top margin of the element containing the float.

In other words, if the <div> has no top border or padding:

<div>
<img>
<p>
</div>

looks the same as

<div>
<p>
<img>
</div>

But give the div top border or padding and in the first case the top of
the img moves up. I'm assuming <p> has some top margin.

This is also tricky enough that I'm sure some browsers get it wrong.

Presumably you want the float aligned with the top of the <p> and the
second approach guarantees that.
  Réponse avec citation
Vieux 01/04/2008, 00h26   #4 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

Ben C wrote:
> On 2008-03-31, Jeff <jeff@spam_me_not.com> wrote:
>> I'm rewriting some of my CMS code.
>>
>> It's very common to have a block of text with an image.
>>
>> This can be done this way:
>>
>> <p><img...>enough text to flow past the image...
>> </p>
>>
>> or this way:
>>
>> <div>
>> <img ...>
>> <p>enough text to flow past the image...</p>
>> </div>
>>
>> Now, if we set widths and float the image either left or right, they
>> will appear identical. I suppose you could also set image align
>> properties, although I seldom use most of the alignments for this.

>
> They're deprecated and browsers just turn them into float anyway.
>
>> Method two allows for a no text wrap, perhaps that's useful.
>>
>> Any thoughts on handling images?

>
> I prefer the first of your two examples. The second example is a bit
> counterintuitive because the position of the float may depend on the top
> margin of the <p> depending on whether that top margin collapses with
> the top margin of the element containing the float.
>
> In other words, if the <div> has no top border or padding:
>
> <div>
> <img>
> <p>
> </div>
>
> looks the same as
>
> <div>
> <p>
> <img>
> </div>
>
> But give the div top border or padding and in the first case the top of
> the img moves up. I'm assuming <p> has some top margin.
>

That's an interesting point. IE6 and Moz 2.0 don't, but Safari 3.04 does.

> This is also tricky enough that I'm sure some browsers get it wrong.
>
> Presumably you want the float aligned with the top of the <p> and the
> second approach guarantees that.


Safari (windows) completely screws up the first example. It starts
the paragraph at the bottom of the image. I did not expect that.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">

<div style="border: 1px solid black;width: 300px">
<p style="width: 300px"><img style="border:1px solid black"
src="some_image.jpg" style="float: left">Soil Enhancer Samples are
packaged in 1/2 cubic foot containers. They are designed to enhance
potting soils for container gardens, flowers beds and hanging baskets.
Try your sample .</p>
</div>

Dorayme, you don't get that on your Mac do you? You get the text
starting at the top of the image rather than the bottom?

I wonder how popular Safari windows is? I'm thinking it has some issues...

Ultimately what I want is to to style the image, top, left, right, ???
with just CSS and not changing the html. I've been experimenting with a
standard module format for blocks of html that also lets you add curved
borders, drop shadows, corner effects.

I'm not sure there is really any meaning behind a div aside from what
you give it. And that structure is largely for your own purposes, such
as designating a div with an id="navigation". I don't think search
engines care and I don't know if aural browsers.

Jeff
  Réponse avec citation
Vieux 01/04/2008, 04h11   #5 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

dorayme wrote:
> In article <JsmdnaO3IfCp7mzanZ2dnUVZ_qCunZ2d@earthlink.com> ,
> Jeff <jeff@spam_me_not.com> wrote:
>
>> Safari (windows) completely screws up the first example. It starts
>> the paragraph at the bottom of the image. I did not expect that.
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
>> "http://www.w3.org/TR/REC-html40/strict.dtd">
>>
>> <div style="border: 1px solid black;width: 300px">
>> <p style="width: 300px"><img style="border:1px solid black"
>> src="some_image.jpg" style="float: left">Soil Enhancer Samples are
>> packaged in 1/2 cubic foot containers. They are designed to enhance
>> potting soils for container gardens, flowers beds and hanging baskets.
>> Try your sample .</p>
>> </div>
>>
>> Dorayme, you don't get that on your Mac do you? You get the text
>> starting at the top of the image rather than the bottom?

>
> You must distinguish between an inline image and one that is floated.
> See what happens when you change your
>
> img style="border:1px solid black;" ...
>
> to
>
> img style="border:1px solid black;float left" ...


You are right, my error. If you look at what I wrote, I had *two* style
tags and had the float in the second. Safari ignores the second. I had
made the same mistake earlier, and hadn't cleared it up. So much for a
quick test with inline style...

Jeff
>
> I am pretty sure I had examples of the different effects in
>
> <http://netweaver.com.au/floatHouse/>
>
> I think on page 2.
>
> You might see that some of your puzzles over Safari disappear when you
> make this distinction.
>

  Réponse avec citation
Vieux 01/04/2008, 05h17   #6 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

dorayme wrote:
> In article <dPudneicsZNDOmzanZ2dnUVZ_saknZ2d@earthlink.com> ,
> Jeff <jeff@spam_me_not.com> wrote:
>
>> dorayme wrote:
>>> In article <JsmdnaO3IfCp7mzanZ2dnUVZ_qCunZ2d@earthlink.com> ,
>>> Jeff <jeff@spam_me_not.com> wrote:
>>>
>>>> Safari (windows) completely screws up the first example. It starts
>>>> the paragraph at the bottom of the image. I did not expect that.
>>>>
>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
>>>> "http://www.w3.org/TR/REC-html40/strict.dtd">
>>>>
>>>> <div style="border: 1px solid black;width: 300px">
>>>> <p style="width: 300px"><img style="border:1px solid black"
>>>> src="some_image.jpg" style="float: left">Soil Enhancer Samples are
>>>> packaged in 1/2 cubic foot containers. They are designed to enhance
>>>> potting soils for container gardens, flowers beds and hanging baskets.
>>>> Try your sample .</p>
>>>> </div>
>>>>
>>>> Dorayme, you don't get that on your Mac do you? You get the text
>>>> starting at the top of the image rather than the bottom?
>>> You must distinguish between an inline image and one that is floated.
>>> See what happens when you change your
>>>
>>> img style="border:1px solid black;" ...
>>>
>>> to
>>>
>>> img style="border:1px solid black;float left" ...

>> You are right, my error. If you look at what I wrote, I had *two* style
>> tags and had the float in the second. Safari ignores the second. I had
>> made the same mistake earlier, and hadn't cleared it up. So much for a
>> quick test with inline style...

>
>
> If you supply a url of anything you want testing on a Mac on Safari 2, I
> can you. I think you were saying some floated style was buggered up
> in Safari?


Thanks,

But here is what I wrote:

<img style="border:1px solid black" src="some_image.jpg" style="float:
left">
^^^ style tag one^^^^^ ^^^ style two ^^

It's easy to miss! Still dumb on my part though!

Jeff
>

  Réponse avec citation
Vieux 01/04/2008, 08h45   #7 (permalink)
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

On 2008-03-31, Jeff <jeff@spam_me_not.com> wrote:
> Ben C wrote:

[...]
>> I prefer the first of your two examples. The second example is a bit
>> counterintuitive because the position of the float may depend on the top
>> margin of the <p> depending on whether that top margin collapses with
>> the top margin of the element containing the float.
>>
>> In other words, if the <div> has no top border or padding:
>>
>> <div>
>> <img>
>> <p>
>> </div>
>>
>> looks the same as
>>
>> <div>
>> <p>
>> <img>
>> </div>
>>
>> But give the div top border or padding and in the first case the top of
>> the img moves up. I'm assuming <p> has some top margin.
>>

> That's an interesting point. IE6 and Moz 2.0 don't, but Safari 3.04 does.


I was sure someone would get it wrong

>> This is also tricky enough that I'm sure some browsers get it wrong.
>>
>> Presumably you want the float aligned with the top of the <p> and the
>> second approach guarantees that.

>
> Safari (windows) completely screws up the first example. It starts
> the paragraph at the bottom of the image. I did not expect that.
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
> "http://www.w3.org/TR/REC-html40/strict.dtd">
>
><div style="border: 1px solid black;width: 300px">
><p style="width: 300px"><img style="border:1px solid black"
> src="some_image.jpg" style="float: left">Soil Enhancer Samples are
> packaged in 1/2 cubic foot containers. They are designed to enhance
> potting soils for container gardens, flowers beds and hanging baskets.
> Try your sample .</p>
></div>


The problem there may be because you've given the img two style
attributes. Move float: left into the first one.

[...]
  Réponse avec citation
Vieux 01/04/2008, 18h01   #8 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: images and text

Ben C wrote:
> On 2008-03-31, Jeff <jeff@spam_me_not.com> wrote:
>> Ben C wrote:

> [...]
>>> I prefer the first of your two examples. The second example is a bit
>>> counterintuitive because the position of the float may depend on the top
>>> margin of the <p> depending on whether that top margin collapses with
>>> the top margin of the element containing the float.
>>>
>>> In other words, if the <div> has no top border or padding:
>>>
>>> <div>
>>> <img>
>>> <p>
>>> </div>
>>>
>>> looks the same as
>>>
>>> <div>
>>> <p>
>>> <img>
>>> </div>
>>>
>>> But give the div top border or padding and in the first case the top of
>>> the img moves up. I'm assuming <p> has some top margin.
>>>

>> That's an interesting point. IE6 and Moz 2.0 don't, but Safari 3.04 does.

>
> I was sure someone would get it wrong


Safari only behaves differently than IE and Firefox on container margins
for paragraphs. All other p margins are identical and require both
margins to be zero. It almost seems like Safari is right in this in
always having a top p margin, but it is in convenient. I guess this
style: div p{margin-top: 0} equalizes them and might be something to
include in all stylesheets. Did not check Mac or Opera.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">

<style type="text/css">
h2,p,div{border: 1px solid black}
#no_top_margin_on_p p{margin-top: 0}
#no_bottom_margin_on_p p{margin-bottom: 0}
#no_margin_on_p p{margin: 0}}
</style>
<p>paragraph</p>
<h2>Normal</h2>
<p>paragraph</p>
<p>paragraph</p>
<div>div</div>
<p>paragraph</p>

<div id="no_top_margin_on_p">
<p>paragraph</p>
<h2>No Top Margin on P</h2>
<p>paragraph</p>
<p>paragraph</p>
<div>div</div>
<p>paragraph</p>
</div>

</div>

<div id="no_bottom_margin_on_p">
<p>paragraph</p>
<h2>No Bottom Margin on P</h2>
<p>paragraph</p>
<p>paragraph</p>
<div>div</div>
<p>paragraph</p>

</div>

<div id="no_margin_on_p">
<p>paragraph</p>
<h2>No Margin on P</h2>
<p>paragraph</p>
<p>paragraph</p>
<div>div</div>
<p>paragraph</p>

</div>





>
>>> This is also tricky enough that I'm sure some browsers get it wrong.
>>>
>>> Presumably you want the float aligned with the top of the <p> and the
>>> second approach guarantees that.

>> Safari (windows) completely screws up the first example. It starts
>> the paragraph at the bottom of the image. I did not expect that.
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
>> "http://www.w3.org/TR/REC-html40/strict.dtd">
>>
>> <div style="border: 1px solid black;width: 300px">
>> <p style="width: 300px"><img style="border:1px solid black"
>> src="some_image.jpg" style="float: left">Soil Enhancer Samples are
>> packaged in 1/2 cubic foot containers. They are designed to enhance
>> potting soils for container gardens, flowers beds and hanging baskets.
>> Try your sample .</p>
>> </div>

>
> The problem there may be because you've given the img two style
> attributes. Move float: left into the first one.


Absolutely. Sorry for the error.

Jeff
>
> [...]

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h06.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,19676 seconds with 16 queries