Forum Moderators: open
Any suggestions? The only thing I can think of which is guaranteed to work is to use a table with one <TR> per line of pre-formatted text, but the thought disgusts me.
I'm attempting to work in standards-compliant XHTML with CSS.
Thanks for the help.
I recently had a similar challenge for adding notes to a translation. But I confess, I ended up using a table for layout. (Oh, the shame of it!) I didn;t think about a negative margin until you brought up the painful memeory here :)
However, I'm pretty sure that I don't have any guarantee that browsers will all render that correctly, and I won't go so far as having to hand-tune the styles on a per-browser basis (I have a pretty technical crowd, so I think I can assume recent versions, but will need support for more than just IE).
My current best attempt is:
[dierks.org...]
As you can see, I've got a few problems (at least in IE):
- Note starts one line down from where it's inserted (right after the red text for each note).
- A tiny variation in the right margin of the body text where there's a note (as seen in the full-justified text). This isn't a problem for my case, actually, but I'm interested in what I'd have to do to get rid of it.
- If two notes collide, I can't explain why the rendering looks the way it does.
Thanks for any suggestions!
- Tim
from what I can see you want the following:
1) create a padding on the main text with a width of 120px
2) write your notes in this padding
to push your note fully out into the padding your note margin-right must be greater than or equal to the width of the note. You've got it the other way round which is why the note is pushed into the body-text
DIV.maintext { text-align: justify; line-height: 1.2em; padding-right: 120px } DIV.note { background-color: yellow; text-align: left; float: right; width: 110px ; margin-right: -125px; margin-top: -1.2em; }
SPAN.note { }
The margin-top fix works in Mozilla 1.5, but in Safari it's pushed a line further up. I wouldn't worry that much about the Safari problem.
At present, I can't see a solution to the note overwriting problem
Test 1:
[dierks.org...]
Test 2:
[dierks.org...]
Test 1 in IE:
[dierks.org...]
Test 2 in IE:
[dierks.org...]
Test 2 in Mozilla Firebird:
[dierks.org...]
As you can see, doing the margins correctly (as I understand it) pushes the note further to the right in IE; if I use the values in your code, the note is pushed entirely off the page and doesn't render at all.
This looks like some IE-specific problem with the box model that I'll have to research.
Regarding vertical alignment, I'll have to see what I can figure out, or just eat the one-line error one way or the other (or split the difference).
Thanks for all your help and for any further suggestions!