Topic: background image as a link? (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: there...no..there..... |
posted 01-16-2006 15:32
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 |
posted 01-16-2006 15:57 |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 01-16-2006 15:57
how about giving the background imag eto the link itself? |
Paranoid (IV) Inmate From: London |
posted 01-16-2006 16:10
I don't think that putting an anchor tag around a div is semantically correct however. |
Maniac (V) Inmate From: there...no..there..... |
posted 01-16-2006 16:34
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 |
posted 01-16-2006 18:37
Of course, the whole idea of using a background image as a link is not really semantically correct either. |
Paranoid (IV) Inmate From: Norway |
posted 01-16-2006 20:09
CPrompt: Too bad, my english is even worse than usual in my uber quick replies. |
Lunatic (VI) Inmate From: under the bed |
posted 01-16-2006 20:40 |
Paranoid (IV) Inmate From: Florida |
posted 01-17-2006 16:36
If you hide the text within the a appropriately, it's fine. |
Maniac (V) Mad Scientist From: :morF |
posted 01-17-2006 16:55
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 |
posted 01-17-2006 19:10
yet another |
Maniac (V) Inmate From: there...no..there..... |
posted 01-19-2006 04:03
good stuff. Thanks for the help and JK for that groovy example. |
Maniac (V) Mad Scientist From: :morF |
posted 01-19-2006 08:26
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 |
posted 01-19-2006 12:38
It's all about intent. |
Maniac (V) Mad Scientist From: :morF |
posted 01-19-2006 12:50
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..... |
posted 01-21-2006 04:20
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 |
posted 01-22-2006 05:55
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) |
posted 01-22-2006 20:57
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: |
posted 01-24-2006 01:33
In addition to zavaboy's solution, I would throw in Stu Nicholl's new FF dotted-border fix. |