> -----Original Message----- > From: css-d-boun...@lists.css-discuss.org [mailto:css-d- > boun...@lists.css-discuss.org] On Behalf Of Tim Dawson > Sent: 28 April 2009 16:00 > To: css-d@lists.css-discuss.org > Subject: [css-d] Setting a link on replaced text > > I have an <h2> heading which I've replaced with a background image, and > used CSS > text-indent to prevent the 'real' text showing. > > The relevant CSS is: > h2#azw { > background-image: url(graphic/amazingwildlife.gif); > text-indent: -9999px; > } > > All's well until I need to put a link on the text. The following works > OK but > doesn't validate because the <h2> is inside the <a>: > '<a href="#" onclick="javascriptfn()"><h2 id="azw">Scotland's Amazing > wildlife</h2></a>' > > Putting the <a> inside the <h2> as required to validate doesn't create > a link on > the background image. > > See: http://www.holidaymullandiona.co.uk/index.php (the heading in the > box) > > I have tried absolutely positioning the <h2> way off screen and then > inserting a > normal image carrying the link. It works, and validates, but is more > code, and > I have to have an (empty) 'alt' etc. > > Any better ideas, please ? >
Tim Instead of having text in a far away place through CSS. Put your text in the alt tag. This works for me. If you have any more problems give me a shout as this is not really a CSS issue. Cheers Ian IYES e-Solutions Specialists One St Colme Street Edinburgh EH3 6AA Tel: +44 131 220 8499 Mob: +44 7831 127 524 ______________________________________________________________________ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/