george Posted November 16, 2010 Share Posted November 16, 2010 I have a simple web site here which demonstrates my problem. I am trying to get multipul images to line up without spaces between them. I built a "holdBox" to contain my images, and listed all the images with no spaces between them. This got rid of unwanted space between images, but not spaces between rows. My guess is that when the images wrap to the next row, a space is somehow introduced. Any ideas? Link to comment Share on other sites More sharing options...
jeffman Posted November 16, 2010 Share Posted November 16, 2010 Images are inline elements, not block elements. You are stacking them as if they were blocks. But they want to behave as inline (like characters). The only reason they are stacking is that you they are contained by a small div that will not let more than one be in the same horizontal level. So they wrap, just as words would wrap.I think that is causing the space.Try defining them as blocks in your CSS:display: block; Link to comment Share on other sites More sharing options...
jeffman Posted November 16, 2010 Share Posted November 16, 2010 Oops. Just realized each row is multiple images. You'll need to use floats and clears to make my plan work. Link to comment Share on other sites More sharing options...
[dx] Posted November 16, 2010 Share Posted November 16, 2010 You could <table cellspacing="0" cellpadding="0"><tr><td>IMG tag here</td></tr><tr><td>IMG tag here</td></tr><tr><td>IMG tag here</td></tr></table So this will work. Link to comment Share on other sites More sharing options...
allyouhave Posted November 16, 2010 Share Posted November 16, 2010 If the images are displayed as inline elements, you could try making the div's line-height: 0px;. Worth a shot, eh? Link to comment Share on other sites More sharing options...
jeffman Posted November 16, 2010 Share Posted November 16, 2010 Does it need to be structured this way at all? I don't know what you plan to use it for, so I can't really say. My instinct says that everything below the top "row" can be accomplished with a single, repeating background image. Take the composite image that you probably started with, and crop it so it's 1px tall by, I guess, 287px wide. It will be small and you won't need tons of HTML to get the same effect. Just make it the background of #highYella and have it repeat-y . The top "row" could be all one image too, right? That basically reduces your HTML to this:<div id="#highYella"><img src="composite.jpg"></div>And you now have the option of filling the rest of that div with real content. (It looks kind of like the frame for a menu or newswire.)Unless this is a school assignment of some kind . . . Link to comment Share on other sites More sharing options...
george Posted November 16, 2010 Author Share Posted November 16, 2010 Does it need to be structured this way at all?No. And I like your idea of creating and using the 1px high 'row' to fill in the space with. This is being used for a carry out menu. About school assignments, I worked up so much debt paying for classes that were all review and did not help me find work that now I can't even dream about taking more classes without dreading the unservicable debt. Thanks as alwaysGeorge Link to comment Share on other sites More sharing options...
thescientist Posted November 16, 2010 Share Posted November 16, 2010 You could<table cellspacing="0" cellpadding="0"><tr><td>IMG tag here</td></tr><tr><td>IMG tag here</td></tr><tr><td>IMG tag here</td></tr></table So this will work. ehh....why tables? There's certainly a much more practical (read: semantic) solution. Link to comment Share on other sites More sharing options...
jeffman Posted November 16, 2010 Share Posted November 16, 2010 <insert mind-numbing debate about table-based layouts> Link to comment Share on other sites More sharing options...
Dilated Posted November 17, 2010 Share Posted November 17, 2010 <insert mind-numbing debate about table-based layouts>I was waiting for this as well. :)As well as the point that any design-related images should be strictly CSS. (I'm guessing these are design related, I haven't looked.) Link to comment Share on other sites More sharing options...
george Posted November 17, 2010 Author Share Posted November 17, 2010 <insert mind-numbing debate about table-based layouts>The nifty thing about the six images I use for the top corners, sides, and fill space, is that now I can expand or shrink my box dynamically and retain my grapic corners and sides. That's the plan anyway. Link to comment Share on other sites More sharing options...
Ingolme Posted November 17, 2010 Share Posted November 17, 2010 My favourite way to remove the space below inline elements is to apply vertical-align: middle; to them. Working with a lot of floats can be complicated. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.