www.webdeveloper.com
Results 1 to 2 of 2

Thread: Use text as background in css

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Use text as background in css

    I am using a checkbox with opacity zero, now i can use " background: url('icons.png') " to set how the checkbox is displayed. But instead of the image i want a text to be displayed. I am doing this so that i can create an expandable tree view using only css. I want the check box to be set as '-' when clicked and '+' by default, but i have to do thid without using images. Is this possible? Thanks.

  2. #2
    Join Date
    Mar 2012
    Posts
    1,556
    If you use position:absolute you can overlay one div on another, using z-index:, then what is in the lower div will show through. However, bear in mind that opacity and z-index do not work with IE8 and below. So you will have a compatibility problem, however you achieve the result, if it depends on opacity settings.

    There is an alternative, but I've not tested it. If you do not set a background color for a div it defaults to transparent even under IE7 and 8 (if I remember rightly). So using position:absolute, and ordering the code to draw the "background" div before the "foreground" one (which does not have a background set) should (I hope) allow you to use text in the "background" without relying on opacity or z-index. At least it may be worth a try...
    Last edited by jedaisoul; 05-11-2013 at 02:21 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles