Wednesday, October 5, 2011

Adding a margin to the text inside a Content Editor web part

I dumped a lump of text in a Content Editor web part in SharePoint 2010 and saved/checked-in the page.

Frankly it looked totally disgusting. The major problem seemed to be the lack of left and right margins so much so that the first pixel of every letter at the begining of every line was missing. I tried a couple of tricks like putting the text inside a HTML table with cellpadding=8. These didn't work.

Eventually I ended up in putting the text inside a "span". It worked nicely. Here's the code just to save you a minute or two messing about with html:


<span style="margin-left:8px;margin-right:8px" >

Your HTML code containing your text goes here - The code is already generated for you. Just click page edit... click on the text and then click the HTML button on the ribbon and select Edit HTML. then you need to add the closing "span" tag as the very last tag to your page.

</span>


No comments: