hi there, thanks for taking your precious time to help me by reading this here a picture: so I have an area, which I want to act as an link. On mouseover in any part of the area the cursor should change and it should become a link. AND there are two different font colors in this area. however both should belong to the same link. here my approach until now: HTML-code: <div id="area"> <a href="http://www.digitalpoint.com">Main Title<br /></a> <span class="subtitle">Subtitle</span> </div> HTML: and CSS-code: #area a { font-color: white; margin: 0; padding-left: 5px; padding-bottom: 12px; display: block; background-color: #000; } #area a:hover { background-color: #ff0000; } .subtitle { font-size: 10px; font-color: yellow; position: absolute; margin-top: -17px; height: 10px; padding-left: 5px; } Code (markup): I also tried putting the span inside the <a> </a>.. but then the subtitle font color gets white, even if a make a ".subtitle a"-tag. any better ideas? thanks !!
It would take you time to make a picture like that, so: <a href="#">Main Title<br /><span>Subtitle</span></a> Code (markup): is all the html you need. a { display: block; width: 130px; padding: 5px 10px; font: bold 16px/18px arial, helvetica, sans-serif; color: #FFF; text-decoration: none; background: #000; } a:hover { background: #F00; } a span { font: normal 12px/14px arial, helvetica, sans-serif; color: #FF0; } Code (markup):
wohooo it works 2 questions, one small one, one bigger one: 1.) what does 12px/14px mean ? - e.g. when is the first one used, when the other one? 2.) now my thing looks like this: I've managed to change the height, through setting the "height" attribute, but I can't manage to shift the "Subtitle" higher up through setting the top-margin to a negative value .. is there a better way? thx for your advice. I hope this will be my last questions .. good night from europe.
font: 12px/14px means 12 pixel font size and 14 pixel line height (not height). The font shorthand requires only a size and 1 font family to work, just a size or font family won't work.. keep that in mind to avoid future errors
one last question: is it possible to have more than one background picture specified by a <a> tag? at the moment I have something like this: <div class="foo"><a href="#">My fancy link</a></div> HTML: .foo a { display: block; width: 100px; background: #222 repeat-y left url(image.gif); } Code (markup): but i would like to have another background picture aswell above the other one, at a fixed position. (and it should change on mouseover). any ideas, how to do this in a clean way?
Wouldn't it make sense to just include that into the existing background image? Why have two when they both change together anyway, just merge the images together.