TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Background image using CSS (http://www.talkphp.com/absolute-beginners/6076-background-image-using-css.html)

captainmerton 12-29-2011 07:16 PM

Background image using CSS
 
Using the following css:

PHP Code:

#usermessage {float:left; width:100%; margin-bottom:25px; padding:10px; font-weight:bold; background: #CCFFFF; border: 1px solid #99CCFF;
background-image:url('images/lightbulb.png');background-repeat:no-repeat;background-position:left;} 

At the moment if i add text to the usermessage div it starts over the lightbulb image. Anybody got any advice on the neatest way to start the text after the lightbulb background image without adding spaces to the text in the html or creating lots of divs to slice up the message?

Cheers.

tony 12-30-2011 05:38 PM

so you want the background to be moved? you can use background-position with coordinates, like background-position: 50% 50%; that would center the background in the div.

captainmerton 01-02-2012 03:46 PM

Thanks Tony. I have used that to better position it but it still sits behind the words. Its a help text area so i want a small lightbulb image to appear then text to follow the image at the moment the text overwrites the lighhtbulb image perhaps setting it in the stylesheet isnt the way to go? I could just display th image then the text in the html but feels like the wrong thing to do. Any guidance?

Cheers,
Ewan

tony 01-04-2012 04:13 PM

Ok so you want to space out the text in the text area so that it is not over the background image. I am not sure, but I think text-indent works well with textareas (in my experience it doesn't work well with some elements) I haven't done css in months.

captainmerton 01-04-2012 06:44 PM

Thanks Tony will give it a try.


All times are GMT. The time now is 12:39 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0