etsted Posted August 26, 2014 Share Posted August 26, 2014 here i have a script that i run several times with a while loop bu every time the loop runs the next div has a higher margin-top than the next div $videos .= "<div class='files' style='float:left; background:#eaeaea; width:150px; color: black;' id='file_".$id."'>n <a href='watch.php?f=".$file_url[0]."'><img src='$avatar' height='60' width='60' alt='$titel'> Click here</a> <br> <span style='float:left; text-overflow:ellipsis;'>Titel: $titel</span>n <br> <span>Uploaded by: <a href='user.php?u=$username'>$username</a></span> <br> <br> </div>n <br> <br>n"; Link to comment Share on other sites More sharing options...
thescientist Posted August 26, 2014 Share Posted August 26, 2014 There could be a lot of reasons for that, but one thing to note is that divs are block level elements, so they'll stack vertically by default. Link to comment Share on other sites More sharing options...
etsted Posted August 27, 2014 Author Share Posted August 27, 2014 here is a link to my webpage widegrass.com Link to comment Share on other sites More sharing options...
JamesB Posted August 27, 2014 Share Posted August 27, 2014 Seems to work if you remove the 2<br> elements after the </div>. Link to comment Share on other sites More sharing options...
dsonesuk Posted August 27, 2014 Share Posted August 27, 2014 Because from every top right edge of class 'files' container the <br><br> takes effect, pushing it down by 2 x the height of current font. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now