Our previous blog post presented some compelling reasons why paragraph and character styles should be used for styling text. Not only do styles provide consistency and prevent possible error, should you decide to export the document to HTML they provide some control over how these files are written.

The same can be said for using Object Styles for styling containers for elements such as those used for images. When exported to HTML or ePub a limited number of properties are written to the .css file. These involve attributes having to do with the border and fill: border-color, border-width, border-style, and background-color. For anchored frames: space above, space below, and justification is left to styling for the paragraphs to which the object is anchored.

For both anchored and floating graphics there are two dialogs which give some additional control over how information for images are written to the .css:

  1. The Image tab for document HTML Export Options
    These settings apply to all image files in the document

…HTML image export options

  1. Export Options in the Object Style Options Dialog
    These settings apply specifically to only those objects styled with the individual object style.

…Object Style EPUB and HTML image export options


One place that Object Styles are often used is for text enclosed in a border or over a background.

This was, until the October release of InDesign. With the later versions, you may consider using a paragraph style with Paragraph Border and/or Paragraph Shading attributes set. Paragraph Border works almost perfectly saving the following attributes to the .css file (this for a style named Pullquote):

p.Pullquote {
	border-width:2px 2px 2px 2px;
	font-family:"Hoefler Text", serif;

Paragraph Border Using Object Styles

Even with the new paragraph border properties, you might decide to use the original anchored frame method. The anchored text frame has the added advantage of allowing text inset settings. Another consideration of using the anchored text frame is that the InDesign provides a number of size options that can be set for images and Object Styles. (These are available in both the Image tab for HTML Export Options and the Export Options tab for Object Styles.)

…Size Dropdown in Object Style Export Options

When using a paragraph style having the paragraph border settings, the frame for the text expands with the width of the text column. This is true even when the Width property is set to Text. (Maybe this will change with future upgrades.)

InDesign does give you plenty of options for setting up your HTML/Epub export. With the help of text and object styles, you can get your files to output just the way you want them to display.


Suppose your document has separate frames for an image or pull quote in the side bar of a document layout. You want these elements to be consistently in the same place for each version (or issue) of the document. Until the October 2017 release of InDesign you would probably have to relsort to using a template. But assuring consistent frame size and positioning can now be done with Object Styles. Yes, I said it: Object Styles.

In the document you are saving as a style sheet, create Object Styles for those frames (image or text) that you want to save with Size and Position Options set. Enter these settings in the Size and Position Options tab.

..Size and Position Options

To create your next version of this document, create the document from an established document preset and import Text Styles and Object Styles from your stylesheet.

Create any sized frame anywhere on the page and apply the appropriate Object Style. Your perfedtly sized and positioned frame pops into position. Better yet, create a script to do it all by incorporating code such as the following:

Code Snippet:

(*Assumes document exists with Images layer and object style as named*)
set objStyName to "fStyle"
tell application "Adobe InDesign CC 2018"
   set measurement unit of script preferences to points
   set docRef to document 1
   set layerRef to layer "Images" of docRef
   set styleRef to object style objStyName of docRef
   tell page 1 of docRef
	make rectangle with properties ¬
{name:"myFrame", applied object style:styleRef, item layer:layerRef}
   end tell
end tell

Imagine being able to import a number of Object Styles (possibly named incrementally) with size and position properties. Run a script that loops through the list of styles and not only creates the frames, but also places the content as part of the process.


For your next major project, take the little extra time necessary to use text and object styles for all its styling. As part of the process save a page of the document as a style sheet with all of your styles ready for import the next time you create a version of the document (or one similar).


Scripts provided are for demonstration and educational purposes. No representation is made as to their accuracy or completeness.areaders are advised to use the code at their own risk.