1

I'm having some trouble getting this layout to work. I'm trying to make something like this ...I'd like an outer containing box of a fixed size, and fixed-size elements within it. There should be a small vertical element on the left, and then two rows of elements next to that. I've tried using display:inline-block, float:left, using spans, using divs, using lists, and everything I've tried has had some problem.

My most successful attempt used an unordered list and inline-block and float:left and it looked exactly how I want it....except for the following problem. I'd prefer for any content that extends past the right of the outer box to be cut off. As you can see in the image, in the top right cell what fits is shown ("asdf"), and what doesn't fit is hidden ("g"). No matter what I've tried, it either hides the whole element, or it pushes it down to the next line. I've used a normal vertical unordered list and it behaves just like this, it cuts off whatever is at the bottom and extends past the outer div.

I apologize if this is too vague, but can someone maybe provide an example of how to go about this?

Kevin
  • 11
  • 1
  • Sorry, here's a jsfiddle: http://jsfiddle.net/yGEwK/ This one works as I'd like it to. The problem comes in not with the text overflowing, but if the li width is too great. In this one http://jsfiddle.net/NFwYT/ I've changed the width to be slightly bigger, and instead of cutting off the excess, it messes up the whole layout. I'd like it instead to just show as much as possible, and hide the rest. Hopefully that clears things up a little. – Kevin Jul 14 '13 at 01:42
  • I think the problem is trying to both force the elements to hide the overflow, but also have a second row of them. white-space:nowrap seems to fix my overflow problem, but I don't know how to then get a second row of elements. Do I need to just abandon the ul and use divs to do this? – Kevin Jul 14 '13 at 02:30
  • Since the problem only happens if the width of the
  • s are greater than the width of the list, is it even an issue? I wouldn't set it that way on purpose, my only concern is that if it somehow doesn't render the way I intend it to, then part of it would disappear or would go down to the bottom. As long as I keep the widths smaller than the width of the ul, then do I even need to worry about it?
  • – Kevin Jul 14 '13 at 03:01
  • I updated my solution to fit your requests. In practice it's pretty non-important because the fix is kind of complex, I wouldn't worry about it in use much often because content is rarely dynamic and in need of it at the same time – Zach Saucier Jul 14 '13 at 03:02
  • Did I end up answering your question? – Zach Saucier Jun 17 '14 at 23:33