dreamwidth, tables, and you
- or -
- or -
how i stopped worrying and embraced new html standards
RPers love their tables. Love them. Profile codes, muselists, CR charts, you name it. And the problem with transferring RP journals and games from Livejournal to Dreamwidth is that if you copy-paste your HTML wholesale, it won't show up the same. Basically, this is because of Dreamwidth conforming to an updated HTML standard, but knowing that doesn't help you if you don't know how to fix it. I'll take you through making a simple muselist table here, to teach by example-- feel free to ask questions in the comments, and I'll answer as best I can, since really I'm just going over what I can think of off the top of my head.
What we want to do is make this table:
How you would do this on Livejournal is the following:
<img src="http:// www.dreamwidth.org/userpic/1022941/
1156522" border="10px" color="#000000">
<font face="georgia" size="5"><i>aradia megido</i></font>
But try sticking that into Dreamwidth, and you get:
This is a problem!
Let's take this step by step.
The most obvious thing is probably the font. That is not what we're going for! The thing is that the <font> tag is being phased out of HTML; it's kind of clunky, and there are much more elegant ways to format your text. What you want to do is use style tags.
There are two ways to format text with style tags: <p style> and <span style>. In tables I prefer to use span style, because p style formats text as a paragraph, which can add extra spacing that you weren't planning on. So, the way to format the text properly using a style tag is:
<span style="font-size: 16pt; font-family:georgia, serif; font-style: italic;">aradia megido</span>
which gives you
Everything useful relating to text can basically be done with this tag. For the titles in the entry, for example, I used the properties text-transform: uppercase; for the capitals, and letter-spacing: 0.2em; to kern the text.
Next, let's tackle the border around the userpic. We're going to use style tags again, this time <img style>. The correct code is:
<img style="border:10px solid" src="http://www.dreamwidth.org/userpic/
which gives you:
You don't technically have to close the tag at the end, but it's more compliant if you do. If you're at all used to making or customizing layouts, this may be starting to remind you a bit of CSS, where you name an attribute and then apply all of the properties to it that you want in one go. Instead of separate tags for font, alignment, etc., you name your "style" category, and tell the item what you want its style to look like.
That takes care of the styling, but what about the table itself? If we apply the code we have now, what we get is:
That sure is ridiculously off-kilter! The thing about tables on dreamwidth is that what is inside the cels won't necessarily auto-align itself in a way that suits you, even if you manually enter the width and height you want. How do we fix this? Three guesses, and the first two don't count. That's right, style tags. These are the last three bits of code you need:
At the top, instead of <tr height="120px"> : <tr style="height: 120px;">
Added into the img style tag: "align:center;" for a total line of <img style="align:center; border:10px solid" src="http://www.dreamwidth.org/userpic/
And for the td containing the text: <td style="vertical-align: middle">
Our final code is in this textbox for your copying pleasure!
Like I said, this is just how I got one particular simple table to work. If you have any questions on how to format a particular effect, or a particular table you'd like to update for dreamwidth, let me know in the comments! If I don't know off the top of my head, I'll play around until I get it, and add it to this entry for general usage.
EDIT: there is a problem with nested tables where the alignment goes haywire and there's all this blank space. I'll put up some examples later-- for now, add table style="margin: opx;" to anything having that problem.