开发者

CSS Background Image and Padding

开发者 https://www.devze.com 2023-02-05 07:09 出处:网络
I want to set a background image in a div class, and want to add s开发者_如何学运维ome text on the image, with 5px padding but my text is overflowing, please see my css and demo here http://jsfiddle.n

I want to set a background image in a div class, and want to add s开发者_如何学运维ome text on the image, with 5px padding but my text is overflowing, please see my css and demo here http://jsfiddle.net/LcQzG/ and help me with it. Thanks.


You should set a width and add

word-wrap:break-word;

example : http://jsfiddle.net/LcQzG/6/


Either make the background image higher, make the text smaller, make the box wider or add this to add a scroll bar:

overflow: auto;

or to hide the overflowing text:

overflow: hidden;


You need to set a width on the containing div. The width would be the width of the image - 10px (the sum of the left and right padding).

0

精彩评论

暂无评论...
验证码 换一张
取 消