By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,487 Members | 1,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,487 IT Pros & Developers. It's quick & easy.

Source of quotation in same line?

P: n/a
This seems simple, but I've been unable to figure out how to do it.

I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line, automatically according to the user's font and window
width:

blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blh blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah h blah blah blah blah blah blah blah
blah blah blah blah blah -- Socrates

blah blah blah blah blah blah blah
ah blah blah blah blah blah blah blah
lah blah blah blah blah blah blah
blah blah blah blah blah blah blah
ah blah blah blah blah blah bla
-- Socrates

Is there a way?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #1
Share this Question
Share on Google+
17 Replies


P: n/a
Stan Brown wrote:

I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line


[examples snipped]

This seems like a job for display: run-in (assuming I understand it).
Unfortunately, I know of no browser which supports run-in. :(

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #2

P: n/a
In article Stan Brown wrote:
This seems simple, but I've been unable to figure out how to do it.

I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line, automatically according to the user's font and window
width:

blah blah blah blah blah blah h blah blah blah blah blah blah blah
blah blah blah blah blah -- Socrates

blah blah blah blah blah blah blah
ah blah blah blah blah blah bla
-- Socrates

Is there a way?


<blockquote>dnslkfnrlkwngrelk eskljrgn sekl ngeskljrng ek
<cite style="float:right;">--Foo Bar</cite>
</blockquote>

Or do you use some other markup? Can't figure out how you didn't get it
otherwise... Works in most browsers, even if it's CSS2.1 really. (no
width on float.)


--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #3

P: n/a
In article Brian wrote:
Stan Brown wrote:

I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line


[examples snipped]

This seems like a job for display: run-in (assuming I understand it).
Unfortunately, I know of no browser which supports run-in. :(


Opera does at least since v. 6. Run-in is not right tool for this at all.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #4

P: n/a
Lauri Raittila wrote:
In article Stan Brown wrote:
I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line, automatically according to the user's font and window
width:

blah blah blah blah blah blah h blah blah blah blah blah blah blah
blah blah blah blah blah -- Socrates

blah blah blah blah blah blah blah
ah blah blah blah blah blah bla
-- Socrates
<blockquote>dnslkfnrlkwngrelk eskljrgn sekl ngeskljrng ek
<cite style="float:right;">--Foo Bar</cite>
</blockquote>


I thought of this. It works in Opera, but not in Mozilla. I think
Opera is wrong: Floating the cite should make it block level. The
block box is then created below the blockquote element.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #5

P: n/a
Lauri Raittila wrote:
In article Brian wrote:
Stan Brown wrote:
I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line
[examples snipped]

This seems like a job for display: run-in (assuming I understand it).
Unfortunately, I know of no browser which supports run-in. :(


Opera does at least since v. 6.


I thought I had tested this in Opera. I just (re?)tested now. My bad.
Opera does support display: run-in.
Run-in is not right tool for this at all.


If Mozilla supported it, it would be right. Instead, only Opera
supports run-in, but Opera does what OP wants without run-in, which I
think is wrong.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #6

P: n/a
In article Brian wrote:
Lauri Raittila wrote:
In article Brian wrote:
Stan Brown wrote:

I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line This seems like a job for display: run-in (assuming I understand it).
Unfortunately, I know of no browser which supports run-in. :(


Opera does at least since v. 6.


I thought I had tested this in Opera. I just (re?)tested now. My bad.
Opera does support display: run-in.
Run-in is not right tool for this at all.


If Mozilla supported it, it would be right. Instead, only Opera
supports run-in, but Opera does what OP wants without run-in, which I
think is wrong.


How do you think run-in would work here? I really can't understand.
http://www.w3.org/TR/CSS2/visuren.html#run-in
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #7

P: n/a
In article Brian wrote:
Lauri Raittila wrote:
In article Stan Brown wrote:
I have a quotation in a paragraph of (let's assume) more than one
line. I want to put the speaker's name at the end of the last line
of the paragraph if there's room, otherwise at the right edge of a
new line, automatically according to the user's font and window
width:

blah blah blah blah blah blah h blah blah blah blah blah blah blah
blah blah blah blah blah -- Socrates

blah blah blah blah blah blah blah
ah blah blah blah blah blah bla
-- Socrates
<blockquote>dnslkfnrlkwngrelk eskljrgn sekl ngeskljrng ek
<cite style="float:right;">--Foo Bar</cite>
</blockquote>


I thought of this. It works in Opera, but not in Mozilla. I think
Opera is wrong: Floating the cite should make it block level.


You are mistaken. Weather or not float is block element makes absolutely
no difference.
The block box is then created below the blockquote element.


No, it is created and aligned to top of next line box, as you can easily
test.

http://www.w3.org/TR/CSS2/visuren.html#floats
| A float is a box that is shifted to the left or right on the current
| line.

| The top of the floated box is aligned with the top of the current line
| box (or bottom of the preceding block box if no line box exists).

And all examples support these.

It is bug in Mozilla. There is no doubt of it.
This example is directly from CSS2 and CSS2.1, and is displayed
incorrectly in Mozilla:
http://www.student.oulu.fi/~laurirai...t/test023.html
Compare with this:
http://www.w3.org/TR/CSS2/visuren.html#img-floateg
(only image and rest of meaningless text is different.)

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #8

P: n/a
It seems "Lauri Raittila" wrote in
comp.infosystems.www.authoring.stylesheets:
<blockquote>dnslkfnrlkwngrelk eskljrgn sekl ngeskljrng ek
<cite style="float:right;">--Foo Bar</cite>
</blockquote>

Or do you use some other markup? Can't figure out how you didn't get it
otherwise... Works in most browsers, even if it's CSS2.1 really. (no
width on float.)
Here's exactly what I tried, similar to yours except <p> and <spam>
not <blockquote> and <cite>:
<p class="brk">"Always bear in mind that your own resolution
to succeed, is more important than any other one thing."
<span style="float:right">—Abraham&nbsp;Lincoln,&nbsp;No v.&nbsp;5,&nbsp;
1855</span></p>


The "--Lincoln" came out at the right edge of a new line, even when
there was plenty of room on the last line of the quote. The same
happened when I tried it your way, with "<blockquote>" and "<cite>".

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #9

P: n/a
It seems "Brian" wrote in
comp.infosystems.www.authoring.stylesheets:
I thought of this. It works in Opera, but not in Mozilla. I think
Opera is wrong: Floating the cite should make it block level. The
block box is then created below the blockquote element.


Yes, that's how the spec looked to me too, and as you say, that's
how Mozilla (1.4) works.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #10

P: n/a
"Stan Brown"
| Here's exactly what I tried, similar to yours except <p> and
<spam>

Yum yum. P's and spam.

| not <blockquote> and <cite>:

No, that doesn't sound neally as appetizing..

[ Sorry Stan, couldn't resist ;-) ]

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #11

P: n/a
Lauri Raittila wrote:
In article Brian wrote:
I thought of this. It works in Opera, but not in Mozilla. I think
Opera is wrong: Floating the cite should make it block level.
You are mistaken. Weather or not float is block element makes
absolutely no difference.


Right. But the point I was making is that if it is inline, but
floated, than the browser is supposed to treat that element as if it
were block. At least, that's how I interpret the spec.
The block box is then created below the blockquote element.


No, it is created and aligned to top of next line box, as you can
easily test.


I did test. Only Opera put the cite inside the blockquote box. Mozilla
and MSIE 5.01/Win2k did not.

http://www.tsmchughs.com/test/quote
http://www.w3.org/TR/CSS2/visuren.html#floats
'float'

left
The element generates a block box that is floated to the left. Content
flows on the right side of the box, starting at the top (subject to
the 'clear' property). The 'display' is ignored, unless it has the
value 'none'.

Note the "generates a block box" bit.
| A float is a box that is shifted to the left or right on the
current | line.
Hm. That *does* support your argument that Opera is correct.
| The top of the floated box is aligned with the top of the current
| line box (or bottom of the preceding block box if no line box
| exists).
But this part is not so clear. If float makes it block, then floating
<cite> will push it to the bottom of <blockquote>, which is what I see
in Moz and MSIE.
It is bug in Mozilla. There is no doubt of it. This example is
directly from CSS2 and CSS2.1, and is displayed incorrectly in
Mozilla: http://www.student.oulu.fi/~laurirai...t/test023.html
This looks different than what I see because the order of the elements
is different. If you put that image at the end of the <P> element,
than in Moz and MSIE, the image will float *below* the <P>, not inside it.
Compare with this:
http://www.w3.org/TR/CSS2/visuren.html#img-floateg (only image and
rest of meaningless text is different.)


There, too, the order of the elements is different.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #12

P: n/a
Lauri Raittila wrote:
Stan Brown wrote:

> I have a quotation in a paragraph of (let's assume) more
> than one line. I want to put the speaker's name at the end
> of the last line of the paragraph if there's room,
> otherwise at the right edge of a new line

How do you think run-in would work here?


Well, it works only part way: the citation is on the correct line, but
it is not aligned right as op wanted. So it is not a great solution.
http://www.w3.org/TR/CSS2/visuren.html#run-in


|A run-in box behaves as follows:

| If a block box (that does not float and is not absolutely
| positioned) follows the run-in box, the run-in box becomes
| the first inline box of the block box.

The <cite> in our example is floated. If a float makes something block
level, than the <p> could be run-in; the <cite> (now block level) is
the block box that follows the run-in. The <p> becomes the first box
in the <cite>'s box. In other words, the <p> and <cite> would share
the same block. But the alignment is not as op wanted, so, in the end,
no, run-in would not work. I had forgotten that part of it.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #13

P: n/a
In article Brian wrote:
Lauri Raittila wrote:
In article Brian wrote:
I thought of this. It works in Opera, but not in Mozilla. I think
Opera is wrong: Floating the cite should make it block level.
You are mistaken. Weather or not float is block element makes
absolutely no difference.


Right. But the point I was making is that if it is inline, but
floated, than the browser is supposed to treat that element as if it
were block. At least, that's how I interpret the spec.


Yes. But float is taken away from flow, and does onle affect to line
boxes.
The block box is then created below the blockquote element.


No, it is created and aligned to top of next line box, as you can
easily test.


I did test. Only Opera put the cite inside the blockquote box. Mozilla
and MSIE 5.01/Win2k did not.


It's bot inside the box in any really, as it is floated... The question
is not that. Put height:8em;border:1px soid red; for blockquote. How do
you know it is inside? Put border for it in Opera. Is it really inside?
http://www.tsmchughs.com/test/quote


Try in window sized so that quote is dropped one line in Opera. Is it
inside box?
http://www.w3.org/TR/CSS2/visuren.html#floats


'float'

left
The element generates a block box that is floated to the left. Content
flows on the right side of the box, starting at the top (subject to
the 'clear' property). The 'display' is ignored, unless it has the
value 'none'.

Note the "generates a block box" bit.


That is because how else could you give it a width?

Read this (same origin):
A floated box must have an explicit width (assigned via the 'width'
property, or its intrinsic width in the case of replaced elements). Any
floated box becomes a block box that is shifted to the left or right
until its outer edge touches the containing block edge or the outer edge
of another float. The top of the floated box is aligned with the top of
the current line box (or bottom of the preceding block box if no line box
exists). If there isn't enough horizontal room on the current line for
the float, it is shifted downward, line by line, until a line has room
for it.

And this: http://www.w3.org/TR/CSS2/visuren.html#float-rules

Are you still thinking same?
| A float is a box that is shifted to the left or right on the
| current line.


Hm. That *does* support your argument that Opera is correct.

| The top of the floated box is aligned with the top of the current
| line box (or bottom of the preceding block box if no line box
| exists).


But this part is not so clear. If float makes it block, then floating
<cite> will push it to the bottom of <blockquote>, which is what I see
in Moz and MSIE.


Float should not have effect on flow. There is current line-box, if float
would be on same line.
It is bug in Mozilla. There is no doubt of it. This example is
directly from CSS2 and CSS2.1, and is displayed incorrectly in
Mozilla: http://www.student.oulu.fi/~laurirai...t/test023.html


This looks different than what I see because the order of the elements
is different. If you put that image at the end of the <P> element,
than in Moz and MSIE, the image will float *below* the <P>, not inside it.


It proves there is bug in Mozilla. Because I *thought* you would be able
compare examples. I did this only because I know how hard it is to
somepeople believe that mozilla has bug.
I actually even bothered looking bugzilla, and found this:
http://bugzilla.mozilla.org/show_bug.cgi?id=50630
Maybe you believe D. Baron and Hixie better than me.
Compare with this:
http://www.w3.org/TR/CSS2/visuren.html#img-floateg (only image and
rest of meaningless text is different.)


There, too, the order of the elements is different.


Yes, but meaning is same.

http://www.w3.org/TR/CSS2/visuren.html#img-floateg
| Formatting would have been exactly the same if the document had been:

<BODY>
<P>Some sample text
<IMG src=img.gif alt="This image will illustrate
floats">
that has no other...
</BODY>

Compare it to this:
http://www.student.oulu.fi/~laurirai...t/test023.html

<BODY>
<P>Some sample text
<IMG src="../css/middle/blue.gif" alt="This image will
illustrate floats">
that has no other...
</BODY>

Can you spot one difference?
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #14

P: n/a
In article Stan Brown wrote:
It seems "Lauri Raittila" wrote in
comp.infosystems.www.authoring.stylesheets:
<blockquote>dnslkfnrlkwngrelk eskljrgn sekl ngeskljrng ek
<cite style="float:right;">--Foo Bar</cite>
</blockquote>

Or do you use some other markup?
Meaned something like
<blockquote>gnejks rjegsjhr sekjghre</blockquote>
<cite>-Mr Foo Bar</cite>
Can't figure out how you didn't get it
otherwise... Works in most browsers, even if it's CSS2.1 really. (no
width on float.)

I see I was mistaken in my believe it works in most browsers. I should
have said that it widthless float works in most browsers. Sorry.
The "--Lincoln" came out at the right edge of a new line, even when
there was plenty of room on the last line of the quote. The same
happened when I tried it your way, with "<blockquote>" and "<cite>".


There is other way, using absolute positioning, but it is not really any
better supported:
http://www.student.oulu.fi/~laurirai...t/test024.html

Issues:
1. It needs width of cite

Only in Mozilla 1.0:
2. padding-right for inline positioning aplied for every line
(workaround possible, I think)
3. absolute positioning is positioned on wrong line, IIANM.

Only in Opera 7:
4. Sometimes absolutely position is positioned to second last line.
(workaround possible, I think)

So if 3. is fixed in later mozilla builds, it might be better.

I can't think any other way.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #15

P: n/a
Lauri Raittila wrote:
In article Brian wrote:
http://www.tsmchughs.com/test/quote
Try in window sized so that quote is dropped one line in Opera. Is
it inside box?


After *slowly* changing the window size, I see what you mean.
Sometimes it is outside of border.
The top of the floated box is aligned with the top of the current
line box (or bottom of the preceding block box if no line box
exists). If there isn't enough horizontal room on the current line
for the float, it is shifted downward, line by line, until a line
has room for it.
That's quite clear and unequivecal.
Are you still thinking same?
No. Unfortunately for op, this means that the correct solution only
works in Opera.
It proves there is bug in Mozilla. Because I *thought* you would be
able compare examples.
I *did* compare examples. But I misunderstood the spec.
I did this only because I know how hard it is to somepeople believe
that mozilla has bug.
In my defense, I did, only yesterday, point out a bug in Moz with
:first-line and :hover.
I actually even bothered looking bugzilla, and found this:
http://bugzilla.mozilla.org/show_bug.cgi?id=50630 Maybe you believe
D. Baron and Hixie better than me.


I believe you, I believe you! You seem a bit defensive about this. ;-)

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #16

P: n/a
Without intending to close off discussion (as though I could!) I'd
like to thank those who responded.

Right now I've just got the speaker's name with a padding-left of
2em, though I may unstyle it entirely. It looks dreadful if I have
two quotes in succession.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #17

P: n/a
Brian <us*****@julietremblay.com.invalid-remove-this-part> wrote in
news:1EVOb.100261$8H.145743@attbi_s03:
I thought of this. It works in Opera, but not in Mozilla. I think
Opera is wrong: Floating the cite should make it block level. The
block box is then created below the blockquote element.


Indeed, I'm running into the same issue on
<http://www.wayneengineering.com/products.html>, where I want the price to
appear at the right end of the last line of the product description, or the
right end of the line below it if there's no room. Floating the price
gives the desired effect on Opera, but not Mozilla or IE (either 5 or 6).
Jul 20 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.