Forum


Replies: 1   Views: 2025
Html styling for div, hr and borders around p
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by vpratfr  · 06-07-2020 - 16:51

Hi,

I have a lot of trouble figuring how to make a simple framed paragraph with background color.

The HTML looks like that: https://jsfiddle.net/tp1jbqzo/1/

<p style="border: 0.2pt solid #999999; padding: 40pt; background: #f0f0f0;">
    Some text here
</p>

However the rendering in Word looks more like a margin is applied instead of a padding (in word it looks more like: https://jsfiddle.net/tp1jbqzo/2/) -> Basically my border and background stick to the text boundaries and padding behaves more like margin.

How can we make margin and padding work as expected on divs and paragraphs?

How can we space the border from the text?

(Note that I tried really hard to understand that by looking into your documentation but I failed to find the right place to get CSS/HTML related topics).