dreamwest Posted October 25, 2008 Share Posted October 25, 2008 Can i add text to a .css <div> .arrowlistmenu .openheader{ background:url(/images/close.png) no-repeat 8px 2px; } I want to add "Show This" next to the image Im a bit lost on how to do this... Quote Link to comment Share on other sites More sharing options...
ifubad Posted October 25, 2008 Share Posted October 25, 2008 You can put the text in a <span> inside the <div>, and position or margin the <span> to whatever side of the background image <div><span>Text</span></div> Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted October 26, 2008 Share Posted October 26, 2008 Yes, you can. content: '.....content goes here ....'; Quote Link to comment Share on other sites More sharing options...
dreamwest Posted November 3, 2008 Author Share Posted November 3, 2008 Yes, you can. content: '.....content goes here ....'; Doesnt work Quote Link to comment Share on other sites More sharing options...
likethegoddess Posted November 3, 2008 Share Posted November 3, 2008 Hmm. I think you'll want to add your text to your HTML rather than your CSS. Since you've specified your image as a background image in your CSS, you might find it easier to create a neighboring div to house your text. Hope this helps. Diana Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 3, 2008 Share Posted November 3, 2008 I've never actually used it, but AFAIK content: works with :after and :before .arrowlistmenu .openheader{ background:url(/images/close.png) no-repeat 8px 2px; } .arrowlistmenu:after .openheader:after{ content: 'content is here'; } Quote Link to comment Share on other sites More sharing options...
dreamwest Posted November 3, 2008 Author Share Posted November 3, 2008 I've never actually used it, but AFAIK content: works with :after and :before .arrowlistmenu .openheader{ background:url(/images/close.png) no-repeat 8px 2px; } .arrowlistmenu:after .openheader:after{ content: 'content is here'; } This works! Thanks Quote Link to comment Share on other sites More sharing options...
jcombs_31 Posted November 3, 2008 Share Posted November 3, 2008 Why would you want to do it that way? Quote Link to comment Share on other sites More sharing options...
haku Posted November 4, 2008 Share Posted November 4, 2008 I believe that :after and :before are not standard across all browsers, so you may want to check the major ones before going with this, unless the content that is added is not essential content. Quote Link to comment Share on other sites More sharing options...
stublackett Posted November 4, 2008 Share Posted November 4, 2008 As its been said, Why would you want to do this? If your using an image just put ALT Tags on it or as someone suggested put another DIV in there with your text included in it #div { position : relative; top : 8px; left:10px; } #div-in { position : relative; top : 5px; left: 5px; } That would sit a DIV inside a DIV for you Quote Link to comment Share on other sites More sharing options...
dreamwest Posted November 4, 2008 Author Share Posted November 4, 2008 Why would you want to do it that way? I can use a.hover to change content without using javascript .arrowlistmenu .openheader{ background:url(/images/close.png) no-repeat 8px 2px; } .arrowlistmenu:after a:hover{ background:url(/images/open.png) no-repeat 8px 2px; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.