Join James Fritz for an in-depth discussion in this video Mapping styles to export tags, part of InDesign CS5.5 New Features.
When designing a layout most people usually name their styles, if they use styles at all, something like headline, subhead, sub subhead, and body, but with HTML the names of styles are much more strict. In Web design styles are normally named h1 for the biggest and most important headline on the page, h2 for the next largest headline, and you repeat this process all the way down to h6. p is reserved for the normal body text or normal paragraph text. Using the new style mapping feature you can continue to use whatever name inside InDesign that you wish, but upon export, the style names will change to whatever export you had set them to.
So inside the mapping-styles InDesign document, I'm going to come up and I'm going to select this text at the top. Now this text is tagged with a paragraph style called Title, and this is the biggest and most important headline inside this page. In export to HTML I would want this to be an h1. So in order to map this to h1, I'm going to select this style and I'm going to right-click and choose Edit "Title". Now I could double-click if I want to edit the style and it would work in this instance, but I don't recommend you do that. The reason is it's not always safe. For example, if my cursor was in this body text and I decided that I wanted to edit title, and I came over and I double- clicked on Title, I would inadvertently apply a title to that paragraph which would cause a big problem.
So I really don't like double-clicking our styles. I'm going to cancel this dialog and do an undo to go back. So with my cursor in this main story, I'll right-click and choose Edit "Title". And inside the Paragraph Style Options, I'm going to come down to Export Tagging. Inside Export Tagging I've got two areas; I've got my EPUB and HTML area and my PDF area. So, because title is the biggest and most important headline on a page, I want that to be my h1, and for PDF it's going to be the same thing.
Now you may be thinking to yourself so, why is this split apart when they're both h1? Well looking at it, it's true they are both h1, but inside a PDF, H1 is capitalized, but in the EPUB and HTML it's a lowercase; that's one reason. The other reason that these are split apart is that in the future something may change with the PDF or HTML tags. In this case because they're separated, they can be enhanced in future versions without breaking anything. So I'm set with this with this one as h1, so I'll click OK. Now let's come to another area. Now inside this paragraph it says that it's body.
Now I'm going to right-click on this one and go to Edit " body" and we'll set this one inside our Export Tagging. We'll have this be p for paragraph and for PDF we'll go to paragraph 2. But when I go to this one right here it's called body first. Well, when I Edit "body first" there's another option. I do want to tag this one as a paragraph, for both of these, but I have an option for a Class. Now a class is used in HTML as a common way to differentiate slight variations of styling. So in this case I want to put a class and I'm just going to call this body-first.
This way if you're editing the CSS, you can call up this particular paragraph and treat it differently; that's what classes are for. In addition to choosing the tags that are in here, you could actually type in your own, if you knew a specific tag that you want to tag it to, but for now I'm going to stick it with the defaults. You can also tag your character styles. So inside my layout if I zoom in here, we're going to see there's an area that's bold. If I put my cursor inside this bold area, we can see that we've got a style called bold. If I edit this character style, under my Export Tagging, I only have an option for EPUB and HTML because there is no such thing as Character Styles inside a PDF.
I'm going to choose the Tag strong because strong is the HTML equivalent of bold. I could also add a Class if I needed to. I'm going to click OK. Now I could go through one by one and manually make all these paragraph and character style changes, but that would be a lot of work if I have a lot of styles. So there's a faster way to do this. If I go to my Paragraph Style panel menu, there's an option called Edit All Export Tags. When I do this, I'll get a big dialog and I can open this up to see more, and I can change all of them at once.
So I can see caption right here; caption would be a paragraph, same thing with photo credit, footnotes, but a subhead, that would be h2. My sub subhead would be an h3. My Sidebar subhead; and I can open this up a little more so I can see everything, there we go. Sidebar main head, well, that's going to be an h2. The bullets we're going to leave alone; anything that's a bullet will automatically transfer to a list when you export so I don't have to change that. But my main copy can be a paragraph, table head can be an h2, tables will be bold.
Now for my character styles, italic would be an m for emphasis, and then no break and bullet and drop cap I'll just leave alone, but I could add a span if I wanted to. If I go over to PDF I can repeat the options here so we're just going to come in here and we'll say paragraph for these guys, subhead would be an H2, sub subhead is an H3, Sidebar main head is an H2, and so on, and so on. Okay, with all of these set we can click OK and now we're ready to export to HTML.
I'm going to go to File > Export. I'll throw this on my Desktop and we're going to call this style-mapping. Now in Export I want to make sure this is the same as the Article panel for the ordering. We'll View it after Exporting. We're going to go into Advanced and we're going to choose No CSS because I just want to have this as clean and simple code as possible. We'll click OK. We'll be exploring these options in further detail in a later movie. Now inside my Web browser I can see my copy where it's formatted with the basic HTML tagged up text, and it looks nice and clean.
This will make it easier to make changes with the CSS. Let's take a look at this inside Dreamweaver. I'm going to go over to Dreamweaver and we'll open up this file on our desktop, the style-mapping. And inside my layout, if I select my text, we can see that A Brief History of San Francisco is tagged with an h1 and in our copy over here and we can see it's tagged with paragraph style. If we come to a spot where there's emphasis involved, such as this word, we can see that we have the emphasis tags directing on there, or for the print people the Italic button has been pressed.
Style mapping makes it much easier to repurpose your print layout for other formats like HTML or EPUB. In most workflows a web designer will want to hand code the CSS for a site. By giving them a clean HTML file with marked-up copy, that is proper h1 through h6 and paragraph tags, it'll be easier than ever to share your content.
- Adding alternate text for screen readers
- Mapping styles to export tags for HTML exports
- Adding multimedia for iBook output
- Dragging and dropping anchored objects
- Working with linked stories
- Using the Overlay Creator
- Creating a panorama for an iPad publication