Computing.Net > Forums > Web Development > CSS Padding & Background Image

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

CSS Padding & Background Image

Reply to Message Icon

Name: Ninja_Kirby
Date: August 12, 2008 at 14:58:10 Pacific
OS: Windows XP Pro SP2
CPU/Ram: AMD64 X2 2.6Ghz, 2Gb
Product: N/A
Comment:

Heya folks,

Newbie question for you, I have a DIV 500px by 300px, and an image with identical dimensions placed there-in using "background-image".

When applying padding, it affects the Image as well, when I only really want it to affect the text? In this case, the Image supplies a border for the DIV, and the text must keep inside it.

Using <Span style="padding: 5px;"> or something on the text is out the question, since the DIV's contents changes via JavaScript, copying and pasting various hidden DIV's into this Main DIV via "element.InnerHTML".

I would prefer to avoid a smaller DIV positioned inside the existing DIV as well, i.e. Outter DIV has the background image, and the Inner DIV contains the Sentences.

Thus, can I achieve what seems so simple, with a Single DIV? A background image, with Text confined to a specific area within the DIV?

Thanks for your help in advance :)



Sponsored Link
Ads by Google

Response Number 1
Name: Ninja_Kirby
Date: August 13, 2008 at 08:45:51 Pacific
Reply:

Pfft, never mind, lol, just subtracted the Padding implemented from the Border, problem solved.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: CSS Padding & Background Image

Website Background Images www.computing.net/answers/webdevel/website-background-images/1692.html

Huge background image www.computing.net/answers/webdevel/huge-background-image/440.html

How do I place a background image? www.computing.net/answers/webdevel/how-do-i-place-a-background-image/3637.html