Viewing text box with fill

text box with fill



User: Christopher 12 years ago
This one's tricky to describe. I have a text box that is 100 pixels high with inset margin for text at default 6. I have filled with a solid colour fill. I tried widening the text box to the page's left edge and adjusting the text inset margin accordingly, but when I increase that number, the vertical shape of the fill also increases. If I increase text inset margin to 25, the height of the text box expands to 125. I can't reduce it to 100 unless I shorten the inset margin.

Chris

-------------------------------
rMBP 15", 2.6 Ghz, 16 GB RAM, OS X 10.11.6, with 27" Thunderbolt Cinema Display

www.cleetche.com
User: Paul-RAGESW 12 years ago
Hi Chris,

Yes because the minimum size of the box is the size of the text plus the margins. In your case it is 25 pixels on all 4 sides.

-------------------------------
Paul
EverWeb Developer
User: Roddy 12 years ago
You'll find it a lot easier to understand this kind of stuff if you have a look at the box model...



... to learn the difference between margin and padding and to find out the effect of adding these and borders to an object.

When you have text in a box you are dealing with two objects - the paragraph and the text box - and each one has both margin and padding. Increasing the paragraph margins would have the same effect as increasing the box padding.

As Paul has stated, everything you add (or subtract) contributes to the box size. Border thickness contributes to this too.

Just to add to the confusion, CSS allows borders and box shadows to be inset or outset. You can also apply negative values. If you have some text in a box and add an all around margin to the paragraph of 5px and an all around padding to the box of -5px the net effect will be zero.

-------------------------------
Roddy

Website: http://everwebwidgets.com
Contact: http://everwebwidgets.com/ewWidgets-home/contact.html
NOTE: I am an EverWeb user and NOT affiliated with EverWeb! Any opinions expressed in this forum are my own.
User: Christopher 12 years ago
Well that clears that up then doesn't it. ;)

-------------------------------
rMBP 15", 2.6 Ghz, 16 GB RAM, OS X 10.11.6, with 27" Thunderbolt Cinema Display

www.cleetche.com


Post Reply
You must login or signup to post.