• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

Zelle als Link mit Background-Image

Kenin

New member
hi :)

Ich würde gerne in einer Zelle einen Link realisieren. Neben dem Linktext kommt noch ein Background-Image hinzu. Jetzt habe ich das Problem, dass die Zelle erst wirklich dort ein Link ist, wo der Text beginnt.

HTML:
<table border="0" cellpadding="0" cellspacing="0" width="100px;">
	<tr>
		<td style="background-color: red;
		width: 200px;
		background-image: url('http://cms.hypercms.net/repository/media_tpl/nerven_net/navipoint.gif');
		background-repeat: no-repeat;
		padding-left: 20px;
		">
			<a href="#" style="
			display:block;
			margin:0px;
			width:100%;
			height:100%;
			">
				Klick
			</a>
		</td>
	</tr>
</table>

Wenn man über den Punkt fährt ist da kein "Linkhändchen".

Was muss ich machen, dass die gesamte Zelle inkl. dem Background-Image als Link funktioniert?

edit: ok, habe grad gemerkt, dass es nicht am Hintergrundbild liegt, sondern daran, dass der Text mit padding-left verschoben wird. Aber gibt es dafür eine Lösung?

greez
Kenin
 
Zuletzt bearbeitet:
Meinst Du sowas:
PHP:
<table border="0" cellpadding="0" cellspacing="0" width="100px;">
	<tr>
		<td style="background-color: red;">
			<a href="#" id="link">Klick</a>
		</td>
	</tr>
</table>

und die Styleangaben nimmst Du z.B. extra:
PHP:
#link{
display:block;
margin:0px;
width:200px;
height:100%;
background: url('http://cms.hypercms.net/repository/media_tpl/nerven_net/navipoint.gif');background-repeat: no-repeat;
padding-left: 20px;
}
 
Schreib das "padding-left: 20px;" mal in den "<a href="#" style="
display:block;
margin:0px;
width:100%;
height:100%;
">".
Also so: <a href="#" style="
display:block;
margin:0px;
width:100%;
height:100%;
padding-left: 20px;
">

MfG Ronnsen
 
Zurück
Oben