Skip to main content
Known Participant
July 19, 2011
Question

Is marginLeft and marginRight supported on p tag?

  • July 19, 2011
  • 2 replies
  • 681 views

I'm reading in TLF markup from a .xml file and displaying it using TextConverter.importToFlow.  I also apply a flash.text.StyleSheet like in the CSSFormatterResolver examples (http://blogs.adobe.com/tlf/2011/01/tlf-2-0-changes-subparagraphgroupelements-and-typename-applied-to-textfieldhtmlimporter-and-cssformatresolver.html).  I'm trying to get 'marginLeft' and 'marginRight' to work on my 'p' tags that I'm reading in, but they don't seem to be honored.

TLF markup looks like this:

<p styleName="note"><span styleName="generatedNote">Note:    </span>This is dummy content, so nothing here is going to be really that good.  Test content, test content.</p>

Stylesheet styles are:

.note {

     marginLeft: 10;

     textIndent: 0;

     paddingLeft: 10;

     paddingRight: 10;
}

.generatedNote {

     fontWeight: bold;
}

My goal is trying to get all of the content within the 'p' tag to indent '10' pixels when the content wraps in my TextArea component.  textIndent seems to do the trick for the first line when I change it to 10, but when the content wraps, the second line is not indented 10 pixels.

I even put marginLeft="10" on the 'p' tag itself but it doesn't do anything.  Am I missing something?  On the TLF demo at Adobe labs (http://labs.adobe.com/technologies/textlayout/demos/), it even spits out marginLeft for a 'p' tag...

<flow:p marginLeft="10" textIndent="0"><flow:span fontWeight="bold">Note:</flow:span><flow:span>  This is dummy content, so nothing here is going to be really that good.  Test content, test content.</flow:span></flow:p><flow:p><flow:span></flow:span></flow:p>

We are currently using TLF 1.1 and Flex 4.1 SDK.  Is it possible 'marginLeft' was added in TLF 2.0?  I don't see marginLeft in the TLF 2.0 Spec though.

Thanks!!

This topic has been closed for replies.

2 replies

Adobe Employee
July 20, 2011

Comparing to CSS box model, TLF only have padding, but not border or margin.

Margin attribute in the demo may just be implemented using padding...

I recommend you to use the newest version, TLF 2.0. There are some bug fixes and new features in TLF 2.0.

dacaglSASAuthor
Known Participant
July 19, 2011

I believe I got something that works ok by messing around with the 'textIndent', 'paragraphStartIndent', and 'paragraphEndIndent' attributes.

.note {
textIndent: 0;
paragraphStartIndent: 10;
paragraphEndIndent: 10;
}