Topic: background image as a link? (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: there...no..there..... |
![]() I'm using stylesheets to load the images in the background like this : code: #header{ height:100px; background: url(../imgs/topper.jpg) no-repeat; width: 750px; text-align:left; } #header h1{ padding:0px; margin:0px; } #header h1 span{ display: none; }
code: <!-- ye ol' hide the text in a span trick --> <div id="header"><h1><span><a href="index.html">My Site</a></span></h1></div>
|
Paranoid (IV) Inmate From: Norway |
![]() |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
![]() how about giving the background imag eto the link itself? |
Paranoid (IV) Inmate From: London |
![]() I don't think that putting an anchor tag around a div is semantically correct however. |
Maniac (V) Inmate From: there...no..there..... |
![]() ah yes. poi comes in with a quick winner. I did try putting the link around the div but like Blaise said, it's not semantically correct and won't validate at all. |
Lunatic (VI) Inmate From: under the bed |
![]() Of course, the whole idea of using a background image as a link is not really semantically correct either. |
Paranoid (IV) Inmate From: Norway |
![]() CPrompt: Too bad, my english is even worse than usual in my uber quick replies. |
Lunatic (VI) Inmate From: under the bed |
![]() |
Paranoid (IV) Inmate From: Florida |
![]() If you hide the text within the a appropriately, it's fine. |
Maniac (V) Mad Scientist From: :morF |
![]() I, for example, in one of the templates I recently made, have a header DIV that displays the whole head image, title and all, in the background. To make the title words render as a link I created a span wrapped around an anchor, the anchor being made to display block and take up all available space. The span had the title attribute set, giving us our tooltip on rollover and making it functional for screenreaders. |
Maniac (V) Inmate From: raht cheah |
![]() yet another |
Maniac (V) Inmate From: there...no..there..... |
![]() good stuff. Thanks for the help and JK for that groovy example. |
Maniac (V) Mad Scientist From: :morF |
![]() Semantic, as I understand it, is "using the correct element for the correct purpose". So, italics use <em>, bold uses <strong>, code goes into <code> blocks, quotes into <blockquote>, paragraphs into <p> and so on and so forth. |
Lunatic (VI) Inmate From: under the bed |
![]() It's all about intent. |
Maniac (V) Mad Scientist From: :morF |
![]() Well true. Under the idea of semantics being "the right element used for the right purpose" then <em> would be for any text you want to emphasise, and <strong> owuld be for any text you decide needs to be given greater focus. That fits in nicely with the intent, doesn't it? |
Maniac (V) Inmate From: there...no..there..... |
![]() OK, well I guess I was a little misled on what "semantic" actually ment. I guess that in non graphical browsers that the alt attribute of the image tag will be read instead of the image name? That would be the purpose of the alt attribute. |
Maniac (V) Mad Scientist From: :morF |
![]() Yes. alt attributes are there to provide something meaningful when the image can't be loaded due to a broken link or unsupported format. So, in otherwords, text-based brosers will read the alt attribute if it exists to try and give their user's something meaningful to refer to. |
Bipolar (III) Inmate From: f(x) |
![]() I may be a bit late, but here's what I'd do: http://asylum.zavaboy.com/ex/ex1.htm |
Obsessive-Compulsive (I) Inmate From: |
![]() In addition to zavaboy's solution, I would throw in Stu Nicholl's new FF dotted-border fix. |