limitphp Posted January 9, 2009 Share Posted January 9, 2009 I have a div inside a table, and it seems to be taking the width of the table instead of itself. <TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" STYLE="width:100%"> <TR> <TD VALIGN="top" STYLE="width:100%"> <a href='www.index.com' class='pagination_link'> <div align='center' class='pagination_div'>« Previous</div></a> <a href='www.index.com'>2</a> </TD> </TR> </TABLE> The div uses class "pagination_div" which is defined here: .pagination_div {border-style:solid; border-width:1px; width:80px; padding:0px; margin:0px} The border shows up on the div, and it appears to only be 80px wide, but the link is active all the way acroos the page (100%)....it seems to take after the 100% width from the table. The other link with the number 2 <a href='www.index.com'>2</a> starts on the next line. Does anyone know why the div's border is only 80px wide, but the div itself seems to take up the entire line? Am I missing something here? Link to comment https://forums.phpfreaks.com/topic/140172-solved-problem-with-div-inside-an-anchor-tag/ Share on other sites More sharing options...
limitphp Posted January 9, 2009 Author Share Posted January 9, 2009 pagination_link class is: .pagination_link {font-family:arial; color:#0505a1; font-size:12px; text-decoration: none;} Link to comment https://forums.phpfreaks.com/topic/140172-solved-problem-with-div-inside-an-anchor-tag/#findComment-733483 Share on other sites More sharing options...
limitphp Posted January 9, 2009 Author Share Posted January 9, 2009 Do you think I have to put a width on the anchor tag? Will it take after the td width? nevermind.....putting a width on the pagination_link class didn't change anything... Link to comment https://forums.phpfreaks.com/topic/140172-solved-problem-with-div-inside-an-anchor-tag/#findComment-733484 Share on other sites More sharing options...
limitphp Posted January 9, 2009 Author Share Posted January 9, 2009 Why are the divs taking up the whole line instead of going side by side? This is driving me crazy........there has to be some simple reason I'm overlooking.... Link to comment https://forums.phpfreaks.com/topic/140172-solved-problem-with-div-inside-an-anchor-tag/#findComment-733492 Share on other sites More sharing options...
limitphp Posted January 9, 2009 Author Share Posted January 9, 2009 can you not have divs side by side? Link to comment https://forums.phpfreaks.com/topic/140172-solved-problem-with-div-inside-an-anchor-tag/#findComment-733498 Share on other sites More sharing options...
limitphp Posted January 9, 2009 Author Share Posted January 9, 2009 ok, I solved it with a google search..... it works now...the divs are side by side! You have to put float:left in the style if you want divs to be on the same line with other stuff....who knew?! Link to comment https://forums.phpfreaks.com/topic/140172-solved-problem-with-div-inside-an-anchor-tag/#findComment-733509 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.