How can I make a <p>
tag expand so that it is the right size for the content that will fill it. Just giving it padding does not seem to do that. And when I omit the width
property, it expands to fill the entire width of its parent <td>
. It has to be all inlined styles since it's email.
<p style="font-family:'helvetica', 'arial', 'sans-serif'; font-size:11pt; padding:7px 5px 5px 7px; background-color:#dddddd;">
Purchase order {$sector_value['sector_info']['purchase_order']}
</p>
HTML paragraph width Forgive width to <p> tag you need to use CSS style width property. The width property sets the width of a paragraph element. width: auto|value|initial|inherit; Example: setting width 40px in HTML P tag, if the text is more then it will break to the next line.
The width property in CSS is used to set the width to the text, images. The width can be assign to the text and images in the form of pixels(px), percentage(%), centimetre(cm) etc. The width property does not contain padding, borders, or margins. The width property is overridden by the min-width & max-width properties.
1. Set width in HTML. In HTML, you can use the width attribute to set the width of an element. Alternatively, you can also use the size attribute to define the width of the <input> .
Using inline-block property: Use display: inline-block property to set a div size according to its content.
Just add display:inline-block
to the paragraph! :)
http://jsfiddle.net/SZSFE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With