Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Block style anchor 2

Status
Not open for further replies.

tsdragon

Programmer
Dec 18, 2000
5,133
US
I've seen this done in other threads: make an anchor in a table cell fill the whole cell by changing its display style to block. I can't seem to make it work in IE6.0. I suspected it was a doctype issue, but no doctype from "4.0 transitional" to "xhtml 1.0 strict" seems to make a difference. Any suggestions?


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
IE usually applies [tt]width: auto;[/tt] while others do the [tt]width: 100%;[/tt]. Try specifying width: 100%; to get IE to do it like the others. Otherwise, IE will make it only as big as the contents.
 
Are you setting the height to 100%? This works for me regardless of DOCTYPE:

Code:
<html>
<head>
	<style type="text/css">
		td {
			background-color: green;
			width: 100px;
			height: 50px;
		}
		td a {
			background-color: red;
			display: block;
			width: 100%;
			height: 100%;
		}
	</style>
</head>
<body>
	<table border="1" cellpadding="0">
		<tr>
			<td><a href="[URL unfurl="true"]http://www.google.co.uk/">Google</a></td>[/URL]
		</tr>
	</table>
</body>
</html>

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]
 
I added both height:100% and width:100% and that did the trick. Thanks! I don't think it would ever have occurred to me to try that (although it should have).

I also added hidefocus='true' to the anchor tag to get rid of the ugly focus rectange.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
I wish Microsoft would have a meta tag for that hidefocus setting that worked page-wide (much like they have both individual and page-wide settings for the image toolbar).

Ah well... until I write my own browser, I guess I can't complain too much ;o)

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
I tried to set it in the style class and got nowhere. One of those little aggravations we all have to live with.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top