MDanz Posted August 4, 2011 Share Posted August 4, 2011 The width spreads across the whole page, i only want it to be as long as the content in the div. How can i solve this? <style type="text/css"> .three { display:block; width:auto; height:100px; position:relative; border:1px solid black; } .three a { width:100%; height:100%; position:absolute; } </style> echo "<div class='three'><a href='two'></a>test</div>"; Link to comment https://forums.phpfreaks.com/topic/243852-div-hyperlink-problem/ Share on other sites More sharing options...
jacvio Posted August 4, 2011 Share Posted August 4, 2011 Well one way could just be to set the width of the div to 0 (in the styles), then it will expand with the text width. Link to comment https://forums.phpfreaks.com/topic/243852-div-hyperlink-problem/#findComment-1252103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.