Skip to main content
Known Participant
December 19, 2008
Question

TextField and CSS: How to control spacing between paragraphs

  • December 19, 2008
  • 10 replies
  • 1910 views
I'm using an external CSS to format a textField that has some HTML text in it, let's say something similar to this:

myTextField.htmlText = "<p>paragraph one</p><p>paragraph two</p>";

How can I control the spacing between paragraphs when there is no support for margin-top or margin-bottom? I don't want to add empty <p> or <br /> elements to my text since they don't allow exact control and insert too much space. Is there any good solution?

Thanks
This topic has been closed for replies.

10 replies

Inspiring
December 21, 2008
I hope someone will have a different answer but I am afraid that it is not possible with HTML text to control line spacing.

Perhaps, one of the ways can be still using extra <p> tag and manipulate it's height with smaller font size so that it doesn't take as much space as it will by default. Say, you can have a declaration in CSS:

.spacer {
font-size = 4px;
}

and in the text field:

<p class="spacer"></p>

Again, I would love to see a better solution.
smohadjerAuthor
Known Participant
December 22, 2008
But my textField reads the text from an XML file which doesn't have any empty <p> tags and I don't have control over the content of XML.
Inspiring
December 22, 2008
Are the <p> tags part of XML? You did not mention it in the first post.

What is the XML structure?