How can I do a link on an image but from a style sheet?
This is a the code of the style sheet:
#footer{
width:100%;
height:45px;
background:url(images/barra_blog.gif) no-repeat top left;
clear:both;
How can I do a link on an image but from a style sheet?
This is a the code of the style sheet:
#footer{
width:100%;
height:45px;
background:url(images/barra_blog.gif) no-repeat top left;
clear:both;
sorry I don't understand. Do you mean you have a background image and you want to be able to assign a link to it so you can click it?
I guess you can't as thats what separating content from markup means: the markup/design is in the css files and the content is inside the php/html/whatever files
You have to put the anchor (link) in the php/html
So you could have something like this in your footer:
<div id='footer'>
<a href='myurl' id='footerlink'></a>
</div>
And in your CSS:
#footer{
position: relative;
width:100%;
height:45px;
background:url(images/barra_blog.gif) no-repeat top left;
clear:both;
}
#footerlink {
position: absolute;
border: 0;
width: 100%;
top: 0;
left: 0;
height: 25px; /* Or whatever height your footer image is */
}
That might work
thats cheating ;-) he asked:
How can I do a link on an image but from a style sheet?
you are putting the link inside the php :-)
I know I know, but I'm in a helpful mood at the moment, and they don't come along very often :)
So, to agree with Ovidiu, you can't :) I've just tried to use the CSS content property, but that doesn't allow markup, so I guess you're stuck...
So, do you mean it's impossible?
It should be a way to do it...
Yep, it's pretty much impossible and technically "there shouldn't be a way to do it" because "Cascading style sheets are used to format the layout of Web pages." (http://www.techterms.com/definition/css).
So the the layout and the functionality is defined by the HTML. Links will have to go into the HTML (or Javascript code), but "how the links look" will go into the CSS.