jameyperagine Posted June 17, 2014 Share Posted June 17, 2014 I am semi-new with CSS and trying to figure out why I can't line up my divs. I have one container div and then 7 inner divs that are floating left. My seventh div doesn't seem to be floating properly. Instead of dropping down to the next line - all the way to the left of the line, it's dropping down to the next line all the way to the right. I have attached the file. LeadList-3.php Link to comment Share on other sites More sharing options...
newseed Posted June 17, 2014 Share Posted June 17, 2014 It depends what's contained inside those 7 divs. If you set the container div to be let's say 1000px and your 7 divs within that container do not have any fixed widths then nothing is telling any of those divs to be equally spaced thus the width will be as wide as whatever it is inside of it. However, if you set your 7 divs to be equally spaced then it would amount roughly about 142px each. You will also need to factor in borders, padding, margins, etc if they are being used.So your last div is dropping down because it doesn't have enough room to fit on the same line as the other divs. Link to comment Share on other sites More sharing options...
jameyperagine Posted June 17, 2014 Author Share Posted June 17, 2014 Thank you for the response. I am actually wanting it to drop down. When it does, however, it is dropping down and positioning almost all the way to the right side on the next line. Link to comment Share on other sites More sharing options...
newseed Posted June 18, 2014 Share Posted June 18, 2014 If you force all your divs to have a fixed height then it will naturally clear. Reason why doesn't clear now is that 1 of your 6 divs may be taller than the other divs.Again, depends on what's contained in the 6 previous divs. That 7th div probably needs to clear floats using clear:left so that it clears everything to the left. Link to comment Share on other sites More sharing options...
davej Posted June 19, 2014 Share Posted June 19, 2014 I have one container div and then 7 inner divs that are floating left. My seventh div doesn't seem to be floating properly. Instead of dropping down to the next line - all the way to the left of the line, it's dropping down to the next line all the way to the right. I have attached the file. Could you post the rendered HTML rather than the php file? Just do "view source" in the browser and copy the code. 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