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>"; Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.