eiranix Posted April 13, 2014 Share Posted April 13, 2014 Sorry if this is a stupid question, but why does the image in the third div affect the layout of the text in the first div? .table { display:table;}.cell { width:100px; display:table-cell; background-color:lightblue;}.gutter { display:table-cell; min-width:20px;} <div class="table"> <div class="cell"> Some Text </div> <div class="gutter"></div> <div class="cell"> <img src="http://a.deviantart.net/avatars/a/p/aperture-a.png"> </div></div> Link to comment Share on other sites More sharing options...
dsonesuk Posted April 13, 2014 Share Posted April 13, 2014 In what way? if you use the same class in both, you will get the same design to that class declaration in both. Link to comment Share on other sites More sharing options...
eiranix Posted April 13, 2014 Author Share Posted April 13, 2014 The first .cell has text. The image in the second .cell makes the text in the first move down... Link to comment Share on other sites More sharing options...
dsonesuk Posted April 14, 2014 Share Posted April 14, 2014 Maybe due that when image and text are used in table cell the text defaults to baseline alignment (bottom of img), fix is to use vertical-align: top; or vertical-align: middle; Link to comment Share on other sites More sharing options...
eiranix Posted April 14, 2014 Author Share Posted April 14, 2014 Yes thank you that works... I didn't think alignment could work that strangely, so I didn't try that! I don't think it makes any sense, but it works! 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