Sitemast left cornerFeature articlesBasic guidesAdvanced guidesWeb Standards CompliancyContact pageLinks and moreNews ChannelSite logo

General

Extending Text Styles

Another thing that’s fun to play with is extending text styles. Say for instance that you want to add margins to a block of HTML text? Here is how:

Start by creating a paragraph style specifically for this exercise. You can leave all the values at their default if you like. Name the style "test" or something equally clever. Now, the object of the exercise is to set a visible margin to the edges of the bounding box, so it’s a good idea to set a visible background color to the box. But that's for later; let’s start with the margins.

Use the Styles palette to create a paragraph style (click the top right arrow in the Styles palette window to get the fly-out menu).

As you’re creating the style, make a note of the Extended... button in the bottom left corner of the dialogue window. In fact, click on it. If the button is unavailable, make sure the ‘View CSS Attributes’ checkbox is ticked.

When you click the Extended... button, it brings up the dialogue window that you may recognise from the first exercise. Clicking ‘New’ lets you enter a Name/Value pair that extends the style. So, let’s do just that. Click New and type the following in the respective fields:

Name: margin
Value: 10px

Note that in this dialogue, you do not close the value with a trailing semi-colon, it is automatically set by Freeway in the generated code—so if we were to type a closing semi-colon here it would give us a double semi-colon in the generated code. While this might not technically mean anything, it’s still not recommended. Also note that you can use any acceptable unit for the value since you’re writing raw code, i.e percentage, em, points or pixels. If you want your units to be as acceptable as possible across browsers and platforms, use relative units such as percent or em, rather than fixed units like pixels.

Click OK to save the attribute, then OK again to save the style. Apply the style to a block of text in an HTML box and give the box a background colour to make it visible against the page background. Preview in a browser. Here is an example of how it should look.

And that is how we use the Extend... button for text styles. What else can you do with the Extended feature, you ask? Just about anything that can be styled with CSS or modified with javascript events. I’ll return to this in later guides.

Google

WWW 180mph

Colophon

180 mph is a periodically published website and PDF magazine, created by Fred Kylander of Glimmerman Design. The purpose of 180 mph is to serve as an independent resource for users of the web desktop publishing software Freeway, by Softpress Systems Ltd. Neither 180 mph nor Glimmerman Design are affiliated or connected to Softpress Systems in any way. For official information about Freeway, please visit the Softpress web site.

180 mph is produced on an Apple G4, 17" Powerbook. The magazine is produced with Adobe InDesign 3, Illustrator 11 and Photoshop 8 (CS). The website is produced with Freeway Pro 3.5, SubEthaEdit 2 and Adobe Photoshop 8. Other hardware include a Canon EOS 300D and a Wacom Intuous tablet.

ISSN 1652-1652-8085